Commit Graph

21 Commits (c5a30bee6d04c031f05a963823d9a305e8b3f490)

Author SHA1 Message Date
En Yi c5a30bee6d Use scene idx instead of pointer 2024-06-29 13:26:48 +08:00
En Yi 921b59d2ab Add scene hierachy feature
This allows scene to have children but can only have one parent

There is only one focused scene to get input

Update and Render order is child first and next
2024-06-27 21:36:55 +08:00
En Yi 0653cbd0a2 Continue plan data struct for scene management 2024-06-20 21:41:14 +08:00
En Yi f98e242378 Add struct for scene management 2024-06-19 21:14:48 +08:00
En Yi 0f09a7b2bd Remove obsolete render function field 2024-05-04 20:40:15 +08:00
En Yi bef2ee2813 Expose initial window size to scene
This is so that each scene does not need to hardcode render layer size
2024-05-04 18:28:53 +08:00
En Yi 75d019aa34 Rework rendering to allow multi-layer render
Internal Changelog:
- A scene now has a maximum amount of render texture. It is to be
  rendered in order of the array by the engine.
- A scene now needs an explicit render system to draw onto the render
  textures. The scene will also init the number of render layers
  needed.
- The change is to allow more separate of concerns when it comes to
  rendering. A scene can also now compartmentalise the rendered items,
  which hopefully make understanding the code easier.
- Update all exisiting code to use the new render system.
2024-05-04 17:57:07 +08:00
En Yi 0d4089d9ce Tweak scene render function
Delegate BeginDrawing and EndDrawing to individual scenes
2024-05-01 19:56:10 +08:00
En Yi 41e4b34869 Allow changing sound pitch 2024-05-01 17:08:29 +08:00
En Yi 754d380221 Integrate mouse action into input process 2024-04-25 21:46:53 +08:00
En Yi 0a6e7b4ddc Add delta time handling
Internal Changelog:
- Major change: all engine that does counting uses delta time instead of
  frame counting
- Animation runs at 24 FPS
- Water fill is at a constant rate as well
- Particle update will need to be given delta time as well.
- Particle system is not updated to use float, so no delta time handling
  for the system in this commit
2024-04-23 22:44:52 +08:00
En Yi a8b62f5aec Integrate particle system into scenes
Changelog:
- Each scene will have its own particle system to maintain
- Crate destruction now emits particles
- Draw particles during screen renders
    - May want to make this configurable
    - Should be in general scene render
2023-11-02 22:44:52 +08:00
En Yi 7c86e0b3c5 Implement initial particle system
Changelog:
- Can only to one-shot burst emitter
- Add test for it
2023-10-21 14:37:54 +08:00
En Yi 7dc66945da Add in engine configuration
All engine constants now sits in a single header file for easy tweaking
Also, SFX list fields is now an array rather than a pointer instead.
2023-10-13 21:55:30 +08:00
En Yi b9b0c11524 Separate out engine from scenes
This creates stronger separation the engine stuff from game
implementations.

way overdue tbh
2023-10-13 21:26:42 +08:00
En Yi 7b3685b792 Refactor for better separation of concern
Changelog:
- Separate out engine-specific stuff vs game-specific stuff
2023-05-16 21:09:38 +08:00
En Yi 64c3532305 Replace method to get Scene specific data
Changelog:
- Use CONTAINER_OF macros to get scene specific data
- Remove unnecessary scene_data from Scene_t
- Still use pointer to scene specific data as these data could be
  quite heavy on memory
2023-05-07 21:04:24 +08:00
En Yi dc760bf8db Attempt to apply code style consitency
Squashed commit of the following:

commit 249fb96c63f68913ef632b8d1006e8a2d1c1b6d3
Author: En Yi <en.yi@tutanota.com>
Date:   Sat Apr 15 22:51:08 2023 +0800

    Ensure 120 column width limit

    Changelog:
    - this is just to avoid overly long line of code

commit 4b1ffa8fc89f17418de15f5fc3f0e73040f1d40c
Author: En Yi <en.yi@tutanota.com>
Date:   Sat Apr 15 20:05:07 2023 +0800

    Ensure style consistency in For loop

commit dcb41960407224592f78278313e97c2cc4bf66a5
Author: En Yi <en.yi@tutanota.com>
Date:   Sat Apr 15 17:26:20 2023 +0800

    Ensure consistency in code style

    Internal Changelog:
    - Use char* var instead of char *var. Preference
2023-04-15 22:52:38 +08:00
En Yi ac6d93565b Add Sprite Component
Changelog:
- Move Sprite struct into components
- Add asset field in engine
- Update scene test code to add engine for assets
    - This fixes the crash when q is pressed
- Add sprite component to player
- Update render function to draw the sprite
2023-03-13 21:12:37 +08:00
En Yi 399c78c200 Implement basic scene switching
Changelog:
- Add confirm and exit actions
    - Exit action used in editor scene
    - Confirm action for menu scene
- Hardcode scene switching in editor and menu scene
- Implement scene change function
    - Scene is not resetted on switch
- Incorporate scene switchin into main function
2023-02-13 23:05:24 +08:00
En Yi 1612b4f648 Refactor and prepare for scene changing
Changelog:
- Rename scene.* to engine.* as the game engine is tied to the
  base scene struct
- Combine *_impl.h into a single header
- Rename scene implementation source code file
- Add GameEngine struct and SceneState enum
2023-02-12 23:30:55 +08:00