Skip to content

Instantly share code, notes, and snippets.

@ermiry
Created January 5, 2020 05:05
Show Gist options
  • Save ermiry/38305c050e67bd70fe393dce4e213c26 to your computer and use it in GitHub Desktop.
Save ermiry/38305c050e67bd70fe393dce4e213c26 to your computer and use it in GitHub Desktop.
#include "cengine/renderer.h"
#include "cengine/ui/ui.h"
#include "cengine/ui/font.h"
#include "cengine/ui/dropdown.h"
void dropdown_create (void) {
Renderer *main_renderer = renderer_get_by_name ("main");
Font *font = ui_font_get_default ();
// first create the main dropdown element
Dropdown *projects_update_type_dropdown = ui_dropdown_create (0, 225, 200, 50, UI_POS_MIDDLE_CENTER, main_renderer);
ui_dropdown_set_options (projects_update_type_dropdown, 0, 5, 200, 200, UI_POS_BOTTOM_CENTER, main_renderer);
ui_dropdown_set_ouline_colour (projects_update_type_dropdown, RGBA_WHITE);
ui_dropdown_set_placeholder (projects_update_type_dropdown, main_renderer, "Type", font, 32, RGBA_WHITE);
ui_dropdown_set_placeholder_pos (projects_update_type_dropdown, main_renderer, UI_POS_MIDDLE_CENTER);
ui_dropdown_extened_set_bg_colour (projects_update_type_dropdown, main_renderer, RGBA_BLACK);
// then create each of the dropdowns options and add it to the dropdown
DropdownOption *option_type_app = ui_dropdown_option_create (main_renderer, "App", font, 32, RGBA_WHITE);
ui_dropdown_option_set_ouline_colour (option_type_app, RGBA_WHITE);
ui_dropdown_option_add (projects_update_type_dropdown, option_type_app);
DropdownOption *option_type_frame = ui_dropdown_option_create (main_renderer, "Framework", font, 32, RGBA_WHITE);
ui_dropdown_option_set_ouline_colour (option_type_frame, RGBA_WHITE);
ui_dropdown_option_add (projects_update_type_dropdown, option_type_frame);
DropdownOption *option_type_idea = ui_dropdown_option_create (main_renderer, "Idea", font, 32, RGBA_WHITE);
ui_dropdown_option_set_ouline_colour (option_type_idea, RGBA_WHITE);
ui_dropdown_option_add (projects_update_type_dropdown, option_type_idea);
DropdownOption *option_type_other = ui_dropdown_option_create (main_renderer, "Other", font, 32, RGBA_WHITE);
ui_dropdown_option_set_ouline_colour (option_type_other, RGBA_WHITE);
ui_dropdown_option_add (projects_update_type_dropdown, option_type_other);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment