Skip to content

Instantly share code, notes, and snippets.

@ermiry
Created January 3, 2020 22:47
Show Gist options
  • Save ermiry/a467fe4231b1f869493b429edcbec3d2 to your computer and use it in GitHub Desktop.
Save ermiry/a467fe4231b1f869493b429edcbec3d2 to your computer and use it in GitHub Desktop.
#include "cengine/renderer.h"
#include "cengine/ui/ui.h"
#include "cengine/ui/panel.h"
// you can use a panel as background for your application
void set_background (void) {
Renderer *main_renderer = renderer_get_by_name ("main");
u32 screen_width = main_renderer->window->window_size.width;
u32 screen_height = main_renderer->window->window_size.height;
RGBA_Color electromagnetic = { 47, 54, 64, 255 };
Panel *background_panel = ui_panel_create (0, 0, screen_width, screen_height, UI_POS_MIDDLE_CENTER, main_renderer);
ui_panel_set_bg_colour (background_panel, main_renderer, electromagnetic);
ui_element_set_layer (main_renderer->ui, background_panel->ui_element, "back");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment