diff options
Diffstat (limited to 'client/main.c')
| -rw-r--r-- | client/main.c | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/client/main.c b/client/main.c index 237c8ce..a38f470 100644 --- a/client/main.c +++ b/client/main.c @@ -1 +1,57 @@ -int main() {} +#include "raylib.h" +#include <stdio.h> + +int main() { + const int screenWidth = 800; + const int screenHeight = 450; + + InitWindow(screenWidth, screenHeight, "Pants - MMO"); + + SetTargetFPS(60); + + char* message = "Welcome to Pants a game by Matthew & Devyn Challman"; + int fontSize = 25; + + int messageWidth = MeasureText(message, fontSize); + int messagePosX = (screenWidth - messageWidth) / 2; + int messagePosY = (screenHeight - fontSize) / 2; + + int buttonW = 150; + int buttonH = 50; + int buttonPosX = (screenWidth - buttonW) / 2; + int buttonPosY = (screenHeight - buttonH) / 2 + 100; + + char *connect = "Connect"; + int connectWidth = MeasureText(connect, fontSize); + int connectPosX = (screenWidth - connectWidth) / 2; + int connectPosY = (screenHeight - fontSize) / 2 + 100; + + while (!WindowShouldClose()) { + + bool connecting = false; + if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) { + struct Vector2 mousePos = GetMousePosition(); + + if (mousePos.x >= buttonPosX && mousePos.x <= buttonPosX + buttonW && + mousePos.y >= buttonPosY && mousePos.y <= buttonPosY + buttonH) { + + connecting = true; + } + } + + BeginDrawing(); + ClearBackground(RAYWHITE); + DrawText(message, messagePosX, messagePosY, fontSize, LIGHTGRAY); + DrawRectangle(buttonPosX, buttonPosY, buttonW, buttonH, GREEN); + + if(connecting) + DrawText(connect, connectPosX, connectPosY, fontSize, RED); + else + DrawText(connect, connectPosX, connectPosY, fontSize, BLUE); + + DrawFPS(0,0); + EndDrawing(); + } + + return 0; +} |