(Zahrand) Cleanups

This commit is contained in:
twinaphex 2016-02-25 22:08:02 +01:00
parent 5ca0085e22
commit eb9971703b

View File

@ -517,12 +517,16 @@ static void wimp_main(struct zr_context *ctx, int width, int height, struct wimp
ZR_WINDOW_SCALABLE|ZR_WINDOW_BORDER)) ZR_WINDOW_SCALABLE|ZR_WINDOW_BORDER))
{ {
zr_layout_row_dynamic(ctx, 30, 2); zr_layout_row_dynamic(ctx, 30, 2);
if (zr_button_text(ctx, "Quit", ZR_BUTTON_DEFAULT)) {
if (zr_button_text(ctx, "Quit", ZR_BUTTON_DEFAULT))
{
/* event handling */ /* event handling */
printf("Pressed Event\n"); printf("Pressed Event\n");
rarch_ctl(RARCH_CTL_FORCE_QUIT, NULL); rarch_ctl(RARCH_CTL_FORCE_QUIT, NULL);
} }
if (zr_button_text(ctx, "Quit", ZR_BUTTON_DEFAULT)) {
if (zr_button_text(ctx, "Quit", ZR_BUTTON_DEFAULT))
{
/* event handling */ /* event handling */
printf("Pressed Event\n"); printf("Pressed Event\n");
rarch_ctl(RARCH_CTL_FORCE_QUIT, NULL); rarch_ctl(RARCH_CTL_FORCE_QUIT, NULL);
@ -541,7 +545,8 @@ static void wimp_main(struct zr_context *ctx, int width, int height, struct wimp
struct zr_panel combo; struct zr_panel combo;
static const char *themes[] = {"Black", "White", "Red", "Blue", "Dark", "Grey"}; static const char *themes[] = {"Black", "White", "Red", "Blue", "Dark", "Grey"};
enum theme old = gui->theme; enum theme old = gui->theme;
if (zr_combo_begin_text(ctx, &combo, themes[gui->theme], 300)) { if (zr_combo_begin_text(ctx, &combo, themes[gui->theme], 300))
{
zr_layout_row_dynamic(ctx, 25, 1); zr_layout_row_dynamic(ctx, 25, 1);
gui->theme = zr_combo_item(ctx, themes[THEME_BLACK], ZR_TEXT_CENTERED) ? THEME_BLACK : gui->theme; gui->theme = zr_combo_item(ctx, themes[THEME_BLACK], ZR_TEXT_CENTERED) ? THEME_BLACK : gui->theme;
gui->theme = zr_combo_item(ctx, themes[THEME_WHITE], ZR_TEXT_CENTERED) ? THEME_WHITE : gui->theme; gui->theme = zr_combo_item(ctx, themes[THEME_WHITE], ZR_TEXT_CENTERED) ? THEME_WHITE : gui->theme;
@ -559,19 +564,18 @@ static void wimp_main(struct zr_context *ctx, int width, int height, struct wimp
static int wimp_start(struct wimp *gui, int width, int height) static int wimp_start(struct wimp *gui, int width, int height)
{ {
unsigned i;
int ret = 1; int ret = 1;
static int init = 0; static int init = 0;
struct zr_context *ctx = &gui->ctx; struct zr_context *ctx = &gui->ctx;
if (!init) { if (!init)
init = 1; init = 1;
}
/* set rounding to zero on all elements */ /* set rounding to zero on all elements */
for (int i = 0; i < ZR_ROUNDING_MAX; ++i) for (i = 0; i < ZR_ROUNDING_MAX; ++i)
{
ctx->style.rounding[i] = 0; ctx->style.rounding[i] = 0;
}
wimp_main(ctx, width, height, gui); wimp_main(ctx, width, height, gui);
wimp_control(ctx, width, height, gui); wimp_control(ctx, width, height, gui);
zr_buffer_info(&gui->status, &gui->ctx.memory); zr_buffer_info(&gui->status, &gui->ctx.memory);