mirror of
https://github.com/zoriya/ForecastingVillage.git
synced 2026-05-25 23:58:47 +00:00
Adding options inside the pause menu
This commit is contained in:
+1
-1
@@ -32,7 +32,7 @@ void resolution_set_txt(gc_entity *entity, gc_engine *engine, \
|
||||
enum gc_mousekeys __);
|
||||
void framerate_set_text(gc_entity *entity, gc_engine *engine, \
|
||||
enum gc_mousekeys __);
|
||||
void sound_set_text(gc_entity *entity, gc_engine *engine);
|
||||
void sound_set_text(gc_entity *entity, gc_engine *engine, float vol);
|
||||
|
||||
bool fullscreen(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
|
||||
enum gc_mousekeys __);
|
||||
|
||||
@@ -14,6 +14,7 @@ struct game_manager_system {
|
||||
gc_system base;
|
||||
bool is_inventory;
|
||||
bool has_message;
|
||||
gc_scene *game_scene;
|
||||
};
|
||||
|
||||
extern const struct game_manager_system game_manager_system;
|
||||
|
||||
+1
-1
Submodule lib/gamacon updated: 019cef80f0...873f0cef56
@@ -1,6 +1,7 @@
|
||||
<gc_entities>
|
||||
<panel src="panel" x="50%" y="45%" width="40%" height="69%" tag="pause" />
|
||||
<text text="Pause" x="50%" y="25%" resize="false" tag="pause"/>
|
||||
<button text="Resume" x="50%" y="50%" click="toggle_pause" color="black" width="30%" height="20%" resize="false" tag="pause" />
|
||||
<button text="Resume" x="50%" y="35%" click="toggle_pause" color="black" width="30%" height="20%" resize="false" tag="pause" />
|
||||
<button text="Options" x="50%" y="50%" click="options" color="black" width="30%" height="20%" resize="false" tag="pause" />
|
||||
<button text="Quit to menu" x="50%" y="65%" click="goto_main_menu" color="black" width="30%" height="20%" resize="false" tag="pause" />
|
||||
</gc_entities>
|
||||
+10
-1
@@ -5,6 +5,8 @@
|
||||
** main_menu
|
||||
*/
|
||||
|
||||
#include <systems/combat_manager.h>
|
||||
#include <systems/game_manager_system.h>
|
||||
#include "systems/sfml_renderer_system.h"
|
||||
#include "components/dialog_holder.h"
|
||||
#include "components/dialog_holder.h"
|
||||
@@ -53,6 +55,8 @@ enum gc_mousekeys __)
|
||||
my_printf("The option scene couldn't be loaded.\n");
|
||||
return (true);
|
||||
}
|
||||
GETSYS(engine, game_manager_system)->game_scene = engine->scene;
|
||||
engine->scene = NULL;
|
||||
engine->change_scene(engine, scene);
|
||||
entity = engine->scene->get_entity(engine->scene, 50);
|
||||
if (rend)
|
||||
@@ -61,13 +65,18 @@ enum gc_mousekeys __)
|
||||
resolution_set_txt(entity, engine, 0);
|
||||
entity = engine->scene->get_entity(engine->scene, 52);
|
||||
framerate_set_text(entity, engine, 0);
|
||||
entity = engine->scene->get_entity(engine->scene, 53);
|
||||
sound_set_text(entity, engine, -1);
|
||||
return (true);
|
||||
}
|
||||
|
||||
bool goto_main_menu(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
|
||||
enum gc_mousekeys __)
|
||||
{
|
||||
gc_scene *scene = scene_create(engine, "prefabs/mainmenu.gcprefab");
|
||||
gc_scene *scene = GETSYS(engine, game_manager_system)->game_scene;
|
||||
|
||||
if (!scene)
|
||||
scene = scene_create(engine, "prefabs/mainmenu.gcprefab");
|
||||
if (!scene) {
|
||||
engine->should_close = true;
|
||||
my_printf("The option scene couldn't be loaded.\n");
|
||||
|
||||
+4
-1
@@ -18,15 +18,18 @@ void sound_set_text(gc_entity *entity, gc_engine *engine, float vol)
|
||||
{
|
||||
struct sfml_renderer_system *rend = GETSYS(engine, sfml_renderer_system);
|
||||
struct renderer *renderer;
|
||||
char volume[10];
|
||||
static char volume[10];
|
||||
|
||||
if (!entity)
|
||||
return;
|
||||
if (vol == -1)
|
||||
vol = sfListener_getGlobalVolume();
|
||||
renderer = GETCMP(entity, renderer);
|
||||
if (!rend || !renderer || renderer->type != GC_TXTREND)
|
||||
return;
|
||||
snprintf(volume, 10, "%.0f", vol);
|
||||
((gc_text *)renderer->data)->text = volume;
|
||||
renderer->destroy = &text_safe_destroy;
|
||||
}
|
||||
|
||||
bool sound_down(gc_engine *engine, gc_entity *entity, gc_vector2 _, \
|
||||
|
||||
@@ -70,6 +70,7 @@ static void ctr(void *system, va_list list)
|
||||
engine->add_event_listener(engine, "combat_ended", &combat_ended);
|
||||
this->has_message = false;
|
||||
this->is_inventory = false;
|
||||
this->game_scene = NULL;
|
||||
}
|
||||
|
||||
static void dtr(void *system, gc_engine *engine)
|
||||
|
||||
Reference in New Issue
Block a user