Skip to content

Instantly share code, notes, and snippets.

@ermiry
Created January 3, 2020 23:16
Show Gist options
  • Save ermiry/e57b7916e7e8f41d9e6b1e56d00fc5b2 to your computer and use it in GitHub Desktop.
Save ermiry/e57b7916e7e8f41d9e6b1e56d00fc5b2 to your computer and use it in GitHub Desktop.
#include "cengine/renderer.h"
#include "cengine/ui/ui.h"
#include "cengine/ui/button.h"
void create_button (void) {
Renderer *main_renderer = renderer_get_by_name ("main");
Button *btn = ui_button_create (0, 0, 128, 128, UI_POS_MIDDLE_CENTER, main_renderer);
ui_button_set_action (btn, media_folder_select, NULL);
ui_button_set_sprite (btn, main_renderer, BUTTON_STATE_MOUSE_OUT, "./assets/icons/folder.png");
ui_element_set_layer (main_renderer->ui, btn->ui_element, "top");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment