menu
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 9.2 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 849 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 956 B |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 6.7 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 261 B |
|
After Width: | Height: | Size: 1.5 KiB |
@@ -7,4 +7,5 @@
|
||||
- [ ] Init values should be stored in a seperate file and loaded. When clicking new game game should reload all init values
|
||||
- [ ] Create layers enum and render layers in their order. removes code order rendering. Group same layer (z) height object in one layer
|
||||
- [ ] Fix asset include rotation temporary fix with 180
|
||||
- [x] Custom Font and Title in Menu
|
||||
- [x] Custom Font and Title in Menu
|
||||
- [ ] Cursord logic can be moved from game and menu to main but deactivatet at logo
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
typedef enum {
|
||||
NOT_CLICKED,
|
||||
HOVER,
|
||||
CLICKED
|
||||
} ButtonState;
|
||||
|
||||
@@ -13,8 +14,10 @@ typedef struct
|
||||
{
|
||||
Sprite sprite;
|
||||
Vector2 notClicked;
|
||||
Vector2 hover;
|
||||
Vector2 clicked;
|
||||
bool isHovered;
|
||||
bool isClicked;
|
||||
} ImageButton;
|
||||
|
||||
typedef struct
|
||||
@@ -22,7 +25,7 @@ typedef struct
|
||||
Sprite sprite;
|
||||
} ImageElement;
|
||||
|
||||
ImageButton CreateImageButton(ButtonState state, Texture2D *texture, const TextureAsset *asset, Vector2 *source, Vector2 *clicked, Rectangle *destRec){
|
||||
ImageButton CreateImageButton(ButtonState state, Texture2D *texture, const TextureAsset *asset, Vector2 *source, Vector2 *clicked, Vector2 *hover, Rectangle *destRec){
|
||||
return (ImageButton){
|
||||
.sprite = {
|
||||
.texture = *texture,
|
||||
@@ -34,6 +37,7 @@ ImageButton CreateImageButton(ButtonState state, Texture2D *texture, const Textu
|
||||
.color = WHITE
|
||||
},
|
||||
.notClicked = (Vector2){source->x, source->y},
|
||||
.hover = *hover,
|
||||
.clicked = *clicked
|
||||
};
|
||||
}
|
||||
@@ -52,47 +56,32 @@ ImageElement CreateImageElement(Texture2D *texture, const TextureAsset *asset, V
|
||||
};
|
||||
}
|
||||
|
||||
void PrintImageButton(const ImageButton btn) {
|
||||
printf("ImageButton:\n");
|
||||
printf(" Sprite.texture: id = %d\n", btn.sprite.texture.id);
|
||||
printf(" Sprite.sourceRec: x = %f, y = %f, width = %f, height = %f\n",
|
||||
btn.sprite.sourceRec.x, btn.sprite.sourceRec.y,
|
||||
btn.sprite.sourceRec.width, btn.sprite.sourceRec.height);
|
||||
printf(" Sprite.destRec: x = %f, y = %f, width = %f, height = %f\n",
|
||||
btn.sprite.destRec.x, btn.sprite.destRec.y,
|
||||
btn.sprite.destRec.width, btn.sprite.destRec.height);
|
||||
printf(" Sprite.frameSize: x = %f, y = %f\n",
|
||||
btn.sprite.frameSize.x, btn.sprite.frameSize.y);
|
||||
printf(" Sprite.origin: x = %f, y = %f\n",
|
||||
btn.sprite.origin.x, btn.sprite.origin.y);
|
||||
printf(" Sprite.rotation: %f\n", btn.sprite.rotation);
|
||||
printf(" Sprite.color: r = %d, g = %d, b = %d, a = %d\n",
|
||||
btn.sprite.color.r, btn.sprite.color.g,
|
||||
btn.sprite.color.b, btn.sprite.color.a);
|
||||
printf(" notClicked: x = %f, y = %f\n", btn.notClicked.x, btn.notClicked.y);
|
||||
printf(" clicked: x = %f, y = %f\n", btn.clicked.x, btn.clicked.y);
|
||||
}
|
||||
|
||||
int isImageButtonClicked(ImageButton *b, Sound soundHover, Sound soundClick){
|
||||
if (CheckCollisionPointRec(GetMousePosition(), b->sprite.destRec)) {
|
||||
|
||||
if (!b->isHovered) {
|
||||
PlaySound(soundHover);
|
||||
b->isHovered = true;
|
||||
UpdateSpriteSourceRec(&b->sprite, &b->hover);
|
||||
}
|
||||
|
||||
if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)){
|
||||
UpdateSpriteSourceRec(&b->sprite, &b->clicked);
|
||||
if (!b->isClicked) {
|
||||
PlaySound(soundClick);
|
||||
b->isClicked = true;
|
||||
UpdateSpriteSourceRec(&b->sprite, &b->clicked);
|
||||
}
|
||||
}
|
||||
if (IsMouseButtonReleased(MOUSE_LEFT_BUTTON))
|
||||
{
|
||||
PlaySound(soundClick);
|
||||
b->isClicked = false;
|
||||
b->isHovered = false;
|
||||
UpdateSpriteSourceRec(&b->sprite, &b->notClicked);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
UpdateSpriteSourceRec(&b->sprite, &b->notClicked);
|
||||
b->isClicked = false;
|
||||
b->isHovered = false;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define INPUT_H
|
||||
|
||||
typedef struct {
|
||||
Vector2 screenPosition;
|
||||
Vector2 worldPosition;
|
||||
float zoomSpeed;
|
||||
float minZoom;
|
||||
@@ -10,17 +11,27 @@ typedef struct {
|
||||
float wheelMove;
|
||||
bool leftButton;
|
||||
bool rightButton;
|
||||
Texture2D cursorTexture;
|
||||
} Mouse;
|
||||
|
||||
Mouse CreateMouse(float zoomSpeed, float minZoom, float maxZoom){
|
||||
Mouse CreateMouse(float zoomSpeed, float minZoom, float maxZoom, Texture2D *texture){
|
||||
HideCursor();
|
||||
return (Mouse){
|
||||
.zoomSpeed = zoomSpeed,
|
||||
.minZoom = minZoom,
|
||||
.maxZoom = maxZoom
|
||||
.maxZoom = maxZoom,
|
||||
.cursorTexture = *texture
|
||||
};
|
||||
}
|
||||
|
||||
void UpdateMouseScreen(Mouse *mouse){
|
||||
mouse->screenPosition = GetMousePosition();
|
||||
|
||||
}
|
||||
|
||||
void UpdateMouse(Mouse *mouse, Camera2D *camera) {
|
||||
|
||||
mouse->screenPosition = GetMousePosition();
|
||||
mouse->worldPosition = GetScreenToWorld2D(GetMousePosition(), *camera);
|
||||
mouse->leftButton = IsMouseButtonDown(MOUSE_LEFT_BUTTON);
|
||||
mouse->rightButton = IsMouseButtonDown(MOUSE_RIGHT_BUTTON);
|
||||
|
||||
@@ -40,4 +40,15 @@ void RenderSprite(const Sprite *sprite){
|
||||
);
|
||||
}
|
||||
|
||||
void PrintSprite(const Sprite *sprite) {
|
||||
printf("Sprite:\n");
|
||||
printf(" Sprite.texture: id = %d\n", sprite->texture.id);
|
||||
printf(" Sprite.sourceRec: x = %f, y = %f, width = %f, height = %f\n", sprite->sourceRec.x, sprite->sourceRec.y, sprite->sourceRec.width, sprite->sourceRec.height);
|
||||
printf(" Sprite.destRec: x = %f, y = %f, width = %f, height = %f\n", sprite->destRec.x, sprite->destRec.y, sprite->destRec.width, sprite->destRec.height);
|
||||
printf(" Sprite.frameSize: x = %f, y = %f\n", sprite->frameSize.x, sprite->frameSize.y);
|
||||
printf(" Sprite.origin: x = %f, y = %f\n", sprite->origin.x, sprite->origin.y);
|
||||
printf(" Sprite.rotation: %f\n", sprite->rotation);
|
||||
printf(" Sprite.color: r = %d, g = %d, b = %d, a = %d\n", sprite->color.r, sprite->color.g, sprite->color.b, sprite->color.a);
|
||||
}
|
||||
|
||||
#endif // SPRITE_H
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#ifndef BACKGROUND_H
|
||||
#define BACKGROUND_H
|
||||
#include "../engine/sprite.h"
|
||||
#include "raylib.h"
|
||||
|
||||
typedef struct {
|
||||
Sprite sprite;
|
||||
float scrolling;
|
||||
float scale;
|
||||
float scrollSpeed;
|
||||
Vector2 pos;
|
||||
} Background;
|
||||
|
||||
void InitBackground(float scrollSpeed, Background *bg, Texture2D *texture, const TextureAsset *backgroundAsset){
|
||||
bg->scrolling = 0.0f;
|
||||
bg->scrollSpeed = scrollSpeed;
|
||||
bg->scale = 1.0f;
|
||||
bg->sprite = (Sprite){
|
||||
.texture = *texture,
|
||||
.sourceRec = (Rectangle){0.0f,0.0f,backgroundAsset->frameWidth, backgroundAsset->frameHeight},
|
||||
.destRec = (Rectangle){0.0f,0.0f,(float)GetScreenWidth(),(float)GetScreenHeight()},
|
||||
.origin = (Vector2){0.0f,0.0f},
|
||||
.rotation = 0.0f,
|
||||
.color = WHITE
|
||||
};
|
||||
}
|
||||
|
||||
void UpdateBackground(Background *bg){
|
||||
bg->scrolling -= bg->scrollSpeed;
|
||||
|
||||
if (bg->scrolling <= -bg->sprite.texture.width * bg->scale) {
|
||||
bg->scrolling = 0;
|
||||
}
|
||||
|
||||
bg->pos = (Vector2){ bg->scrolling, 0.0f };
|
||||
UpdateSpriteDestRec(&bg->sprite, &bg->pos);
|
||||
}
|
||||
|
||||
void RenderBackground(Background *bg){
|
||||
|
||||
Sprite temp0 = bg->sprite;
|
||||
float newX0 = bg->sprite.destRec.x + bg->sprite.texture.width * bg->scale * 2;
|
||||
Vector2 newPos0 = {newX0, bg->sprite.destRec.y};
|
||||
UpdateSpriteDestRec(&temp0, &newPos0);
|
||||
RenderSprite(&temp0);
|
||||
|
||||
Sprite temp = bg->sprite;
|
||||
float newX = bg->sprite.destRec.x + bg->sprite.texture.width * bg->scale;
|
||||
Vector2 newPos = {newX, bg->sprite.destRec.y};
|
||||
UpdateSpriteDestRec(&temp, &newPos);
|
||||
RenderSprite(&temp);
|
||||
|
||||
RenderSprite(&bg->sprite);
|
||||
|
||||
Sprite temp2 = bg->sprite;
|
||||
float newX2 = bg->sprite.destRec.x - bg->sprite.texture.width * bg->scale;
|
||||
Vector2 newPos2 = {newX2, bg->sprite.destRec.y};
|
||||
UpdateSpriteDestRec(&temp2, &newPos2);
|
||||
RenderSprite(&temp2);
|
||||
|
||||
Sprite temp3 = bg->sprite;
|
||||
float newX3 = bg->sprite.destRec.x - bg->sprite.texture.width * bg->scale * 2;
|
||||
Vector2 newPos3 = {newX3, bg->sprite.destRec.y};
|
||||
UpdateSpriteDestRec(&temp3, &newPos3);
|
||||
RenderSprite(&temp3);
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif // BACKGROUND_H
|
||||
@@ -64,7 +64,9 @@ void InitGame(GameState* g, Display *display){
|
||||
|
||||
// I/O
|
||||
g->camera = CreateCamera(display->width, display->height, g->player.physics.position, 10.0f);
|
||||
g->mouse = CreateMouse(0.10f, 5.0f, 10.0f);
|
||||
|
||||
|
||||
g->mouse = CreateMouse(0.10f, 5.0f, 10.0f, &g->textures[CURSOR]);
|
||||
|
||||
}
|
||||
|
||||
@@ -97,6 +99,7 @@ void RenderGame(GameState* g){
|
||||
BeginMode2D(g->camera);
|
||||
RenderComponents(g);
|
||||
EndMode2D();
|
||||
DrawTextureRec(g->mouse.cursorTexture, (Rectangle){ 0, 0, g->mouse.cursorTexture.width, -g->mouse.cursorTexture.height }, (Vector2){ g->mouse.screenPosition.x, GetScreenHeight() - g->mouse.screenPosition.y - g->mouse.cursorTexture.height}, WHITE);
|
||||
EndTextureMode();
|
||||
BeginDrawing();
|
||||
ClearBackground(BLACK);
|
||||
|
||||
@@ -12,6 +12,7 @@ typedef enum {
|
||||
BEE,
|
||||
GRASS,
|
||||
HIVE,
|
||||
CURSOR,
|
||||
TEX_COUNT
|
||||
} TextureID;
|
||||
|
||||
@@ -22,7 +23,8 @@ const TextureAsset texAssets[TEX_COUNT] = {
|
||||
{"assets/flower.png", 16.0f, 16.0f, 45.0f},
|
||||
{"assets/character_bee.png", 16.0f, 16.0f, 0.0f},
|
||||
{"assets/grass.png", 16.0f, 16.0f, 0.0f},
|
||||
{"assets/hive.png", 32.0f, 32.0f, 0.0f}
|
||||
{"assets/hive.png", 32.0f, 32.0f, 0.0f},
|
||||
{"assets/SproutLandsUI/Spritesheets/Mouse sprites/TriangleMouseicon1.png", 16.0f, 16.0f, 0.0f }
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -7,21 +7,31 @@
|
||||
#include "../engine/gamegui.h"
|
||||
#include "menuassets.h"
|
||||
#include "colors.h"
|
||||
#include "../engine/input.h"
|
||||
#include "background.h"
|
||||
#include "../engine/soundtrack.h"
|
||||
|
||||
typedef struct {
|
||||
Assets assets;
|
||||
Mouse mouse;
|
||||
Texture2D textures[MENU_TEX_COUNT];
|
||||
Sound sounds[MENU_SOUND_COUNT];
|
||||
Soundtrack soundtracks[MENU_SOUNDTRACK_COUNT];
|
||||
ImageElement board;
|
||||
ImageButton playButton;
|
||||
ImageButton quitButton;
|
||||
int menuScale;
|
||||
Background background;
|
||||
Background midground;
|
||||
Background foreground;
|
||||
} MenuState;
|
||||
|
||||
void InitMenu(MenuState *m){
|
||||
|
||||
m->assets = (Assets){
|
||||
.textureAssets = menuTextureAssets,
|
||||
.soundAssets = menuSoundAssets
|
||||
.soundAssets = menuSoundAssets,
|
||||
.soundtrackAssets = menuSoundtrackAssets
|
||||
};
|
||||
|
||||
for (int i = 0; i < MENU_TEX_COUNT; i++){
|
||||
@@ -32,14 +42,26 @@ void InitMenu(MenuState *m){
|
||||
m->sounds[i] = LoadSound(m->assets.soundAssets[i].path);
|
||||
}
|
||||
|
||||
int menuScale = 4;
|
||||
for (int i = 0; i < MENU_SOUNDTRACK_COUNT; i++){
|
||||
m->soundtracks[i] = LoadSoundtrack(m->assets.soundtrackAssets[i].path);
|
||||
}
|
||||
|
||||
InitBackground(0.1f, &m->background, &m->textures[MENU_CLOUD_BACKGROUND], &m->assets.textureAssets[MENU_CLOUD_BACKGROUND]);
|
||||
InitBackground(0.2f, &m->midground, &m->textures[MENU_CLOUD_MIDGROUND], &m->assets.textureAssets[MENU_CLOUD_MIDGROUND]);
|
||||
InitBackground(0.3f, &m->foreground, &m->textures[MENU_CLOUD_FOREGROUND], &m->assets.textureAssets[MENU_CLOUD_FOREGROUND]);
|
||||
|
||||
m->mouse = CreateMouse(0.10f, 5.0f, 10.0f, &m->textures[MENU_CURSOR_TEX]);
|
||||
|
||||
m->menuScale = 4;
|
||||
int screenWidth = GetScreenWidth();
|
||||
int screenHeight = GetScreenHeight();
|
||||
Vector2 screenCenter = {screenWidth / 2, screenHeight / 2};
|
||||
|
||||
int boardWidth = screenWidth / menuScale * 3.0f;
|
||||
float boardScaleFactor = (float)boardWidth / m->assets.textureAssets[BOARD].frameWidth;
|
||||
int boardHeight = (int)(m->assets.textureAssets[BOARD].frameHeight * boardScaleFactor);
|
||||
|
||||
|
||||
int boardWidth = screenWidth / m->menuScale * 2.5f;
|
||||
float boardScaleFactor = (float)boardWidth / m->assets.textureAssets[MENU_BOARD_TEX].frameWidth;
|
||||
int boardHeight = (int)(m->assets.textureAssets[MENU_BOARD_TEX].frameHeight * boardScaleFactor);
|
||||
|
||||
Vector2 boardSource = {128.0f,0.0f};
|
||||
Rectangle boardDestRec = {
|
||||
@@ -49,17 +71,19 @@ void InitMenu(MenuState *m){
|
||||
.height = boardHeight
|
||||
};
|
||||
|
||||
m->board = CreateImageElement(&m->textures[BOARD], &m->assets.textureAssets[BOARD], &boardSource, &boardDestRec);
|
||||
m->board = CreateImageElement(&m->textures[MENU_BOARD_TEX], &m->assets.textureAssets[MENU_BOARD_TEX], &boardSource, &boardDestRec);
|
||||
|
||||
int buttonWidth = screenWidth / menuScale;
|
||||
float buttonScaleFactor = (float)buttonWidth / m->assets.textureAssets[BIG_BUTTONS].frameWidth;
|
||||
int buttonHeight = (int)(m->assets.textureAssets[BIG_BUTTONS].frameHeight * buttonScaleFactor);
|
||||
int buttonWidth = screenWidth / m->menuScale;
|
||||
float buttonScaleFactor = (float)buttonWidth / m->assets.textureAssets[MENU_BIG_BUTTONS_TEX].frameWidth;
|
||||
int buttonHeight = (int)(m->assets.textureAssets[MENU_BIG_BUTTONS_TEX].frameHeight * buttonScaleFactor);
|
||||
int buttonSpacing = buttonHeight;
|
||||
|
||||
Vector2 playButtonNotPressed = { 0.0f, 96.0f};
|
||||
Vector2 quitButtonNotPressed = { 0.0f, 0.0f};
|
||||
Vector2 playButtonPressed = { 96.0f, 96.0f};
|
||||
Vector2 quitButtonPressed = { 96.0f, 0.0f};
|
||||
Vector2 playButtonHover = { 96.0f, 96.0f};
|
||||
Vector2 quitButtonHover = { 96.0f, 0.0f};
|
||||
Vector2 playButtonPressed = { 192.0f, 96.0f};
|
||||
Vector2 quitButtonPressed = { 192.0f, 0.0f};
|
||||
|
||||
Rectangle playButtonDestRec = {
|
||||
.x = screenCenter.x - (buttonWidth / 2),
|
||||
@@ -75,13 +99,20 @@ void InitMenu(MenuState *m){
|
||||
.height = buttonHeight
|
||||
};
|
||||
|
||||
|
||||
m->playButton = CreateImageButton(NOT_CLICKED, &m->textures[BIG_BUTTONS], &m->assets.textureAssets[BIG_BUTTONS], &playButtonNotPressed, &playButtonPressed, &playButtonDestRec);
|
||||
m->quitButton = CreateImageButton(NOT_CLICKED, &m->textures[BIG_BUTTONS], &m->assets.textureAssets[BIG_BUTTONS], &quitButtonNotPressed, &quitButtonPressed, &quitButtonDestRec);
|
||||
m->playButton = CreateImageButton(NOT_CLICKED, &m->textures[MENU_BIG_BUTTONS_TEX], &m->assets.textureAssets[MENU_BIG_BUTTONS_TEX], &playButtonNotPressed, &playButtonPressed, &playButtonHover, &playButtonDestRec);
|
||||
m->quitButton = CreateImageButton(NOT_CLICKED, &m->textures[MENU_BIG_BUTTONS_TEX], &m->assets.textureAssets[MENU_BIG_BUTTONS_TEX], &quitButtonNotPressed, &quitButtonPressed, &quitButtonHover, &quitButtonDestRec);
|
||||
}
|
||||
|
||||
void UpdateMenu(MenuState *m, State *state){
|
||||
|
||||
for (int i = 0; i < MENU_SOUNDTRACK_COUNT; i++){ UpdateSoundtrack(&m->soundtracks[i]); }
|
||||
|
||||
UpdateBackground(&m->background);
|
||||
UpdateBackground(&m->midground);
|
||||
UpdateBackground(&m->foreground);
|
||||
|
||||
UpdateMouseScreen(&m->mouse);
|
||||
|
||||
if (isImageButtonClicked(&m->playButton, m->sounds[HOVER_SOUND], m->sounds[CLICK_SOUND])){
|
||||
state->gameStarted = true;
|
||||
state->currentScreen = GAMEPLAY;
|
||||
@@ -96,11 +127,22 @@ void UpdateMenu(MenuState *m, State *state){
|
||||
void RenderMenu(MenuState *m, Font *font, const char* name){
|
||||
BeginDrawing();
|
||||
ClearBackground(WHITE);
|
||||
RenderBackground(&m->background);
|
||||
RenderBackground(&m->midground);
|
||||
RenderBackground(&m->foreground);
|
||||
renderImageElement(&m->board);
|
||||
renderImageButton(&m->playButton);
|
||||
renderImageButton(&m->quitButton);
|
||||
int textWidth = MeasureText(name, font->baseSize);
|
||||
DrawTextEx(*font, name, (Vector2){ GetScreenWidth() / 2 - textWidth / 2, textWidth / 4}, (float)font->baseSize, 2, WHITE);
|
||||
DrawTexturePro(
|
||||
m->mouse.cursorTexture,
|
||||
(Rectangle){ 0, 0, m->mouse.cursorTexture.width, m->mouse.cursorTexture.height},
|
||||
(Rectangle){m->mouse.screenPosition.x, m->mouse.screenPosition.y, m->mouse.cursorTexture.width, m->mouse.cursorTexture.height},
|
||||
(Vector2){0.0f, 0.0f},
|
||||
0.0f,
|
||||
WHITE
|
||||
);
|
||||
DrawFPS(10, 10);
|
||||
EndDrawing();
|
||||
}
|
||||
@@ -108,6 +150,8 @@ void RenderMenu(MenuState *m, Font *font, const char* name){
|
||||
void CleanupMenu(MenuState *m){
|
||||
for (int i = 0; i < MENU_SOUND_COUNT; i++){ UnloadSound(m->sounds[i]); }
|
||||
for (int i = 0; i < MENU_TEX_COUNT; i++){ if (m->textures[i].id > 0) { UnloadTexture(m->textures[i]); } }
|
||||
for (int i = 0; i < MENU_SOUNDTRACK_COUNT; i++){ UnloadMusicStream(m->soundtracks[i].music); }
|
||||
|
||||
}
|
||||
|
||||
#endif // MENU_H
|
||||
|
||||
@@ -3,14 +3,31 @@
|
||||
#include "../engine/asset.h"
|
||||
|
||||
typedef enum {
|
||||
BIG_BUTTONS,
|
||||
BOARD,
|
||||
MENU_CURSOR_TEX,
|
||||
MENU_BIG_BUTTONS_TEX,
|
||||
MENU_BOARD_TEX,
|
||||
MENU_CLOUD_BACKGROUND,
|
||||
MENU_CLOUD_MIDGROUND,
|
||||
MENU_CLOUD_FOREGROUND,
|
||||
MENU_TEX_COUNT
|
||||
} MenuTextureID;
|
||||
|
||||
const TextureAsset menuTextureAssets[MENU_TEX_COUNT] = {
|
||||
{"assets/SproutLandsUI/Spritesheets/UIBigPlayButton.png", 96.0f, 32.0f, 180.0f},
|
||||
{"assets/SproutLandsUI/Spritesheets/Mouse sprites/TriangleMouseicon1.png", 16.0f, 16.0f, 0.0f },
|
||||
{"assets/SproutLandsUI/Spritesheets/UIBigPlayButtonHover.png", 96.0f, 32.0f, 180.0f},
|
||||
{"assets/SproutLandsUI/Spritesheets/Settingmenu.png", 128.0f, 144.0f, 180.0f},
|
||||
{"assets/Clouds/Clouds1/1.png", 576.0f, 324.0f, 180.0f},
|
||||
{"assets/Clouds/Clouds1/2.png", 576.0f, 324.0f, 180.0f},
|
||||
{"assets/Clouds/Clouds1/4.png", 576.0f, 324.0f, 180.0f}
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
MENU_MUSIC,
|
||||
MENU_SOUNDTRACK_COUNT
|
||||
} MenuSoundtrackID;
|
||||
|
||||
const SoundtrackAsset menuSoundtrackAssets[MENU_SOUNDTRACK_COUNT] = {
|
||||
{"assets/merrygoround.wav"}
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
||||