summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorphysick <mynameisgennadiy@vk.com>2026-07-31 18:36:22 +0500
committerphysick <mynameisgennadiy@vk.com>2026-07-31 18:36:22 +0500
commit722a9d1e729aff2eb64f3c064c33d547ea980eb0 (patch)
treefb03a4f5bf76d1274565ef261e7f2e3a579a0823 /src/resources
parente20b4c3a5dfe081fa2d6d772617307fae4689698 (diff)
Buttons GUI start
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/TextruesAtlas.h18
-rw-r--r--src/resources/resources.c34
-rw-r--r--src/resources/resources.h6
3 files changed, 58 insertions, 0 deletions
diff --git a/src/resources/TextruesAtlas.h b/src/resources/TextruesAtlas.h
new file mode 100644
index 0000000..5fdafc3
--- /dev/null
+++ b/src/resources/TextruesAtlas.h
@@ -0,0 +1,18 @@
+/*
+ * This header file binds texture type to its location on the atlas.
+ * They are hardcoded for now until I find a better way to do that.
+ */
+
+#include <raylib.h>
+
+#ifndef TEXTURES_ATLAS_H
+#define TEXTURES_ATLAS_H
+
+static const Rectangle SUBMIT_BUTTON_LOCATION = {
+ .x = 0,
+ .y = 0,
+ .width = 32,
+ .height = 32,
+};
+
+#endif // TEXTURES_ATLAS_H
diff --git a/src/resources/resources.c b/src/resources/resources.c
index e82b6e0..c1b78b5 100644
--- a/src/resources/resources.c
+++ b/src/resources/resources.c
@@ -5,9 +5,43 @@
Font MainFont;
Font MonoFont;
+Texture ButtonsAtlas;
+
+Texture PrepareTexture(char *location) {
+ Image img = LoadImage(location);
+ // Applying colorscheme
+ ImageColorReplace(&img,
+ (Color) { .r = 0xFF, .g = 0x00, .b = 0x00, .a = 0xFF },
+ COLORSCHEME_RED);
+ ImageColorReplace(&img,
+ (Color) { .r = 0x00, .g = 0xFF, .b = 0x00, .a = 0xFF },
+ COLORSCHEME_GREEN);
+ ImageColorReplace(&img,
+ (Color) { .r = 0XFF, .g = 0x7F, .b = 0x00, .a = 0xFF },
+ COLORSCHEME_YELLOW);
+ ImageColorReplace(&img,
+ (Color) { .r = 0x00, .g = 0x00, .b = 0xFF, .a = 0xFF },
+ COLORSCHEME_ORANGE);
+ ImageColorReplace(&img,
+ (Color) { .r = 0x00, .g = 0x00, .b = 0x00, .a = 0xFF },
+ COLORSCHEME_BROWN);
+ ImageColorReplace(&img,
+ (Color) { .r = 0xFF, .g = 0xFF, .b = 0xFF, .a = 0xFF },
+ COLORSCHEME_WHITE);
+ Texture outp = LoadTextureFromImage(img);
+ UnloadImage(img);
+ return outp;
+}
+
void LoadResources() {
MainFont = LoadFontEx("assets/fonts/coolvetica.ttf", 100, NULL, 0);
MonoFont = LoadFontEx("assets/fonts/monofont.ttf", 100, NULL, 0);
+
+ ButtonsAtlas = PrepareTexture("assets/textures/buttons_atlas.png");
+}
+
+Texture *GetButtonsAtlas() {
+ return &ButtonsAtlas;
}
Font *GetMainFont() { return &MainFont; }
diff --git a/src/resources/resources.h b/src/resources/resources.h
index 8f6cd1d..0837317 100644
--- a/src/resources/resources.h
+++ b/src/resources/resources.h
@@ -38,4 +38,10 @@ void LoadResources();
Font *GetMainFont();
Font *GetMonoFont();
+typedef enum {
+ SUBMIT_BUTTON,
+} TEXTURE_TYPE ;
+
+Texture *GetButtonsAtlas();
+
#endif // RESOURCES_H