Finished the merge of models and app_vars

master
Allen Webster 2019-08-12 17:57:25 -07:00
parent c59da8e163
commit 422d67c41f
2 changed files with 13 additions and 24 deletions

11
4ed.cpp
View File

@ -976,8 +976,7 @@ App_Init_Sig(app_init){
}
App_Step_Sig(app_step){
App_Vars *vars = (App_Vars*)memory->vars_memory;
Models *models = &vars->models;
Models *models = (Models*)memory->vars_memory;
models->next_animate_delay = max_u32;
models->animate_next_frame = false;
@ -1199,7 +1198,7 @@ App_Step_Sig(app_step){
View *view = active_panel->view;
Assert(view != 0);
switch (vars->state){
switch (models->state){
case APP_STATE_EDIT:
{
Key_Code keycode = key_ptr->keycode;
@ -1221,7 +1220,7 @@ App_Step_Sig(app_step){
switch (event_consume_mode){
case EventConsume_BeginResize:
{
vars->state = APP_STATE_RESIZING;
models->state = APP_STATE_RESIZING;
models->resizing_intermediate_panel = divider_panel;
}break;
@ -1293,7 +1292,7 @@ App_Step_Sig(app_step){
Key_Code keycode = key_ptr->keycode;
u32 event_flags = get_event_flags(keycode);
if (event_flags & EventOnAnyKey || keycode == key_mouse_left_release){
vars->state = APP_STATE_EDIT;
models->state = APP_STATE_EDIT;
}
else if (keycode == key_mouse_move){
if (input->mouse.l){
@ -1304,7 +1303,7 @@ App_Step_Sig(app_step){
layout_set_split_absolute_position(layout, split, mouse_position);
}
else{
vars->state = APP_STATE_EDIT;
models->state = APP_STATE_EDIT;
}
}
}break;

View File

@ -27,11 +27,19 @@ struct App_Settings{
b32 use_hinting;
};
enum App_State{
APP_STATE_EDIT,
APP_STATE_RESIZING,
// never below this
APP_STATE_COUNT
};
struct Models{
Base_Allocator *base_allocator;
Mem_Options mem;
App_Settings settings;
App_State state;
Face_ID global_font_id;
@ -126,16 +134,6 @@ struct Models{
// TODO(allen): endless stack?
Vec2 coordinate_center_stack[32];
i32 coordinate_center_stack_top;
#if 0
View *render_view;
i32_Rect render_view_rect;
i32_Rect render_buffer_rect;
Full_Cursor render_cursor;
Range render_range;
Buffer_Render_Item *render_items;
i32 render_item_count;
#endif
};
////////////////////////////////
@ -149,13 +147,6 @@ enum{
DynamicWorkspace_Intersected = 4,
};
enum App_State{
APP_STATE_EDIT,
APP_STATE_RESIZING,
// never below this
APP_STATE_COUNT
};
enum Input_Types{
Input_AnyKey,
Input_Esc,
@ -174,7 +165,6 @@ struct Consumption_Record{
// TODO(allen): GET RID OF IT!
struct App_Vars{
Models models;
App_State state;
};
typedef i32 App_Coroutine_Purpose;