86 lines
2.1 KiB
C
86 lines
2.1 KiB
C
#ifndef MENU_H
|
|
#define MENU_H
|
|
|
|
#include <raylib.h>
|
|
|
|
#include "appCore.h"
|
|
#include "engineGui.h"
|
|
#include "engineInput.h"
|
|
#include "engineSoundtrack.h"
|
|
#include "engineSprite.h"
|
|
|
|
typedef enum {
|
|
MENU_CURSOR_TEX,
|
|
MENU_BIG_BUTTONS_TEX,
|
|
MENU_BOARD_TEX,
|
|
MENU_CLOUD_BACKGROUND,
|
|
MENU_CLOUD_MIDGROUND,
|
|
MENU_CLOUD_FOREGROUND,
|
|
MENU_TEX_COUNT
|
|
} MenuTextureID;
|
|
|
|
typedef enum { MENU_MUSIC, MENU_SOUNDTRACK_COUNT } MenuSoundtrackID;
|
|
|
|
typedef enum { HOVER_SOUND, CLICK_SOUND, MENU_SOUND_COUNT } MenuSoundID;
|
|
|
|
typedef enum MenuView { MAIN = 0, SETTINGS = 1 } MenuView;
|
|
|
|
typedef struct {
|
|
Sprite sprite;
|
|
float scrolling;
|
|
float scale;
|
|
float scrollSpeed;
|
|
Vector2 pos;
|
|
} Background;
|
|
|
|
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;
|
|
ImageButton settingsButton;
|
|
Button restartButton;
|
|
int menuScale;
|
|
Background background;
|
|
Background midground;
|
|
Background foreground;
|
|
} MenuMain;
|
|
|
|
typedef struct {
|
|
Button showFPS;
|
|
Button limitFPS;
|
|
Button soundtrackOn;
|
|
} MenuSettings;
|
|
|
|
typedef struct {
|
|
MenuView menuView;
|
|
MenuMain menuMain;
|
|
MenuSettings menuSettings;
|
|
} MenuState;
|
|
|
|
void InitBackground(float scrollSpeed, Background *bg, Texture2D *texture,
|
|
const TextureAsset *backgroundAsset);
|
|
void UpdateBackground(Background *bg);
|
|
void RenderBackground(Background *bg);
|
|
|
|
void InitMenuMain(MenuMain *m);
|
|
void UpdateMenuMain(MenuMain *m, State *state, Flags *flags, MenuView *menuView);
|
|
void RenderMenuMain(MenuMain *m, Font *font, const char *title, Flags *flags, bool gameStarted);
|
|
void CleanupMenuMain(MenuMain *m);
|
|
|
|
void InitMenuSettings(MenuSettings *s);
|
|
void UpdateMenuSettings(MenuSettings *s, MenuView *menuView, State *state, Flags *flags);
|
|
void RenderMenuSettings(MenuSettings *s, Flags *flags);
|
|
void CleanupMenuSettings(MenuSettings *s);
|
|
|
|
void InitMenu(MenuState *m);
|
|
void UpdateMenu(MenuState *m, State *state, Flags *flags);
|
|
void RenderMenu(MenuState *m, Font *font, const char *title, Flags *flags, State *state);
|
|
void CleanupMenu(MenuState *m);
|
|
|
|
#endif
|