fixing abstract Window.hpp

This commit is contained in:
Clément Le Bihan
2021-05-21 12:07:52 +02:00
parent e86ffbe456
commit 81f662083f
5 changed files with 21 additions and 12 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ namespace RAY {
virtual ~Canvas() = default;
//! @brief draw drawable
virtual void draw(const Drawables::IDrawable &) = 0;
virtual void draw(Drawables::IDrawable &) = 0;
protected:
private:
+6
View File
@@ -42,4 +42,10 @@ Image RAY::Texture::toImage(void) const
const ::Texture &RAY::Texture::getTexture(void) const
{
return this->_texture;
}
bool RAY::Texture::unload()
{
UnloadTexture(this->_texture);
return true;
}
+2 -2
View File
@@ -35,14 +35,14 @@ namespace RAY
Texture &operator=(const Texture &) = default;
//! @brief Texture destructor, will unload ressources
~Texture();
~Texture() override;
//! @brief load ressources from file
//! @param filename: path of input
bool load(const std::string &filename);
//! @brief unload ressources
bool unload();
bool unload() override;
//! @brief get image
::Image toImage(void) const;
+1 -1
View File
@@ -96,7 +96,7 @@ namespace RAY {
//! @brief draw rectangle
//! @param drawable The drawable to render on screen
void draw(Drawables::IDrawable &drawable);
void draw(Drawables::IDrawable &drawable) override;
//! @brief draw texture at position
//! @param texture The object to render
+11 -8
View File
@@ -9,13 +9,16 @@ int main()
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
RAY::Window w(screenWidth, screenHeight, "Arthur it works", true);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
// InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window");
w.setFPS(60);
//SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
while (!w.shouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
@@ -24,19 +27,19 @@ int main()
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
w.beginDrawing();
ClearBackground(RAYWHITE);
w.clear(RAYWHITE);
DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);
DrawText("Congrats! You created your first window !", 190, 200, 20, LIGHTGRAY);
EndDrawing();
w.endDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
w.close(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;