-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I thought that I had a formatter enabled in my IDE already, but apparently I don't. Add the .clang-format file so that CLion uses ClangFormat and format every file so that my C++ code looks way less embarrassing.
- Loading branch information
1 parent
c632330
commit 5119c03
Showing
108 changed files
with
2,851 additions
and
2,941 deletions.
There are no files selected for viewing
Empty file.
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
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 |
---|---|---|
@@ -1,36 +1,38 @@ | ||
#include "RaylibGraphicsDevice.h" | ||
|
||
void RaylibGraphicsDevice::begin() { | ||
ClearBackground({clearColor.r, clearColor.g, clearColor.b, clearColor.a}); | ||
BeginDrawing(); | ||
ClearBackground({clearColor.r, clearColor.g, clearColor.b, clearColor.a}); | ||
BeginDrawing(); | ||
} | ||
|
||
void RaylibGraphicsDevice::end() { | ||
EndDrawing(); | ||
} | ||
void RaylibGraphicsDevice::end() { EndDrawing(); } | ||
|
||
void RaylibGraphicsDevice::setClearColor(const Adagio::Color &color) { | ||
clearColor = color; | ||
clearColor = color; | ||
} | ||
|
||
static Rectangle AdagioRectToRaylibRect(const Adagio::RectF &rect) { | ||
return {rect.x(), rect.y(), rect.width(), rect.height()}; | ||
return {rect.x(), rect.y(), rect.width(), rect.height()}; | ||
} | ||
|
||
void | ||
RaylibGraphicsDevice::drawTexture(Adagio::Texture2D &texture, const Adagio::RectF &source, const Adagio::RectF &dest, | ||
const Adagio::Vector2d &origin, float rotation, const Adagio::Color &tint) { | ||
RaylibTexture raylibTex = textureManager.useTexture(texture); | ||
DrawTexturePro(raylibTex, AdagioRectToRaylibRect(source), AdagioRectToRaylibRect(dest), | ||
{static_cast<float>(origin.x), static_cast<float>(origin.y)}, rotation, | ||
{tint.r, tint.g, tint.b, tint.a}); | ||
void RaylibGraphicsDevice::drawTexture(Adagio::Texture2D &texture, | ||
const Adagio::RectF &source, | ||
const Adagio::RectF &dest, | ||
const Adagio::Vector2d &origin, | ||
float rotation, | ||
const Adagio::Color &tint) { | ||
RaylibTexture raylibTex = textureManager.useTexture(texture); | ||
DrawTexturePro(raylibTex, AdagioRectToRaylibRect(source), | ||
AdagioRectToRaylibRect(dest), | ||
{static_cast<float>(origin.x), static_cast<float>(origin.y)}, | ||
rotation, {tint.r, tint.g, tint.b, tint.a}); | ||
} | ||
|
||
Adagio::AbstractTextureManager *RaylibGraphicsDevice::getTextureManager() { | ||
return &textureManager; | ||
return &textureManager; | ||
} | ||
|
||
void RaylibGraphicsDevice::drawText(Font &font, const char *text, const Adagio::Vector2d &position, float fontSize, | ||
float spacing, const Adagio::Color &tint) { | ||
|
||
} | ||
void RaylibGraphicsDevice::drawText(Font &font, const char *text, | ||
const Adagio::Vector2d &position, | ||
float fontSize, float spacing, | ||
const Adagio::Color &tint) {} |
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 |
---|---|---|
@@ -1,33 +1,34 @@ | ||
#ifndef GL_ADAGIO_RAYLIBGRAPHICSDEVICE_H | ||
#define GL_ADAGIO_RAYLIBGRAPHICSDEVICE_H | ||
|
||
#include "raylib.h" | ||
#include "RaylibTextureLoader.h" | ||
#include "../../graphics/GraphicsDevice.h" | ||
#include "RaylibTextureLoader.h" | ||
#include "raylib.h" | ||
|
||
typedef Texture2D RaylibTexture; | ||
|
||
class RaylibGraphicsDevice : public Adagio::GraphicsDevice { | ||
private: | ||
RaylibTextureLoader loader; | ||
Adagio::TextureManager<RaylibTexture> textureManager{&loader}; | ||
Adagio::Color clearColor{0, 0, 0, 255}; | ||
public: | ||
void begin() override; | ||
RaylibTextureLoader loader; | ||
Adagio::TextureManager<RaylibTexture> textureManager{&loader}; | ||
Adagio::Color clearColor{0, 0, 0, 255}; | ||
|
||
void end() override; | ||
public: | ||
void begin() override; | ||
|
||
void setClearColor(const Adagio::Color &color) override; | ||
void end() override; | ||
|
||
Adagio::AbstractTextureManager *getTextureManager() override; | ||
void setClearColor(const Adagio::Color &color) override; | ||
|
||
void drawTexture(Adagio::Texture2D &texture, const Adagio::RectF &source, const Adagio::RectF &dest, | ||
const Adagio::Vector2d &origin, float rotation, const Adagio::Color &tint) override; | ||
Adagio::AbstractTextureManager *getTextureManager() override; | ||
|
||
void drawText(Font &font, const char *text, const Adagio::Vector2d &position, float fontSize, float spacing, | ||
const Adagio::Color &tint) override; | ||
void drawTexture(Adagio::Texture2D &texture, const Adagio::RectF &source, | ||
const Adagio::RectF &dest, const Adagio::Vector2d &origin, | ||
float rotation, const Adagio::Color &tint) override; | ||
|
||
void drawText(Font &font, const char *text, const Adagio::Vector2d &position, | ||
float fontSize, float spacing, | ||
const Adagio::Color &tint) override; | ||
}; | ||
|
||
|
||
#endif //GL_ADAGIO_RAYLIBGRAPHICSDEVICE_H | ||
#endif // GL_ADAGIO_RAYLIBGRAPHICSDEVICE_H |
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 |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
|
||
typedef Texture2D RaylibTexture; | ||
|
||
#endif //GL_ADAGIO_RAYLIBTEXTURE_H | ||
#endif // GL_ADAGIO_RAYLIBTEXTURE_H |
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
#include "RaylibTextureLoader.h" | ||
#include <utility> | ||
|
||
std::pair<RaylibTexture, Adagio::TextureDimensions> RaylibTextureLoader::load(const char *resource) { | ||
RaylibTexture tex = LoadTexture(resource); | ||
Adagio::TextureDimensions dims{static_cast<unsigned int>(tex.width), static_cast<unsigned int>(tex.height)}; | ||
return std::make_pair(tex, dims); | ||
std::pair<RaylibTexture, Adagio::TextureDimensions> | ||
RaylibTextureLoader::load(const char *resource) { | ||
RaylibTexture tex = LoadTexture(resource); | ||
Adagio::TextureDimensions dims{static_cast<unsigned int>(tex.width), | ||
static_cast<unsigned int>(tex.height)}; | ||
return std::make_pair(tex, dims); | ||
} | ||
|
||
void RaylibTextureLoader::unload(RaylibTexture texture) { | ||
UnloadTexture(texture); | ||
UnloadTexture(texture); | ||
} |
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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
#ifndef GL_ADAGIO_RAYLIBTEXTURELOADER_H | ||
#define GL_ADAGIO_RAYLIBTEXTURELOADER_H | ||
|
||
#include "RaylibTexture.h" | ||
#include "../../graphics/TextureLoader.h" | ||
#include "RaylibTexture.h" | ||
|
||
class RaylibTextureLoader : public Adagio::TextureLoader<RaylibTexture> { | ||
public: | ||
std::pair<RaylibTexture, Adagio::TextureDimensions> load(const char *resource) override; | ||
std::pair<RaylibTexture, Adagio::TextureDimensions> | ||
load(const char *resource) override; | ||
|
||
void unload(RaylibTexture texture) override; | ||
void unload(RaylibTexture texture) override; | ||
}; | ||
|
||
|
||
#endif //GL_ADAGIO_RAYLIBTEXTURELOADER_H | ||
#endif // GL_ADAGIO_RAYLIBTEXTURELOADER_H |
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.