diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | TODO.md | 4 | ||||
| -rw-r--r-- | ante.h | 9 | ||||
| -rw-r--r-- | helpers.h (renamed from main.h) | 4 | ||||
| -rw-r--r-- | main.c | 63 |
5 files changed, 65 insertions, 17 deletions
@@ -1,4 +1,4 @@ -main: main.c main.h +main: main.c helpers.h ante.h gcc main.c -lraylib -o output/main ./output/main @@ -1,6 +1,8 @@ [] Cmatrix for the Title Menu Background [] find a wood-click sfx for clicks - +[] make the binary texture for the music bars +[] Make the Menu Screen Work + [] Try Anchoring the insides of Each rectangle, to the rectangle. -- Done [X] hold FPS settings when vsync_check is true [X] Check the vsync_check value and then set the VSYNC_HINT to true @@ -0,0 +1,9 @@ +char *ante[12] = {"Bit", "Byte", "KiloByte", "MegaByte", + "GigaByte", "TeraByte", "PetaByte", "ExaByte", + "ZettaByte", "YottaByte", "RonnaBye", "QuettaByte"}; + +int ante_score[12] = { + 300, 600, 1200, 2400, + 3000, 3500, 4000, 5000, + 6000,7000,8000,9000}; + @@ -18,11 +18,9 @@ #define IsMouseInside(rec) CheckCollisionPointRec(mouse_position, rec) -/* #define HIGHLIGHT_COLOR */ -/* #define CLICK_COLOR */ typedef enum ScreenType { - MainScreen, SettingsScreen + TitleScreen, SettingsScreen, GameStartScreen } ScreenType; void MainMenu(); @@ -1,12 +1,14 @@ #include <stdlib.h> #include <raylib.h> -#include "main.h" #include <sys/stat.h> #include <unistd.h> #include <stdio.h> #include <string.h> -ScreenType screentype = MainScreen; +#include "helpers.h" +#include "ante.h" + +ScreenType screentype = GameStartScreen; int width = 1920; int height = 1080; int font_size = 12; @@ -32,23 +34,39 @@ int resolution_counter = 0; // Vsync bool vsync_check = false; +#define BTN_PADDING 25 void MainMenu() { WriteDrawTextFont(title_font, "Leetaro", width / 2, height / 5, font_size * 10, 0, BLACK); - /* DrawTextEx(font, text, position, fontSize, spacing, color); */ + // Play Button + - WriteText("Play", width / 2, height / 2, font_size * 5, BLACK); + Rectangle play_btn = MakeBtn(width/2, height/2, "Play", font_size *5, BTN_PADDING); - Rectangle rec = MakeBtn(width/2, height/2 + (height/10), "Settings", font_size * 5, 25); + if (IsMouseInside(play_btn)) { + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { + WriteText("Play", width / 2, height / 2, font_size * 5, RED); + screentype = GameStartScreen; + } else { + WriteText("Play", width/2, height/2, font_size*5.2, BLACK); + ClearBackground(RAYWHITE); + } + } else { + WriteText("Play", width / 2, height / 2, font_size * 5, BLACK); + } + + // Settings Button + Rectangle rec = MakeBtn(width/2, height/2 + (height/10), "Settings", font_size * 5, BTN_PADDING); if (IsMouseInside(rec)) { - if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) { - WriteText( "Settings", width / 2, height / 2 + (height / 10), - (font_size * 5 + 3), RED); + if (IsMouseButtonPressed(MOUSE_LEFT_BUTTON)) { + WriteText("Settings", width / 2, height / 2 + (height / 10), + (font_size * 5 + 3), RED); + screentype = SettingsScreen; } else { WriteText( "Settings", width / 2, height / 2 + (height / 10), - font_size * 5, BLACK); + font_size * 5.1, BLACK); ClearBackground(RAYWHITE); } } else { @@ -68,7 +86,7 @@ void MainMenu() { CloseWindow(); exit(0); } else { - WriteText("Exit", width / 2, height / 2 + (height / 5), font_size * 5, + WriteText("Exit", width / 2, height / 2 + (height / 5), font_size * 5.2, BLACK); } } else { @@ -268,7 +286,7 @@ void SettingsMenu() { if (IsMouseInside(back_rec)) { if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT)) { WriteConfiguration(); - screentype = MainScreen; + screentype = TitleScreen; } } @@ -384,6 +402,24 @@ void WriteConfiguration() { printf("INFO: Wrote Configuration\n"); } +void GameStart() { + ClearBackground(RAYWHITE); + Rectangle left_rect = MakeRect(width / 2 - width / (3), height / 10, + width / 3.5, height - height / 5); + + Rectangle middle_rect = + MakeRect(width / 2, height / 10, width / 3.5, + height - height / 5); + + Rectangle right_rect = + MakeRect(width / 2 + width / (3), height / 10, width / 3.5, + height - height / 5); + + DrawRectangleRec(left_rect, BLACK); + DrawRectangleRec(middle_rect, BLACK); + DrawRectangleRec(right_rect, BLACK); +} + int main() { LoadConfiguration(); @@ -400,13 +436,16 @@ int main() { BeginDrawing(); ClearBackground(RAYWHITE); switch (screentype) { - case MainScreen: + case TitleScreen: MainMenu(); break; case SettingsScreen: ClearBackground(RAYWHITE); SettingsMenu(); break; + case GameStartScreen: + ClearBackground(BLACK); + GameStart(); } EndDrawing(); } |
