mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-29 17:02:11 +00:00
fixing abstract Window.hpp
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user