actually add vendor folder
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
#include "Player.hpp"
|
||||
#include "raylib-cpp.hpp"
|
||||
|
||||
Player::Player() {
|
||||
position = Rectangle{
|
||||
GetScreenWidth() / 2.0f - 50,
|
||||
GetScreenHeight() / 2.0f - 50,
|
||||
100,
|
||||
100
|
||||
};
|
||||
speed = 3;
|
||||
}
|
||||
|
||||
void Player::Draw() {
|
||||
position.Draw(RED);
|
||||
}
|
||||
|
||||
void Player::Update() {
|
||||
if (IsKeyDown(KEY_UP)) {
|
||||
position.y -= speed;
|
||||
}
|
||||
if (IsKeyDown(KEY_DOWN)) {
|
||||
position.y += speed;
|
||||
}
|
||||
if (IsKeyDown(KEY_RIGHT)) {
|
||||
position.x += speed;
|
||||
}
|
||||
if (IsKeyDown(KEY_LEFT)) {
|
||||
position.x -= speed;
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
#include "raylib-cpp.hpp"
|
||||
|
||||
class Player {
|
||||
public:
|
||||
Player();
|
||||
raylib::Rectangle position;
|
||||
int speed;
|
||||
void Draw();
|
||||
void Update();
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
# Multiple Files Example
|
||||
|
||||
This provides an example of including raylib-cpp.hpp in multiple files.
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib-cpp [multiple] example - Includes raylib-cpp.hpp from multiple sources.
|
||||
*
|
||||
* Welcome to raylib!
|
||||
*
|
||||
* To test examples, just press F6 and execute raylib_compile_execute script
|
||||
* Note that compiled executable is placed in the same folder as .c file
|
||||
*
|
||||
* You can find all basic examples on C:\raylib\raylib\examples folder or
|
||||
* raylib official webpage: www.raylib.com
|
||||
*
|
||||
* Enjoy using raylib. :)
|
||||
*
|
||||
* This example has been created using raylib-cpp
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2021 Rob Loach (https://robloach.net)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
#include "Player.hpp"
|
||||
#include "raylib-cpp.hpp"
|
||||
|
||||
int main() {
|
||||
raylib::Window window(640, 480, "raylib-cpp [multiple] example");
|
||||
SetTargetFPS(60);
|
||||
|
||||
Player player;
|
||||
while (!window.ShouldClose()) {
|
||||
window.BeginDrawing();
|
||||
{
|
||||
window.ClearBackground(SKYBLUE);
|
||||
player.Update();
|
||||
player.Draw();
|
||||
}
|
||||
window.EndDrawing();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user