This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
1,497 additions
and
558 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2023 Estrol Mendex | ||
* See the LICENSE file in the root of this project for details. | ||
*/ | ||
|
||
#ifndef __SPRITEBATCH_H__ | ||
#define __SPRITEBATCH_H__ | ||
|
||
#include "GraphicsBackendBase.h" | ||
#include "GraphicsTexture2D.h" | ||
|
||
#include <map> | ||
#include <vector> | ||
|
||
namespace Graphics { | ||
enum class SpriteBatchMode { | ||
Deferred, | ||
Immediate | ||
}; | ||
|
||
enum class SpriteBatchSortMode { | ||
BackToFront, | ||
FrontToBack, | ||
}; | ||
|
||
class SpriteBatch | ||
{ | ||
public: | ||
SpriteBatch(); | ||
~SpriteBatch(); | ||
|
||
void Begin(); | ||
void Draw(Backends::SubmitInfo info); | ||
void Draw(std::vector<Backends::SubmitInfo> infos); | ||
void End(); | ||
|
||
SpriteBatchMode RenderMode; | ||
SpriteBatchSortMode SortMode; | ||
|
||
private: | ||
int m_CurrentQueue; | ||
|
||
bool m_DrawingMode; | ||
std::map<int, std::vector<Backends::SubmitInfo>> m_Queue; | ||
const void *m_Image; | ||
}; | ||
} // namespace Graphics | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* MIT License | ||
* | ||
* Copyright (c) 2023 Estrol Mendex | ||
* See the LICENSE file in the root of this project for details. | ||
*/ | ||
|
||
#ifndef __SPRITE_H_ | ||
#define __SPRITE_H_ | ||
|
||
#include <vector> | ||
|
||
#include "Image.h" | ||
#include <glm/glm.hpp> | ||
|
||
namespace UI { | ||
class Sprite : public Image | ||
{ | ||
public: | ||
Sprite(); | ||
Sprite( | ||
std::filesystem::path path, | ||
std::vector<std::vector<glm::vec2>> texCoords, | ||
double frameTime); | ||
|
||
Sprite( | ||
std::shared_ptr<Graphics::Texture2D> texture, | ||
std::vector<std::vector<glm::vec2>> texCoords, | ||
double frameTime); | ||
|
||
Sprite( | ||
const char *buf, | ||
size_t size, | ||
std::vector<std::vector<glm::vec2>> texCoords, | ||
double frameTime); | ||
|
||
Sprite( | ||
const char *pixbuf, | ||
uint32_t width, | ||
uint32_t height, | ||
std::vector<std::vector<glm::vec2>> texCoords, | ||
double frameTime); | ||
|
||
void Draw(double delta); | ||
|
||
void SetSpriteIndex(int index); | ||
int GetSpriteIndex() const; | ||
|
||
void SetFrameTime(double time); | ||
double GetFrameTime() const; | ||
|
||
protected: | ||
void OnDraw() override; | ||
double m_frameTime; | ||
double m_elapsedFrameTime; | ||
int m_spriteIndex; | ||
std::vector<std::vector<glm::vec2>> m_texCoords; | ||
}; | ||
} // namespace UI | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.