gs_engine.h 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #ifndef __GS_ENGINE_H__
  2. #define __GS_ENGINE_H__
  3. /*═█═════════════════════════════════════════════════════════════════════════════════════█═╗
  4. ████ ██████╗ ██╗ ██╗███╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗ ███████╗██████╗ ██████═█
  5. █║█ ██╔════╝ ██║ ██║████╗ ██║██╔════╝██║ ██║████╗ ██║██╔════╝ ██╔════╝██╔══██╗ ██═████
  6. ███ ██║ ███╗██║ ██║██╔██╗ ██║███████╗██║ ██║██╔██╗ ██║██║ ███╗█████╗ ██████╔╝ █████═██
  7. ╚██ ██║ ██║██║ ██║██║╚██╗██║╚════██║██║ ██║██║╚██╗██║██║ ██║██╔══╝ ██╔══██╗ ███ █╝█
  8. █║█ ╚██████╔╝╚██████╔╝██║ ╚████║███████║███████╗██║██║ ╚████║╚██████╔╝███████╗██║ ██║ ██═████
  9. ████ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ █═█═██
  10. ╚═██════════════════════════════════════════════════════════════════════════════════════██═╝*/
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. #include "common/gs_types.h"
  15. // Forward Decl
  16. struct gs_platform_i;
  17. struct gs_graphics_i;
  18. struct gs_audio_i;
  19. typedef struct gs_application_desc
  20. {
  21. gs_result ( * init )();
  22. gs_result ( * update )();
  23. gs_result ( * shutdown )();
  24. const char* window_title;
  25. u32 window_width;
  26. u32 window_height;
  27. u32 window_flags;
  28. f32 frame_rate;
  29. b32 enable_vsync;
  30. } gs_application_desc;
  31. // What would the context necessarily hold? Some container of all subsystems?
  32. typedef struct
  33. {
  34. struct gs_platform_i* platform; // Main platform interface
  35. struct gs_graphics_i* graphics;
  36. struct gs_audio_i* audio;
  37. gs_application_desc app;
  38. } gs_engine_context;
  39. // This could be kept in an implementation file and just provide an interface to the user
  40. typedef struct
  41. {
  42. gs_engine_context ctx;
  43. gs_result ( * run )();
  44. gs_result ( * shutdown )();
  45. } gs_engine;
  46. gs_engine* gs_engine_construct( gs_application_desc app_desc );
  47. gs_engine* gs_engine_instance();
  48. #ifdef __cplusplus
  49. }
  50. #endif // c++
  51. #endif // __GS_ENGINE_H__