void EditorUpdateAndRender(EditorMemory *editor_memory, InputData *input, RenderContext *render_context, UIContext *ui_context, float delta) { EditorState *editor = (EditorState *)editor_memory; if (!editor->initialized) { // Initialization editor->initialized = true; } BeginRenderer(render_context); if (GUIButton(ui_context, GenUIID(), "WHITE", 400.0f, 400.0f, 300.0f, 100.0f)) { } if (GUIButton(ui_context, GenUIID(), "RED", 800.0f, 800.0f, 300.0f, 100.0f)) { } //SDL_Log("Hot: %d, Active: %d", ui_context->hot.index, ui_context->active.index); EndRenderer(); }
GUIWidget * GUIManager::CreateWidget( GUIWidgetType iType, GUIWidgetModel * pModel, GUIWidget * pParent, const GUILayout & guiLayout, const GChar * strName ) { SelectMemory( TEXT("LayoutData") ); GUIWidget * pWidget = NULL; switch( iType ) { case GUIWIDGET_CONTAINER: pWidget = New GUIContainer ( pParent, guiLayout, strName ); break; case GUIWIDGET_SECTION: pWidget = New GUISection ( (GUISectionModel*) pModel, pParent, guiLayout, strName ); break; case GUIWIDGET_SWITCHTABS: pWidget = New GUISwitchTabs ( (GUISwitchTabsModel*) pModel, pParent, guiLayout, strName ); break; case GUIWIDGET_LABEL: pWidget = New GUILabel ( (GUILabelModel*) pModel, pParent, guiLayout, strName ); break; case GUIWIDGET_BUTTON: pWidget = New GUIButton ( (GUIButtonModel*) pModel, pParent, guiLayout, strName ); break; case GUIWIDGET_CHECKBOX: pWidget = New GUICheckBox ( (GUICheckBoxModel*) pModel, pParent, guiLayout, strName ); break; case GUIWIDGET_RADIOBUTTON: pWidget = New GUIRadioButton ( (GUIRadioButtonModel*)pModel, pParent, guiLayout, strName ); break; case GUIWIDGET_COMBOLIST: pWidget = New GUIComboList ( (GUIComboListModel*) pModel, pParent, guiLayout, strName ); break; case GUIWIDGET_TEXTINPUT: pWidget = New GUITextInput ( (GUITextInputModel*) pModel, pParent, guiLayout, strName ); break; case GUIWIDGET_TEXTLOG: pWidget = New GUITextLog ( (GUITextLogModel*) pModel, pParent, guiLayout, strName ); break; case GUIWIDGET_LIST: pWidget = New GUIList ( (GUIListModel*) pModel, pParent, guiLayout, strName ); break; case GUIWIDGET_TREE: pWidget = New GUITree ( (GUITreeModel*) pModel, pParent, guiLayout, strName ); break; default: Assert(false); break; } UnSelectMemory(); return pWidget; }