@ -236,27 +236,27 @@ int main(int argc, char** argv) {
/* Set variables to position objects on screen */
/* Set variables to position objects on screen */
intselected_item=0;// variable to hold the index of the selected item
intselected_item=0;// variable to hold the index of the selected item
char*text_to_display="Select Game Mode";// Text to display
constchar*text_to_display="Select Game Mode";// Text to display
/* Size of the label, drop down box and button */
/* Size of the label, drop down box and button */
Vector2label_size=MeasureTextEx(GetFontDefault(),text_to_display,font_size,font_spacing);// Set the size based on the width of the string to print, the font size and the text spacing. I added 1 to font_size and font_spacing, to account for any possible rounding errors, since the function expects floats.
Vector2label_size=MeasureTextEx(GetFontDefault(),text_to_display,font_size,font_spacing);// Set the size based on the width of the string to print, the font size and the text spacing. I added 1 to font_size and font_spacing, to account for any possible rounding errors, since the function expects floats.
/* Drop-down menu, that allows user to select game mode */
/* Drop-down menu, that allows user to select game mode */
if(GuiDropdownBox((Rectangle){(WIDTH/2)-(box_size.x/2),(HEIGHT/2)-(HEIGHT/8),box_size.x,box_size.y},"SINGLE;CLIENT;SERVER",&selected_item,is_being_edited)){// This function returns != 0 if there was a mouse click inside the dropdown area
if(GuiDropdownBox(Rectangle{(WIDTH/2)-(box_size.x/2),(HEIGHT/2)-(HEIGHT/8),box_size.x,box_size.y},"SINGLE;CLIENT;SERVER",&selected_item,is_being_edited)){// This function returns != 0 if there was a mouse click inside the dropdown area
is_being_edited=!is_being_edited;// If the dropdown menu was selected, then it is being edited (or not being edited, if it previously was).
is_being_edited=!is_being_edited;// If the dropdown menu was selected, then it is being edited (or not being edited, if it previously was).
}
}
@ -269,7 +269,7 @@ int main(int argc, char** argv) {
GuiSetStyle(DEFAULT,TEXT_WRAP_MODE,TEXT_WRAP_WORD);// Enable text wrapping so that the long text, displayed below, will be wrapped
GuiSetStyle(DEFAULT,TEXT_WRAP_MODE,TEXT_WRAP_WORD);// Enable text wrapping so that the long text, displayed below, will be wrapped
BeginDrawing();
BeginDrawing();
ClearBackground(BLACK);
ClearBackground(BLACK);
GuiLabel((Rectangle){(WIDTH/2)-(WIDTH/8),(HEIGHT/2)-(HEIGHT/8),WIDTH/4,HEIGHT/4},"W and S control left paddle, Up and Down arrow keys control right paddle. Good luck!");
GuiLabel(Rectangle{(WIDTH/2)-(WIDTH/8),(HEIGHT/2)-(HEIGHT/8),WIDTH/4,HEIGHT/4},"W and S control left paddle, Up and Down arrow keys control right paddle. Good luck!");
EndDrawing();
EndDrawing();
Timertimer=timer_init(5);
Timertimer=timer_init(5);
while(!timer_done(timer));
while(!timer_done(timer));
@ -280,8 +280,8 @@ int main(int argc, char** argv) {
button_pressed=false;// Whether submit button is pressed
button_pressed=false;// Whether submit button is pressed
char*ip_text=(char*)calloc(100,sizeof(char));// Holds input of IP text box
char*ip_text=(char*)calloc(100,sizeof(char));// Holds input of IP text box
char*port_text=(char*)calloc(20,sizeof(char));// Holds input of port text box
char*port_text=(char*)calloc(20,sizeof(char));// Holds input of port text box
char*ip_label="Local IP address";
constchar*ip_label="Local IP address";
char*port_label="Port number (1024 - 65535)";
constchar*port_label="Port number (1024 - 65535)";
intport_label_x_size=MeasureTextEx(GetFontDefault(),port_label,font_size,font_spacing).x;// Custom size for port label, because it's long
intport_label_x_size=MeasureTextEx(GetFontDefault(),port_label,font_size,font_spacing).x;// Custom size for port label, because it's long
boolediting_ip=false;// Indicates whether the IP address text box is being edited
boolediting_ip=false;// Indicates whether the IP address text box is being edited
boolediting_port=false;// Indicates whether the port text box is being edited
boolediting_port=false;// Indicates whether the port text box is being edited
@ -289,25 +289,27 @@ int main(int argc, char** argv) {
BeginDrawing();
BeginDrawing();
ClearBackground(BLACK);
ClearBackground(BLACK);
/* Label and text box for IP address */
/* Label and text box for IP address */
GuiLabel((Rectangle){(WIDTH/2)-(label_size.x/2),(HEIGHT/2)-(HEIGHT/6)-label_size.y-10,label_size.x,label_size.y},ip_label);// Label to display text on top
GuiLabel(Rectangle{(WIDTH/2)-(label_size.x/2),(HEIGHT/2)-(HEIGHT/6)-label_size.y-10,label_size.x,label_size.y},ip_label);// Label to display text on top
/* The reason this if statement exists, is largely the same as the reasoning for the drop-down menu. We want to make the text box editable
/* The reason this if statement exists, is largely the same as the reasoning for the drop-down menu. We want to make the text box editable