feat: For lillian
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
lulcaaaa
2024-10-30 11:49:43 +01:00
parent ddb7bc3e10
commit e2b29032c0
15 changed files with 62 additions and 41 deletions

View File

@ -1,6 +1,6 @@
#include <SDL2/SDL.h> #include <SDL.h>
#include <SDL2/SDL_image.h> #include <SDL_image.h>
#include <SDL2/SDL_ttf.h> #include <SDL_ttf.h>
#include <err.h> #include <err.h>
#include "menus/main_menu.h" #include "menus/main_menu.h"
#include "utils/EZ_UI/EZ_utils.h" #include "utils/EZ_UI/EZ_utils.h"
@ -11,7 +11,7 @@ char flags = 0;
TTF_Font* main_font; TTF_Font* main_font;
int main() int main(void)
{ {
//SDL Init //SDL Init
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS); SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS);

View File

@ -1,4 +1,4 @@
#include <SDL2/SDL_ttf.h> #include <SDL_ttf.h>
#ifndef GLOBAL_H #ifndef GLOBAL_H
#define GLOBAL_H #define GLOBAL_H

View File

@ -5,15 +5,15 @@
#include "../utils/EZ_UI/elements/EZ_image.h" #include "../utils/EZ_UI/elements/EZ_image.h"
#include "../utils/EZ_UI/elements/EZ_button.h" #include "../utils/EZ_UI/elements/EZ_button.h"
#include "../utils/EZ_UI/elements/EZ_text.h" #include "../utils/EZ_UI/elements/EZ_text.h"
#include "../utils/EZ_UI/elements/EZ_drag_select.h"
EZ_DRAWABLE* drawables[4];
EZ_INTERACTIBLE* interactibles[2];
EZ_DRAWABLE* drawables[3]; void* main_menu_objects[4];
EZ_INTERACTIBLE* interactibles[1];
void* main_menu_objects[3];
EZ_MENU main_menu; EZ_MENU main_menu;
void unload_main_menu() void unload_main_menu(void)
{ {
for (size_t i = 0; i < 2; i++) for (size_t i = 0; i < 2; i++)
{ {
@ -31,20 +31,22 @@ void main_menu_process_events(SDL_Window* window, SDL_Renderer* renderer, SDL_Ev
} }
} }
void button_action() void button_action(EZ_button* tmp)
{ {
(void)tmp;
main_menu.drawable_elements[0]->visible = !main_menu.drawable_elements[0]->visible; main_menu.drawable_elements[0]->visible = !main_menu.drawable_elements[0]->visible;
} }
void load_main_menu(SDL_Renderer* renderer) void load_main_menu(SDL_Renderer* renderer)
{ {
main_menu.drawable_elements = drawables; main_menu.drawable_elements = drawables;
main_menu.drawable_elements_len = 3; main_menu.drawable_elements_len = 4;
main_menu.interactible_elements = interactibles; main_menu.interactible_elements = interactibles;
main_menu.interactible_elements_len = 1; main_menu.interactible_elements_len = 2;
main_menu.process_event = &main_menu_process_events; main_menu.process_event = &main_menu_process_events;
main_menu.unload_menu = &unload_main_menu; main_menu.unload_menu = &unload_main_menu;
//Image //Image
anchore_point main_img_anchore = { anchore_point main_img_anchore = {
@ -102,4 +104,23 @@ void load_main_menu(SDL_Renderer* renderer)
main_menu.drawable_elements[2] = &main_text->drawable_text; main_menu.drawable_elements[2] = &main_text->drawable_text;
main_menu_objects[2] = (void*)main_text; main_menu_objects[2] = (void*)main_text;
anchore_point main_select_anchore = {
0.3,
0.7,
0.3,
0.7,
0,
0,
0,
0
};
EZ_drag_select* select_butt = EZ_create_drag_select("ButtonBackground.png", renderer, main_select_anchore);
main_menu.drawable_elements[3] = &select_butt->drawable_drag;
main_menu.interactible_elements[1] = &select_butt->interactible_select;
main_menu_objects[3] = (void*)select_butt;
} }

View File

@ -1,4 +1,4 @@
#include <SDL2/SDL_image.h> #include <SDL_image.h>
#include <err.h> #include <err.h>
#include "EZ_utils.h" #include "EZ_utils.h"
#include "EZ_manager.h" #include "EZ_manager.h"
@ -74,7 +74,7 @@ int EZ_select_menu(int selected_menu)
return 1; return 1;
} }
void EZ_unload_menus() void EZ_unload_menus(void)
{ {
for (int i = 0; i < menu_len; i++) for (int i = 0; i < menu_len; i++)
{ {

View File

@ -1,4 +1,4 @@
#include <SDL2/SDL.h> #include <SDL.h>
#ifndef EZ_MANAGER_H #ifndef EZ_MANAGER_H
#define EZ_MANAGER_H #define EZ_MANAGER_H
@ -11,6 +11,6 @@ void EZ_draw_menu(SDL_Window* window, SDL_Renderer* renderer);
int EZ_select_menu(int selected_menu); int EZ_select_menu(int selected_menu);
void EZ_unload_menus(); void EZ_unload_menus(void);
#endif #endif

View File

@ -1,5 +1,5 @@
#include <SDL2/SDL.h> #include <SDL.h>
#include <SDL2/SDL_image.h> #include <SDL_image.h>
#include "../Rendering/RenderingUtils.h" #include "../Rendering/RenderingUtils.h"
#ifndef EZ_UTILS_H #ifndef EZ_UTILS_H
@ -28,7 +28,7 @@ typedef struct menu
EZ_INTERACTIBLE** interactible_elements; EZ_INTERACTIBLE** interactible_elements;
size_t interactible_elements_len; size_t interactible_elements_len;
void (*process_event)(SDL_Window* window, SDL_Renderer* renderer, SDL_Event*, struct menu*); void (*process_event)(SDL_Window* window, SDL_Renderer* renderer, SDL_Event*, struct menu*);
void (*unload_menu)(); void (*unload_menu)(void);
}EZ_MENU; }EZ_MENU;
#endif #endif

View File

@ -1,5 +1,5 @@
#include <SDL2/SDL.h> #include <SDL.h>
#include <SDL2/SDL_image.h> #include <SDL_image.h>
#include "../EZ_utils.h" #include "../EZ_utils.h"
#include "../../Rendering/RenderingUtils.h" #include "../../Rendering/RenderingUtils.h"

View File

@ -1,5 +1,5 @@
#include <SDL2/SDL.h> #include <SDL.h>
#include <SDL2/SDL_image.h> #include <SDL_image.h>
#include "../EZ_utils.h" #include "../EZ_utils.h"
#include "../../Rendering/RenderingUtils.h" #include "../../Rendering/RenderingUtils.h"

View File

@ -1,6 +1,6 @@
#include <SDL2/SDL.h> #include <SDL.h>
#include <SDL2/SDL_image.h> #include <SDL_image.h>
#include <SDL2/SDL_ttf.h> #include <SDL_ttf.h>
#include "../EZ_utils.h" #include "../EZ_utils.h"
#include "../../Rendering/RenderingUtils.h" #include "../../Rendering/RenderingUtils.h"