[WIP] Multiplayer Tic Tac Toe Tutorials 1-26-15

The Partridge Family were neither partridges nor a family. Discuss.
DeitusPrime
Posts: 97
Joined: June 9th, 2014, 11:14 pm

Re: [WIP] Multiplayer Tic Tac Toe Tutorials 8-24-14

Post by DeitusPrime » August 27th, 2014, 11:19 pm

double-post! (don't come after me lol, I was too lazy to 'edit' my previous one)

Nothing too fancy(for now....mwa ha ha), but its a start.


add somewhere to Game.h
void DrawGUIButton(std::string caption, int posX, int posY, int sizeX, int sizeY, int r, int g, int b);


and the function

Code: Select all

//added GUI
void Game::DrawGUIButton(std::string caption, int posX, int posY, int sizeX, int sizeY, int r, int g, int b)
{
	//draw button border
	gfx.DrawRectangle(posX, posY, sizeX+6, sizeY+6, r, g, b);

	//todo: draw button highlight border

	//todo position (if & center) text inside buttons
	//center_caption (using total len of string)
	int textPosX = posX+4;
	int textPosY = posY+4;

	gfx.WriteString(Consolas, caption, textPosX, textPosY, D3DCOLOR_XRGB(r, g, b));

}
I know... I know, adding to the ints, was a lazy quick-fix for the 'button caption' in the example. (I'll finish this later, I promise, lol) Perhaps when I return, I'll have merging the 'if (IsMouseInRectangle(100, 200, 169, 224))' line into a 'GUI class' of sorts....

Anyways, here's the implementation.

Code: Select all

		//Play Online Button Code
		if (IsMouseInRectangle(100, 200, 169, 224))
		{
		//	gfx.DrawImage(100, 200, Sprite_Button_PlayOnline_HL); //commented out

			DrawGUIButton("Engage!", 100, 200, 169, 224, 35, 35, 200);
			
			if (UserClicksLeftClick())
			{
				CurrentScreen = Screen_LoginScreen;
			}
		}
		else
			//	gfx.DrawImage(100, 200, Sprite_Button_PlayOnline); //commented out
			DrawGUIButton("PlayOnline", 100, 200, 169, 224, 255, 0, 0);
When highlighted, DrawGUIButton changes it's rect and caption from "PlayOnline"(green) to Engage! with a kewl-blue rect).
Choose not to go to destruction with a taco-sauce that is bland...
Go to construction with a taco-sauce that is flavorful!!
Mwa ha ha!!

PutPixel255
Posts: 363
Joined: March 12th, 2013, 6:06 am
Location: "Keep Louisville Weird"

Re: [WIP] Multiplayer Tic Tac Toe Tutorials 8-24-14

Post by PutPixel255 » August 28th, 2014, 2:59 am

I'll let you off with a warning this time now I have to go after the Chopsticks Tetris crazy guy.

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: [WIP] Multiplayer Tic Tac Toe Tutorials 8-27-14

Post by Pindrought » August 28th, 2014, 3:43 am

Tut 2 is up! Tried to make it the least amount as confusing possible. If there's anything you don't understand about the DisconnectUser function don't worry about it as I haven't covered that.
Let me know what is not clear so I can be sure to go into more detail in the next tutorial.

Edit:@DeitusPrime Nice. If I was going to be making a full on game or something i'd definitely go that route. I just didn't want to go into making a class for buttons for the tic tac toe tutorials as there's already so much to look at and I already had whipped up the button sprites.
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

DeitusPrime
Posts: 97
Joined: June 9th, 2014, 11:14 pm

Re: [WIP] Multiplayer Tic Tac Toe Tutorials 8-27-14

Post by DeitusPrime » August 28th, 2014, 8:47 pm

Pindrought wrote: Edit:@DeitusPrime Nice. If I was going to be making a full on game or something i'd definitely go that route. I just didn't want to go into making a class for buttons for the tic tac toe tutorials as there's already so much to look at and I already had whipped up the button sprites.
Cool. Leave that to me. (It'll be great practice for me anyways)
I'll finish rolling together a GUI class, then share it as a project example on the forums.

EDIT: Here it is:Designing Graphical User Interface (WIP)



Question: Would it be possible(after your other tutorials are done) to add a check_client_version (and download updates) or is this too complicated and\or I ask too much? :lol:
Choose not to go to destruction with a taco-sauce that is bland...
Go to construction with a taco-sauce that is flavorful!!
Mwa ha ha!!

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: [WIP] Multiplayer Tic Tac Toe Tutorials 9-21-14

Post by Pindrought » September 21st, 2014, 9:55 am

Tutorial 3 source files posted. Will not be able to upload the video until around the 28th as the internet where i'm staying can't support me uploading the video. Says it will take approx 2 days and i'd be hogging the bandwidth here.
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: [WIP] Multiplayer Tic Tac Toe Tutorials 9-28-14

Post by Pindrought » September 28th, 2014, 9:38 am

Video for tutorial 3 uploaded.
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

DeitusPrime
Posts: 97
Joined: June 9th, 2014, 11:14 pm

Re: [WIP] Multiplayer Tic Tac Toe Tutorials 9-28-14

Post by DeitusPrime » September 28th, 2014, 5:58 pm

Hurray!

Glad you were able to finally make the upload. ;)
Choose not to go to destruction with a taco-sauce that is bland...
Go to construction with a taco-sauce that is flavorful!!
Mwa ha ha!!

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: [WIP] Multiplayer Tic Tac Toe Tutorials 9-28-14

Post by chili » October 12th, 2014, 2:47 am

Hey pindrought, nice to see your series progressing here! Do you need more slots for attaching files to your post? I can look into the admin settings and see if I can fix that for you.
Chili

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: [WIP] Multiplayer Tic Tac Toe Tutorials 9-28-14

Post by Pindrought » October 17th, 2014, 12:07 am

Sorry guys for the lack of updates.

@Chili, I would love if you could do that!
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

DeitusPrime
Posts: 97
Joined: June 9th, 2014, 11:14 pm

Re: [WIP] Multiplayer Tic Tac Toe Tutorials 9-28-14

Post by DeitusPrime » October 24th, 2014, 5:33 pm

Sorry guys for the lack of updates.
Hehe, no worries. It's tutorial 4 that I'm waiting for, but I've other stuff to do so I guess I'll patiently wait. ;)
Choose not to go to destruction with a taco-sauce that is bland...
Go to construction with a taco-sauce that is flavorful!!
Mwa ha ha!!

Post Reply