Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
c924a3f
Make `System::update()` non-pure virtual
LumpBloom7 Oct 5, 2018
a2a93d4
Add `Screen` class
LumpBloom7 Oct 5, 2018
ff979e1
Add some basic functions to Screen
LumpBloom7 Oct 5, 2018
d051a2e
add real type compare
Oct 5, 2018
b3ea51f
add automatic numbering for `Screen` `System`s
Oct 5, 2018
9626849
[Simplify] use SysPtr instead of Container
Oct 5, 2018
bd92973
Fix potential runtime exception when entity is destroyed more than once
LumpBloom7 Oct 6, 2018
07ef321
Add Screen Testing to TestBench
LumpBloom7 Oct 6, 2018
8cff58f
Made Screen protected variables private
LumpBloom7 Oct 6, 2018
3d8828e
Re-add dtor and improve `update()` function
LumpBloom7 Oct 6, 2018
b103f70
Use forward declaration instead of includes in some files
LumpBloom7 Oct 6, 2018
b9ffe87
Remove comments
LumpBloom7 Oct 6, 2018
2e4bdca
Add functions in Game.h to make use of Screens
LumpBloom7 Oct 6, 2018
e2fa4f7
Use the new functionality in TestBench
LumpBloom7 Oct 6, 2018
45ffcd4
Make code consistent with the rest of the project
LumpBloom7 Oct 6, 2018
cd8aa47
Make `DefaultSystem::update()` a pure virtual function
LumpBloom7 Oct 6, 2018
f042b3c
Make all build configs not generate xmldocs
LumpBloom7 Oct 6, 2018
9950953
Add SDL_RENDERER_TARGETTEXTURE to default renderer flags
LumpBloom7 Oct 12, 2018
adad9ba
[EXPERIMENTAL] Let `Screens` render to texture and let `Game` render it.
LumpBloom7 Oct 12, 2018
7af06ea
The unsafe `Game` ctor should also have the TARGETTEXTURE flag
LumpBloom7 Oct 12, 2018
4ada583
Use SDL_RenderClear to clear Screen texture instead of recreating it
LumpBloom7 Oct 12, 2018
d1667b9
Destroy Screen texture in dtor
LumpBloom7 Oct 12, 2018
5c20f47
Move Screen.h template definitions to prevent implicit inline
LumpBloom7 Oct 13, 2018
f0b8292
Use provided alias instead of just `uint32_t` in `GameObject`
LumpBloom7 Oct 13, 2018
78a3434
The components don't depend on "stdIncludes.h"
LumpBloom7 Oct 13, 2018
acafe28
Implement ability to change render order of sprites
LumpBloom7 Oct 13, 2018
0b956f2
Change grouping name from `Priority` to `LayerGroup`
LumpBloom7 Oct 13, 2018
fd98ec4
Prevent implicit inline of `Game::registerScreen()`
Oct 13, 2018
9745ce5
Merge branch 'master' into feature/Screens
LumpBloom7 Oct 14, 2018
8eb9d16
Rename tmp2 to layerNo in RenderSystem
LumpBloom7 Oct 18, 2018
7b31ec2
Fix bug with wrong var name, should be `layerNo`, not `layer`
Oct 21, 2018
14348ca
Merge branch 'master' into feature/Screens
LumpBloom7 Oct 24, 2018
41c32bb
Use logical renderer size
LumpBloom7 Oct 25, 2018
2d62641
New position system
LumpBloom7 Oct 25, 2018
f960008
Re-enable randomizer system in Test Bench
LumpBloom7 Oct 25, 2018
905e26a
We actually don't need to keep a variable to store coord type
LumpBloom7 Oct 25, 2018
a40fa15
Missing failsafe
LumpBloom7 Oct 25, 2018
2560fd0
Negative sizes should count as 0
LumpBloom7 Oct 25, 2018
411f8a2
Make base for SceneManager
LumpBloom7 Oct 31, 2018
0c7e257
Create `Scene` class
LumpBloom7 Oct 31, 2018
520b7e9
Implemented Scene and SceneManager
LumpBloom7 Nov 1, 2018
1b8d364
Small fixes and improvements
Nov 1, 2018
919d2e0
Rename variables relating to Screen
LumpBloom7 Nov 2, 2018
41aa3f7
Remove all code relating to Screen
LumpBloom7 Nov 2, 2018
43d9846
Use `make_shared` instead of `new`
LumpBloom7 Nov 2, 2018
73c14ad
Restore `destroyGameObject()` in `Scene`
LumpBloom7 Nov 2, 2018
83c8918
Leave scene drawing to `Scene::draw()`
LumpBloom7 Nov 2, 2018
4036db8
Provide deltaTime as argument for `Scene::update()`
LumpBloom7 Nov 2, 2018
2d4b238
Merge remote-tracking branch 'BloomCreativeWorks/master' into ScreenR…
LumpBloom7 Nov 8, 2018
f50038b
Fix wrong type on Coord forward declare
LumpBloom7 Nov 10, 2018
1f34e49
Add ability to change `Scene` rotate angle
LumpBloom7 Nov 10, 2018
b373979
For some reason I keep disabling the randomizer without realising
LumpBloom7 Nov 10, 2018
d093727
Add ability to change center of rotation
LumpBloom7 Nov 10, 2018
d933ece
Allow sprites to be rotated as well
LumpBloom7 Nov 10, 2018
a6ca91d
Add Sprite Rotator system
LumpBloom7 Nov 10, 2018
47b7b23
Update sdl2-nuget packages (#20)
Nov 10, 2018
d018b03
Some optimizations and improvements
Nov 13, 2018
9474540
Format code and use `BLOOMFRAMEWORK_API` in class declarations
Nov 13, 2018
1f39145
Allow `System`s to control public variables of each other
LumpBloom7 Nov 15, 2018
e746175
Fix emplacing a unique ptr instead of a shared ptr
LumpBloom7 Nov 15, 2018
4e1176f
Allow enabling/disabling any `System`
LumpBloom7 Nov 16, 2018
d7b7d8a
Let `registerSystem()` return a shared_ptr of System instead of index
LumpBloom7 Nov 16, 2018
b04c485
Merge all transform related components
LumpBloom7 Nov 25, 2018
f36b742
Add Tag component
LumpBloom7 Nov 26, 2018
ef2878e
Merge branch 'master' into feature/Scene
LumpBloom7 Dec 5, 2018
d41de93
Simplify type comparison in Scene's Systems
Dec 21, 2018
d96e026
[RenderSystem.h] Small fixes and simplifications
Jan 3, 2019
42071c8
Merge remote-tracking branch 'BloomCreativeWorks/master' into feature…
LumpBloom7 Jan 15, 2019
2531653
Remove unload function
LumpBloom7 Jan 16, 2019
87c9ed4
[Scene] Fix memory leak during destruction
LumpBloom7 Jan 16, 2019
27a00ca
Fix some grammar
LumpBloom7 Jan 16, 2019
58774f6
[Scene] Add functions to unregister all GameObjects/Systems
LumpBloom7 Jan 18, 2019
4e06c1d
[Scene] Add start and restart functions
LumpBloom7 Jan 18, 2019
a5824e8
[SceneManager] Don't execute `Scene::load` if already loaded
LumpBloom7 Jan 18, 2019
8b022e5
[RenderQueue] Use `std::list::sort` instead of `std::stable_sort`
Jan 19, 2019
88c4f94
Use size_t as entity type
Jan 19, 2019
9f8025b
Use optional::value_or instead of optional::value
Jan 19, 2019
5861b67
Never use slow `std::list`, never
Jan 19, 2019
c802ab4
Optimize LayerGroup sorting
LumpBloom7 Jan 23, 2019
cd8e310
[TestChar] Always assign a `LayerGroup` component
LumpBloom7 Jan 25, 2019
d10a4d8
Bring back std::stable_sort:)
Jan 25, 2019
acd2a7b
Revert "Use size_t as entity type"
Jan 25, 2019
dbd1e13
Remove pure virtual init function
LumpBloom7 Jan 29, 2019
dccd92e
Add check to ensure init function exists
LumpBloom7 Jan 29, 2019
2250ada
NoInit v3
Feb 1, 2019
45eed87
Merge remote-tracking branch 'xapdkop/test/no_init3' into test/No_Init
LumpBloom7 Feb 5, 2019
e41456a
Test lambda support. DON'T MERGE THIS!
Feb 7, 2019
d1d4b9d
Update GameObject's names and types
Feb 7, 2019
6d31d8a
Disable dat fckin' console spam
Feb 7, 2019
87d186a
Use more template power
Feb 13, 2019
dd9c49f
[SceneManager] Remove unused thisPtr
LumpBloom7 Mar 27, 2019
618690a
[GameObject && Scene] Require init function to be specified
LumpBloom7 Mar 27, 2019
d8c5dc1
Fix CodeFactor issues
LumpBloom7 Mar 27, 2019
9259185
[MISC] Reduce volume for background music
LumpBloom7 Mar 27, 2019
8aa0999
Merge branch 'master' into feature/Scene
LumpBloom7 Mar 30, 2019
787cecb
[Scene] Scene textures should be transparent
LumpBloom7 Mar 30, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions BloomFramework/BloomFramework.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,21 @@
<ClInclude Include="include\Components\Position.h" />
<ClInclude Include="include\Components\Size.h" />
<ClInclude Include="include\Components\Sprite.h" />
<ClInclude Include="include\Components\Tag.h" />
<ClInclude Include="include\Components\Transform.h" />
<ClInclude Include="include\Coord.h" />
<ClInclude Include="include\Components\LayerGroup.h" />
<ClInclude Include="include\Graphics\AnimationSet.h" />
<ClInclude Include="include\Graphics\Sprite.h" />
<ClInclude Include="include\Exception.h" />
<ClInclude Include="include\Framework.h" />
<ClInclude Include="include\Game.h" />
<ClInclude Include="include\Audio\SoundChunk.h" />
<ClInclude Include="include\GameObject.h" />
<ClInclude Include="include\Scenes\Scene.h" />
<ClInclude Include="include\Scenes\SceneManager.h" />
<ClInclude Include="include\Graphics\Animation.h" />
<ClInclude Include="include\StdStableSort.h" />
<ClInclude Include="include\Systems\AnimationSystem.h" />
<ClInclude Include="include\Graphics\Drawable.h" />
<ClInclude Include="include\Graphics\Font.h" />
Expand All @@ -203,6 +210,7 @@
<ClInclude Include="include\Timer.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Coord.cpp" />
<ClCompile Include="src\Audio\SoundChannel.cpp" />
<ClCompile Include="src\Exception.cpp" />
<ClCompile Include="src\Audio\SoundPlayer.cpp" />
Expand All @@ -213,6 +221,8 @@
<ClCompile Include="src\Game.cpp" />
<ClCompile Include="src\Audio\SoundChunk.cpp" />
<ClCompile Include="src\GameObject.cpp" />
<ClCompile Include="src\Scenes\Scene.cpp" />
<ClCompile Include="src\Scenes\SceneManager.cpp" />
<ClCompile Include="src\Graphics\Animation.cpp" />
<ClCompile Include="src\Graphics\AnimationSet.cpp" />
<ClCompile Include="src\Graphics\Drawable.cpp" />
Expand All @@ -221,6 +231,7 @@
<ClCompile Include="src\Graphics\SpriteText.cpp" />
<ClCompile Include="src\Graphics\Texture.cpp" />
<ClCompile Include="src\Graphics\TextureStore.cpp" />
<ClCompile Include="src\Systems\DefaultSystem.cpp" />
<ClCompile Include="src\Timer.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Expand Down
42 changes: 42 additions & 0 deletions BloomFramework/BloomFramework.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
<Filter Include="Source Files\Audio">
<UniqueIdentifier>{61128b5c-6d91-44f6-b147-79f56ad42451}</UniqueIdentifier>
</Filter>
<Filter Include="Header Files\Scenes">
<UniqueIdentifier>{88b678a9-afd8-4bf2-8497-4a206009a84c}</UniqueIdentifier>
</Filter>
<Filter Include="Source Files\Scenes">
<UniqueIdentifier>{dd833aec-1858-4a66-867e-60efaeeec2cb}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Timer.cpp">
Expand Down Expand Up @@ -90,6 +96,18 @@
<ClCompile Include="src\Graphics\FontStore.cpp">
<Filter>Source Files\Graphics</Filter>
</ClCompile>
<ClCompile Include="src\Coord.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Systems\DefaultSystem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\Scenes\Scene.cpp">
<Filter>Source Files\Scenes</Filter>
</ClCompile>
<ClCompile Include="src\Scenes\SceneManager.cpp">
<Filter>Source Files\Scenes</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="include\Framework.h">
Expand Down Expand Up @@ -197,6 +215,30 @@
<ClInclude Include="include\Graphics\FontStore.h">
<Filter>Header Files\Graphics</Filter>
</ClInclude>
<ClInclude Include="include\Coord.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="include\Scenes\Scene.h">
<Filter>Header Files\Scenes</Filter>
</ClInclude>
<ClInclude Include="include\Scenes\SceneManager.h">
<Filter>Header Files\Scenes</Filter>
</ClInclude>
<ClInclude Include="include\Components\LayerGroup.h">
<Filter>Header Files\Components</Filter>
</ClInclude>
<ClInclude Include="include\Components\Sprite.h">
<Filter>Header Files\Components</Filter>
</ClInclude>
<ClInclude Include="include\Components\Transform.h">
<Filter>Header Files\Components</Filter>
</ClInclude>
<ClInclude Include="include\Components\Tag.h">
<Filter>Header Files\Components</Filter>
</ClInclude>
<ClInclude Include="include\StdStableSort.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
7 changes: 4 additions & 3 deletions BloomFramework/include/Components/Components.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#pragma once

#include "Position.h"
#include "Size.h"
#include "Transform.h"
#include "LayerGroup.h"
#include "Sprite.h"
#include "Animation.h"
#include "AnimationSet.h"
#include "AnimationSet.h"
#include "Tag.h"
5 changes: 5 additions & 0 deletions BloomFramework/include/Components/LayerGroup.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

namespace bloom::components {
using LayerGroup = Uint32;
}
9 changes: 0 additions & 9 deletions BloomFramework/include/Components/Position.h

This file was deleted.

9 changes: 0 additions & 9 deletions BloomFramework/include/Components/Size.h

This file was deleted.

9 changes: 9 additions & 0 deletions BloomFramework/include/Components/Tag.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#pragma once
#include <string>
#include "entt/entt.hpp"

namespace bloom::components {
template<entt::HashedString::hash_type Value>
using Label = entt::label<Value>;

}
18 changes: 18 additions & 0 deletions BloomFramework/include/Components/Transform.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include "Coord.h"

namespace bloom::components {
using Position = bloom::Coord;
struct Size {
int w, h;
};

struct Transform {
Position position;

double rotation;

Size size;
};
}
33 changes: 33 additions & 0 deletions BloomFramework/include/Coord.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once

#include "stdIncludes.h"
namespace bloom {
enum CoordType {
absolute,
relative
};

enum Positions {
top = 1,
middle = 2,
bottom = 4,

left = 8,
center = 16,
right = 32
};

struct BLOOMFRAMEWORK_API Coord {
public:
int x, y;
int relativeTo;

Coord();
Coord(const Coord & other) = default;
Coord(int x, int y, CoordType type = absolute, int direction = top | left);
Coord(const SDL_Point & point);

Coord getSDLPos(SDL_Renderer * targetRenderer, int width, int height);
SDL_Point toSDLPoint(SDL_Renderer * targetRenderer);
};
}
1 change: 1 addition & 0 deletions BloomFramework/include/Framework.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@
#include "Graphics/Font.h"
#include "Graphics/FontStore.h"
#include "Graphics/SpriteText.h"
#include "Coord.h"
8 changes: 6 additions & 2 deletions BloomFramework/include/Game.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,17 @@
#include "stdIncludes.h"
#include "Graphics/TextureStore.h"
#include "Timer.h"
#include "Exception.h"
#include "Scenes/SceneManager.h"

namespace bloom {
class BLOOMFRAMEWORK_API Game {
using TextureStore = bloom::graphics::TextureStore;
friend TextureStore::TextureStore(Game & object);

public:
Game(int width, int height, int windowFlags = NULL, int rendererFlags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
Game(std::nothrow_t, int width, int height, int windowFlags = NULL, int rendererFlags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
Game(int width, int height, int windowFlags = NULL, int rendererFlags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE);
Game(std::nothrow_t, int width, int height, int windowFlags = NULL, int rendererFlags = SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE);
~Game();

static void initialize(Uint32 initFlags = SDL_INIT_EVERYTHING,
Expand Down Expand Up @@ -45,6 +47,8 @@ namespace bloom {
TextureStore textures = TextureStore(m_renderer);
Timer timer;

SceneManager sceneManager = SceneManager(*this);

protected:
SDL_Renderer * m_renderer = nullptr;
SDL_Window * m_window = nullptr;
Expand Down
23 changes: 6 additions & 17 deletions BloomFramework/include/GameObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,22 @@

#include "stdIncludes.h"
#include "Components/Components.h"
#include "Game.h"

namespace bloom {
class Game;
/*
* This class is used to make a sort of prefab object.
*
* This class by default will create an entity with the registry provided.
* The entity will be assigned with bloom::Position since it is expected that an entity would have position.
*
* Use the init() function to assign/replace/reset any Components required.
*
* The destructor will automatically destroy the entity from the registry when GameObject gets out of scope.
*/
class BLOOMFRAMEWORK_API GameObject {
using Position = bloom::components::Position;
struct BLOOMFRAMEWORK_API GameObject {
entt::DefaultRegistry& registry;
Game& gameInstance;
const entt::DefaultRegistry::entity_type entity;

public:
GameObject(entt::DefaultRegistry & registry, Game *& gameInstance);
GameObject(entt::DefaultRegistry& registry, Game& gameInstance);
~GameObject();

virtual void init() = 0;

uint32_t getEntityID();

protected:
entt::DefaultRegistry & m_registry;
Game *& m_gameInstance;
uint32_t m_entity;
};
}
2 changes: 1 addition & 1 deletion BloomFramework/include/Graphics/Drawable.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace bloom::graphics {
Drawable(SDL_Renderer* targetRenderer);
virtual ~Drawable() = 0;

virtual void render(std::optional<SDL_Rect> srcRect, SDL_Rect destRect, SDL_RendererFlip flip = SDL_FLIP_NONE);
virtual void render(std::optional<SDL_Rect> srcRect, SDL_Rect destRect, double rotationAngle = 0.0, SDL_RendererFlip flip = SDL_FLIP_NONE);

protected:
SDL_Renderer* const c_renderer;
Expand Down
2 changes: 1 addition & 1 deletion BloomFramework/include/Graphics/SpriteText.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace bloom::graphics {
SpriteText(SDL_Renderer* targetRenderer, std::shared_ptr<Font> fontPtr, std::string_view text = std::string_view{}, TextStyle style = TextStyle{});
~SpriteText() = default;

void render(std::optional<SDL_Rect> srcRect, SDL_Point destPoint, SDL_RendererFlip flip = SDL_FLIP_NONE);
void render(std::optional<SDL_Rect> srcRect, SDL_Point destPoint, double rotationAngle = 0.0, SDL_RendererFlip flip = SDL_FLIP_NONE);

int getTextHeight() const { return m_height; }
int getTextWidth() const { return m_width; }
Expand Down
Loading