Commit d1d13216 authored by Charadon's avatar Charadon
Browse files

Fixed some bugs and a segfault

parent 2dd8b8b6
Pipeline #6260 failed with stages
in 1 minute and 21 seconds
......@@ -5,7 +5,7 @@
int Difficulty = 1;
atomic_int Ticks = 0;
bool GameGoing = true;
char *VersionString;
char VersionString[256];
mtx_t AudioQueueBeingModified;
......@@ -105,7 +105,7 @@ int main() {
SetWindowMinSize(1280, 720);
//Init Variables
strcpy(VersionString, "Version 0.2 - AEOLUS");
strncpy(VersionString, "Version 0.2 - AEOLUS", sizeof(VersionString));
//Populate Audio Queue
for(unsigned int i = 0; i < 20; i++) {
......@@ -137,6 +137,7 @@ int main() {
GameGoing = false; // Make sure the game is going to end.
thrd_join(AudioThread, NULL);
thrd_join(InternalClock, NULL);
CloseWindow();
return(0);
}
......@@ -35,7 +35,7 @@ struct Balls {
extern int Difficulty;
extern bool GameGoing;
extern atomic_int Ticks;
extern char *VersionString;
extern char VersionString[256];
void enemy(struct Players *Enemy, struct Balls ball);
void ball(Rectangle *Player, Rectangle *Enemy, struct Balls *Ball, int *PlayerScore, int *EnemyScore);
......
......@@ -34,7 +34,13 @@ int title_screen() {
Rectangle *Selected;
Selected = &Versus;
EnableCursor();
while(!WindowShouldClose() && TitleScreenGoing == true) {
while(TitleScreenGoing == true && GameGoing == true) {
if (WindowShouldClose()) { //Quit Game if the window is closed.
GameGoing = false;
TitleScreenGoing = false;
}
MainCamera.zoom = GetScreenHeight()/720.0f;
Mouse.x = GetMouseX()/MainCamera.zoom;
Mouse.y = GetMouseY()/MainCamera.zoom;
......@@ -70,7 +76,7 @@ int title_screen() {
DrawText("Help", 20, 300, 48, WHITE);
DrawText("Exit", 20, 350, 48, WHITE);
EndMode2D();
DrawText(VersionString, GetScreenWidth()-200, GetScreenHeight()-32, 32, GREEN);
DrawText(VersionString, GetScreenWidth()-400, GetScreenHeight()-32, 32, GREEN);
EndDrawing();
}
return -1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment