68 lines
1.8 KiB
C++
68 lines
1.8 KiB
C++
#include "vn_platform.h"
|
|
#include "vn_platform.cpp"
|
|
|
|
#include "vn_config.h"
|
|
#include "vn_font.h"
|
|
#include "vn_text_op.h"
|
|
#include "vn_ui.h"
|
|
#include "vn_workspace.h"
|
|
#include "vn_theme_dark.h"
|
|
#include "vn_animation_curve.h"
|
|
|
|
#include "vn_config.cpp"
|
|
#include "vn_render.cpp"
|
|
#include "vn_font.cpp"
|
|
#include "vn_ui.cpp"
|
|
#include "vn_ui_utils.cpp"
|
|
#include "vn_animation_curve.cpp"
|
|
#include "vn_workspace.cpp"
|
|
|
|
struct vn_state
|
|
{
|
|
memory_arena Arena;
|
|
glyph_atlas *GlyphAtlas;
|
|
|
|
config *Config;
|
|
|
|
ui UI;
|
|
workspace Workspace;
|
|
animation_curve_state AnimationCurveState;
|
|
};
|
|
|
|
VN_UPDATE_AND_RENDER(VN_UpdateAndRender)
|
|
{
|
|
SetThreadContext(ThreadContext);
|
|
Platform = Memory->PlatformAPI;
|
|
|
|
vn_state *State = Memory->State;
|
|
|
|
if(!Memory->State)
|
|
{
|
|
State = Memory->State = BootstrapPushStruct(vn_state, Arena);
|
|
|
|
State->GlyphAtlas = CreateGlyphAtlas(RenderCommands);
|
|
State->Config = BootstrapPushStruct(config, Arena);
|
|
|
|
Config_BindEntry(State->Config, StrLit("Platform/RefreshRate"), Config_Entry_S32, &Input->RefreshRate);
|
|
|
|
Workspace_Init(&State->Workspace);
|
|
}
|
|
|
|
AnimationCurve_NewFrame(&State->AnimationCurveState, Input->dtForFrame);
|
|
UI_NewFrame(&State->UI, Input->EventList, Input->MouseP);
|
|
|
|
Workspace_Update(&State->Workspace, RenderCommands, Input, State->GlyphAtlas);
|
|
UI_SignalFromBox(UI_GetState()->ContainerNode); // sixten(TODO): Move elsewhere.
|
|
|
|
for(platform_event *Event = Input->EventList->First;
|
|
Event != 0;
|
|
Event = Event->Next)
|
|
{
|
|
Platform_ConsumeEvent(Input->EventList, Event);
|
|
}
|
|
|
|
render_group Group = BeginRenderGroup(RenderCommands);
|
|
PushClear(&Group, V3(0.1, 0.1, 0.1));
|
|
|
|
UI_RenderFrame(&Group, State->GlyphAtlas);
|
|
} |