Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
luxe committed Jul 20, 2024
1 parent 08588ae commit 63a78ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 12 additions & 5 deletions source/code/programs/ide/frame/frame_logic_updater.hcp
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,38 @@ class
⚞⚟



public: static▶ Frame_Elements ☀each_frame(Ide_Settings & settings, SDL_Window* window)❰

(void)window;

update_inputs(settings);
update_global_perspective(settings);
return update_logic_and_get_renderable_representation(settings);

private: static▶ void ☀update_inputs(Ide_Settings & settings)❰
//lets make sure the exact same mouse state is used for the entire frame of logic.
//this will avoid any issues with a fast moving mouse whose position may change faster than the frame rate.
//Let's do the same situation with the keyboard.
//Basically all of the user's input keyboard/mouse remains immutable from this point forward.
//It just makes testing and automation of the IDE code easier as well.
settings.desktop.previous_input = settings.desktop.input;
settings.desktop.input = Pc_Input_State_Getter::Get();


private: static▶ void ☀update_global_perspective(Ide_Settings & settings)❰
//before deciding all the frame elements to draw, adjust the global viewing anchor.
//This is the (possibly infinite) surface spread of frame elements. We intend it to be an infinite plane larger than anyone's screen.
//a user will find ways to view sub portions of this space (likely represented by the size of their monitor).
//the view anchor represents the (0,0) of their adjustable sub-viewing window location.
View_Anchor_Adjuster::Adjust(settings.desktop.mouse,settings.desktop.input.mouse);


private: static▶ Frame_Elements ☀update_logic_and_get_renderable_representation(Ide_Settings & settings)❰
//this decides everything needed by the frame drawer
//the data structure returned here is a representation that could be drawn anywhere
//to your screen, to an image, or dumped as json.
Everything_Draw_Settings draw_settings;
auto frames = Everything_Drawer::Draw(settings,draw_settings,settings.desktop.input);

return frames;
3 changes: 3 additions & 0 deletions source/code/programs/ide/unilang_ide.hcp
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ class
};
auto render = [&](SDL_Window* window) {

// This is an abstraction for turning elements into what imgui wants and rendering it.
// Abstracts us away from all imgui types. Could in theory swap out a different renderng backend.
Frame_Renderer::Render(s.desktop.background,elements);

//this is handled here because for some reason blocking on an OS window during logic update causes a double key-press.
//so for example, ctrl+s to save will be triggered twice, and the window will pop up twice. Maybe I should do something with futures/async,
//but as far as I can tell, having this here instead of logic is the easiest fix.
// Global actions are intended to be key stokes that have no influence based on the current IDE elements.
Global_Action_Handler::Handle(s, window, elements);

//bool flag = true;
Expand Down

0 comments on commit 63a78ce

Please sign in to comment.