diff options
| -rw-r--r-- | src/main.cpp | 12 | ||||
| -rw-r--r-- | src/physics.cpp | 7 | ||||
| -rw-r--r-- | src/physics.hpp | 5 | ||||
| -rw-r--r-- | src/resources.cpp | 2 |
4 files changed, 20 insertions, 6 deletions
diff --git a/src/main.cpp b/src/main.cpp index 0cda8fb..7af702a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,14 +9,15 @@ int main(void) // Initialization //-------------------------------------------------------------------------------------- const int screenWidth = 800; - const int screenHeight = 450; + const int screenHeight = 800; InitWindow(screenWidth, screenHeight, "raylib [core] example - basic window"); SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- - auto ship = Renderer::Sprite("ship", (Rectangle){1365,1696,198,188}); + auto ship = Renderer::Sprite("kenneySpaceShooter", (Rectangle){1365,1696,198,188}, (Vector2){19.80/2,18.80/2}); + auto rock = Renderer::Sprite("kenneySpaceShooter", (Rectangle){0,800,440,442}, (Vector2){44.00/2, 44.20/2}); // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key @@ -30,11 +31,12 @@ int main(void) //---------------------------------------------------------------------------------- BeginDrawing(); - ClearBackground(RAYWHITE); + ClearBackground(BLACK); - DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY); + DrawText("Space!", 190, 200, 20, LIGHTGRAY); //DrawTexture(Resources::useTexture("ship"), 0, 0, WHITE); - ship.draw(100,100); + ship.draw(100,100, 0.1); + rock.draw(750,750, 0.1); EndDrawing(); //---------------------------------------------------------------------------------- diff --git a/src/physics.cpp b/src/physics.cpp new file mode 100644 index 0000000..23b21e4 --- /dev/null +++ b/src/physics.cpp @@ -0,0 +1,7 @@ +#include "physics.hpp" +#include <math.h> + +namespace Physics { + //const float gravitational_constant = 6.67e-11; + +} diff --git a/src/physics.hpp b/src/physics.hpp new file mode 100644 index 0000000..fa90c1d --- /dev/null +++ b/src/physics.hpp @@ -0,0 +1,5 @@ +#pragma once + +namespace Physics { + +} diff --git a/src/resources.cpp b/src/resources.cpp index 9d1834a..27b860d 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -6,7 +6,7 @@ namespace Resources { static std::unordered_map<std::string, std::string> textureFiles = { - {"ship", "./assets/textures/spaceShooter2_spritesheet_2X.png"} + {"kenneySpaceShooter", "./assets/textures/spaceShooter2_spritesheet_2X.png"} }; static std::unordered_map<std::string, Texture> textures; Texture useTexture(std::string id) { |
