Skip to content

Commit

Permalink
DrawingEntity (351XsAgxQy)
Browse files Browse the repository at this point in the history
  • Loading branch information
Neko-Box-Coder committed Jul 8, 2023
1 parent dbfa399 commit 08beb36
Show file tree
Hide file tree
Showing 60 changed files with 2,575 additions and 2,036 deletions.
3 changes: 3 additions & 0 deletions ClocExcludeFiles.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Src/Tests/TestsResources.c
Src/Examples/ExamplesResources.c
Src/ssGUI/EmbeddedResources.c
2 changes: 1 addition & 1 deletion External/ssTest
Submodule ssTest updated 1 files
+1 −0 Include/ssTest.hpp
30 changes: 2 additions & 28 deletions Include/ssGUI/Backend/Interfaces/BackendDrawingInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "ssGUI/Backend/Interfaces/BackendImageInterface.hpp"
#include "ssGUI/Backend/Interfaces/BackendFontInterface.hpp"
#include "ssGUI/DataClasses/DrawingProperties.hpp"
#include "ssGUI/DataClasses/DrawingEntity.hpp"
#include "glm/vec2.hpp"
#include "glm/vec3.hpp"
#include "glm/vec4.hpp"
Expand Down Expand Up @@ -95,11 +95,7 @@ namespace Backend
//function: DrawEntities
//Draws the entity based on what is set in the _properties_. Returns true if drawn successfully.
//*Note that if you are not using <ssGUIManager>, you need to call <Render> at the end in order to render it*.
virtual bool DrawEntities( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const std::vector<int>& counts,
const std::vector<ssGUI::DrawingProperty>& properties) = 0;
virtual bool DrawEntities(const std::vector<ssGUI::DrawingEntity>& entities) = 0;

//function: Render
//Renders every entity that are drawn to the <MainWindow>. This will automatically clear the back buffer.
Expand Down Expand Up @@ -143,28 +139,6 @@ namespace Backend

virtual bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors) = 0;

//TODO: Use float for character size
//NOTE: End index is exclusive
virtual bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const uint32_t character,
int startIndex, int endIndex,
const ssGUI::Backend::BackendFontInterface& font,
int characterSize) = 0;

virtual bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex,
const ssGUI::Backend::BackendImageInterface& image) = 0;


virtual bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex) = 0;

};
inline BackendDrawingInterface::~BackendDrawingInterface(){} //Pure virtual destructor needs to be defined
}
Expand Down
61 changes: 4 additions & 57 deletions Include/ssGUI/Backend/Mocks/BackendDrawingMock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ namespace Backend
int SavedStateCount;
int CurrentDrawingBuffer;

std::vector<glm::vec2> Vertices[2];
std::vector<glm::vec2> TexCoords[2];
std::vector<glm::u8vec4> Colors[2];
std::vector<int> Counts[2];
std::vector<ssGUI::DrawingProperty> Properties[2];
std::vector<ssGUI::DrawingEntity> Entities[2];
glm::u8vec3 ClearedColor[2];
std::unordered_set<ssGUI::Backend::BackendImageInterface*> CachedImage;

Expand All @@ -45,35 +41,11 @@ namespace Backend
//function: GetStateCounter
int GetStateCounter() const;

//function: GetDrawnVertices
const std::vector<glm::vec2>& GetDrawnVertices() const;

//function: GetRenderedVertices
const std::vector<glm::vec2>& GetRenderedVertices() const;

//function: GetDrawnTexCoords
const std::vector<glm::vec2>& GetDrawnTexCoords() const;

//function: GetRenderedTexCoords
const std::vector<glm::vec2>& GetRenderedTexCoords() const;

//function: GetDrawnColors
const std::vector<glm::u8vec4>& GetDrawnColors() const;

//function: GetRenderedColors
const std::vector<glm::u8vec4>& GetRenderedColors() const;

//function: GetDrawnCounts
const std::vector<int>& GetDrawnCounts() const;

//function: GetRenderedCounts
const std::vector<int>& GetRenderedCounts() const;

//function: GetDrawnProperties
const std::vector<ssGUI::DrawingProperty>& GetDrawnProperties() const;
const std::vector<ssGUI::DrawingEntity>& GetDrawnEntities() const;

//function: GetRenderedProperties
const std::vector<ssGUI::DrawingProperty>& GetRenderedProperties() const;
const std::vector<ssGUI::DrawingEntity>& GetRenderedEntities() const;

//function: GetDrawnClearedColor
const glm::u8vec3& GetDrawnClearedColor() const;
Expand All @@ -91,11 +63,7 @@ namespace Backend

//function: DrawEntities
//See <BackendDrawingInterface::DrawEntities>
bool DrawEntities( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const std::vector<int>& counts,
const std::vector<ssGUI::DrawingProperty>& properties) override;
bool DrawEntities( const std::vector<ssGUI::DrawingEntity>& entities) override;

//function: Render
//See <BackendDrawingInterface::Render>
Expand Down Expand Up @@ -134,27 +102,6 @@ namespace Backend

bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors) override;

//NOTE: End index is exclusive
bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const uint32_t character,
int startIndex, int endIndex,
const ssGUI::Backend::BackendFontInterface& font,
int characterSize) override;

bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex,
const ssGUI::Backend::BackendImageInterface& image) override;


bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex) override;

};
}

Expand Down
26 changes: 1 addition & 25 deletions Include/ssGUI/Backend/SFML/BackendDrawingSFML.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,7 @@ namespace Backend

//function: DrawEntities
//See <BackendDrawingInterface::DrawEntities>
bool DrawEntities( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const std::vector<int>& counts,
const std::vector<ssGUI::DrawingProperty>& properties) override;
bool DrawEntities(const std::vector<ssGUI::DrawingEntity>& entities) override;

//function: Render
//See <BackendDrawingInterface::Render>
Expand Down Expand Up @@ -138,26 +134,6 @@ namespace Backend

bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors) override;

//NOTE: End index is exclusive
bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const uint32_t character,
int startIndex, int endIndex,
const ssGUI::Backend::BackendFontInterface& font,
int characterSize) override;

bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex,
const ssGUI::Backend::BackendImageInterface& image) override;


bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex) override;
};
}

Expand Down
27 changes: 1 addition & 26 deletions Include/ssGUI/Backend/Template/BackendDrawingTemplate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ namespace Backend

//function: DrawEntities
//See <BackendDrawingInterface::DrawEntities>
bool DrawEntities( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const std::vector<int>& counts,
const std::vector<ssGUI::DrawingProperty>& properties) override;
bool DrawEntities(const std::vector<ssGUI::DrawingEntity>& entities) override;

//function: Render
//See <BackendDrawingInterface::Render>
Expand Down Expand Up @@ -74,27 +70,6 @@ namespace Backend

bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors) override;

//NOTE: End index is exclusive
bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const uint32_t character,
int startIndex, int endIndex,
const ssGUI::Backend::BackendFontInterface& font,
int characterSize) override;

bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex,
const ssGUI::Backend::BackendImageInterface& image) override;


bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex) override;

};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ namespace Backend

//function: DrawEntities
//See <BackendDrawingInterface::DrawEntities>
bool DrawEntities( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const std::vector<int>& counts,
const std::vector<ssGUI::DrawingProperty>& properties) override;
bool DrawEntities(const std::vector<ssGUI::DrawingEntity>& entities) override;

//function: Render
//See <BackendDrawingInterface::Render>
Expand Down Expand Up @@ -102,41 +98,20 @@ namespace Backend

protected:
bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const uint32_t character,
const ssGUI::Backend::BackendFontInterface& font,
int characterSize) override;
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const uint32_t character,
const ssGUI::Backend::BackendFontInterface& font,
int characterSize) override;

bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const ssGUI::Backend::BackendImageInterface& image) override;
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const ssGUI::Backend::BackendImageInterface& image) override;


bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors) override;

//NOTE: End index is exclusive
bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const uint32_t character,
int startIndex, int endIndex,
const ssGUI::Backend::BackendFontInterface& font,
int characterSize) override;

bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex,
const ssGUI::Backend::BackendImageInterface& image) override;


bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex) override;

const std::vector<glm::u8vec4>& colors) override;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,7 @@ namespace Backend

//function: DrawEntities
//See <BackendDrawingInterface::DrawEntities>
bool DrawEntities( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const std::vector<int>& counts,
const std::vector<ssGUI::DrawingProperty>& properties) override;
bool DrawEntities(const std::vector<ssGUI::DrawingEntity>& entities) override;

//function: Render
//See <BackendDrawingInterface::Render>
Expand Down Expand Up @@ -110,27 +106,6 @@ namespace Backend

bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors) override;

//NOTE: End index is exclusive
bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
const uint32_t character,
int startIndex, int endIndex,
const ssGUI::Backend::BackendFontInterface& font,
int characterSize) override;

bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::vec2>& texCoords,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex,
const ssGUI::Backend::BackendImageInterface& image) override;


bool DrawShape( const std::vector<glm::vec2>& vertices,
const std::vector<glm::u8vec4>& colors,
int startIndex, int endIndex) override;

};
}

Expand Down
Loading

0 comments on commit 08beb36

Please sign in to comment.