mirror of
https://github.com/libretro/RetroArch
synced 2025-03-06 04:13:52 +00:00
Refactor ui_companion_is_on_foreground
This commit is contained in:
parent
5bafed71ea
commit
4cc71c0574
@ -871,7 +871,6 @@ void rarch_main_state_free(void)
|
|||||||
main_is_idle = false;
|
main_is_idle = false;
|
||||||
main_is_paused = false;
|
main_is_paused = false;
|
||||||
main_is_slowmotion = false;
|
main_is_slowmotion = false;
|
||||||
g_extern.ui_companion_is_on_foreground = false;
|
|
||||||
g_extern.frames.limit.minimum_time = 0.0;
|
g_extern.frames.limit.minimum_time = 0.0;
|
||||||
g_extern.frames.limit.last_time = 0.0;
|
g_extern.frames.limit.last_time = 0.0;
|
||||||
g_extern.max_frames = 0;
|
g_extern.max_frames = 0;
|
||||||
|
@ -42,9 +42,6 @@ typedef struct rarch_resolution
|
|||||||
|
|
||||||
typedef struct global
|
typedef struct global
|
||||||
{
|
{
|
||||||
/* Lifecycle state checks. */
|
|
||||||
bool ui_companion_is_on_foreground;
|
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
@ -44,18 +44,14 @@ void apple_rarch_exited(void);
|
|||||||
|
|
||||||
static void rarch_enable_ui(void)
|
static void rarch_enable_ui(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
ui_companion_set_foreground(true);
|
||||||
|
|
||||||
global->ui_companion_is_on_foreground = true;
|
|
||||||
rarch_main_set_pause(true);
|
rarch_main_set_pause(true);
|
||||||
rarch_main_set_idle(true);
|
rarch_main_set_idle(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rarch_disable_ui(void)
|
static void rarch_disable_ui(void)
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
ui_companion_set_foreground(false);
|
||||||
|
|
||||||
global->ui_companion_is_on_foreground = false;
|
|
||||||
rarch_main_set_pause(false);
|
rarch_main_set_pause(false);
|
||||||
rarch_main_set_idle(false);
|
rarch_main_set_idle(false);
|
||||||
}
|
}
|
||||||
@ -430,9 +426,7 @@ void apple_stop_iterate_timer(void)
|
|||||||
|
|
||||||
- (void)toggleUI
|
- (void)toggleUI
|
||||||
{
|
{
|
||||||
global_t *global = global_get_ptr();
|
if (ui_companion_is_on_foreground())
|
||||||
|
|
||||||
if (global->ui_companion_is_on_foreground)
|
|
||||||
{
|
{
|
||||||
[self showGameView];
|
[self showGameView];
|
||||||
}
|
}
|
||||||
|
@ -17,10 +17,14 @@
|
|||||||
#include "../driver.h"
|
#include "../driver.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <boolean.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "../config.h"
|
#include "../config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static bool main_ui_companion_is_on_foreground;
|
||||||
|
|
||||||
static const ui_companion_driver_t *ui_companion_drivers[] = {
|
static const ui_companion_driver_t *ui_companion_drivers[] = {
|
||||||
#ifdef HAVE_COCOA
|
#ifdef HAVE_COCOA
|
||||||
&ui_companion_cocoa,
|
&ui_companion_cocoa,
|
||||||
@ -56,6 +60,16 @@ const ui_companion_driver_t *ui_companion_find_driver(const char *ident)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ui_companion_set_foreground(unsigned enable)
|
||||||
|
{
|
||||||
|
main_ui_companion_is_on_foreground = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ui_companion_is_on_foreground(void)
|
||||||
|
{
|
||||||
|
return main_ui_companion_is_on_foreground;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ui_companion_init_first:
|
* ui_companion_init_first:
|
||||||
*
|
*
|
||||||
|
@ -70,6 +70,10 @@ const ui_companion_driver_t *ui_companion_get_ptr(void);
|
|||||||
**/
|
**/
|
||||||
const ui_companion_driver_t *ui_companion_init_first(void);
|
const ui_companion_driver_t *ui_companion_init_first(void);
|
||||||
|
|
||||||
|
bool ui_companion_is_on_foreground(void);
|
||||||
|
|
||||||
|
void ui_companion_set_foreground(unsigned enable);
|
||||||
|
|
||||||
void ui_companion_event_command(enum event_command action);
|
void ui_companion_event_command(enum event_command action);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
x
Reference in New Issue
Block a user