summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--TODO.md4
-rw-r--r--ante.h9
-rw-r--r--helpers.h (renamed from main.h)4
-rw-r--r--main.c63
5 files changed, 65 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 458e780..60b9de9 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/TODO.md b/TODO.md
index 18fb0b7..382b693 100644
--- a/TODO.md
+++ b/TODO.md
@@ -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
diff --git a/ante.h b/ante.h
new file mode 100644
index 0000000..02c48f0
--- /dev/null
+++ b/ante.h
@@ -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};
+
diff --git a/main.h b/helpers.h
index 9bfdc91..d6479f9 100644
--- a/main.h
+++ b/helpers.h
@@ -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();
diff --git a/main.c b/main.c
index 16e653d..b0511a5 100644
--- a/main.c
+++ b/main.c
@@ -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();
}