Skip to content

Commit

Permalink
⚽ player
Browse files Browse the repository at this point in the history
  • Loading branch information
FelipeFTN committed Apr 18, 2023
1 parent 4351979 commit 4a0b08e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Binary file modified bin/MyGame
Binary file not shown.
21 changes: 18 additions & 3 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
#include <iostream>
#include <string>

#include "raylib.h"

int main() {

const int screenWidth = 512;
const int screenHeigt = 512;
const int screenHeight = 512;

InitWindow(screenWidth, screenHeigt, "Game");
InitWindow(screenWidth, screenHeight, "Game");

SetTargetFPS(60);

Texture2D background = LoadTexture("assets/map.png");

Texture2D ball = LoadTexture("assets/ball.png");

int ballWidth = ball.width;
int ballHeight = ball.height;

// Source rectangle (part of the texture to use for drawing)
Rectangle sourceRec = { 0.0f, 0.0f, (float)ballWidth, (float)ballHeight };

// Destination rectangle (screen rectangle where drawing part of texture)
Rectangle destRec = { screenWidth/2.0f, screenHeight/2.0f, ballWidth*2.0f, ballHeight*2.0f };

// Origin of the texture (rotation/scale point), it's relative to destination rectangle size
Vector2 origin = { (float)ballWidth, (float)ballHeight };


while(!WindowShouldClose()) {

ClearBackground(WHITE);

BeginDrawing();

DrawTextureEx(background, (Vector2){ 0.0f, 0.0f }, 0.0f, 8.0f, WHITE);
DrawTexturePro(ball, sourceRec, destRec, origin, 0.f, WHITE);

EndDrawing();
}
Expand Down
Binary file modified src/main.o
Binary file not shown.

0 comments on commit 4a0b08e

Please sign in to comment.