Compare commits
12 Commits
cfd672bf25
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 056cdf9799 | |||
| a385a24d0f | |||
| 93bca5b327 | |||
|
|
873c3d3e3d | ||
|
|
5fc8c8f94f | ||
|
|
e1c3fea1f0 | ||
| 3d3c028997 | |||
| 4071b771e4 | |||
| 962e15debc | |||
| f99152341c | |||
| dc5d0aef86 | |||
| d6724e4c73 |
8
.gitignore
vendored
8
.gitignore
vendored
@@ -405,4 +405,12 @@ Makefile
|
||||
*.swp
|
||||
*.swo
|
||||
*.swn
|
||||
|
||||
/build/compile_commands.json
|
||||
raylib.make
|
||||
raylib.vcxproj
|
||||
raylib.vcxproj.filters
|
||||
test-game.make
|
||||
test-game.vcxproj
|
||||
test-game.vcxproj.filters
|
||||
raylib.make
|
||||
|
||||
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
@@ -4,6 +4,7 @@
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Debug",
|
||||
"type": "cppdbg",
|
||||
|
||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -7,5 +7,6 @@
|
||||
"**/.DS_Store": true,
|
||||
"**/*.o": true,
|
||||
"**/*.exe": true,
|
||||
}
|
||||
},
|
||||
"cmake.sourceDirectory": "/home/mrsh/Games/test-text/build/external/raylib-master"
|
||||
}
|
||||
BIN
raw/mrsh.ase
Normal file
BIN
raw/mrsh.ase
Normal file
Binary file not shown.
24
raw/mrsh.json
Normal file
24
raw/mrsh.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{ "frames": {
|
||||
"mrsh.ase": {
|
||||
"frame": { "x": 0, "y": 0, "w": 16, "h": 16 },
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": { "x": 0, "y": 0, "w": 16, "h": 16 },
|
||||
"sourceSize": { "w": 16, "h": 16 },
|
||||
"duration": 100
|
||||
}
|
||||
},
|
||||
"meta": {
|
||||
"app": "https://github.com/LibreSprite/LibreSprite/",
|
||||
"version": "1.2-973d0e3d-SDL",
|
||||
"image": "C:\\Code\\test-game\\raw\\mrsh.png",
|
||||
"format": "RGBA8888",
|
||||
"size": { "w": 16, "h": 16 },
|
||||
"scale": "1",
|
||||
"frameTags": [
|
||||
],
|
||||
"layers": [
|
||||
{ "name": "Layer 1", "opacity": 255, "blendMode": "normal" }
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
raw/mrsh.png
Normal file
BIN
raw/mrsh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 206 B |
BIN
resources/mrsh.png
Normal file
BIN
resources/mrsh.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 206 B |
49
src/main.c
49
src/main.c
@@ -10,6 +10,18 @@ by Jeffery Myers is marked with CC0 1.0. To view a copy of this license, visit h
|
||||
#include "raylib.h"
|
||||
|
||||
#include "resource_dir.h" // utility header for SearchAndSetResourceDir
|
||||
#include <stdlib.h>
|
||||
|
||||
typedef struct Player {
|
||||
Vector2 position;
|
||||
Vector2 size;
|
||||
int life;
|
||||
} Player;
|
||||
|
||||
static Player player = {0};
|
||||
|
||||
static void characterMovement(void);
|
||||
|
||||
|
||||
int main ()
|
||||
{
|
||||
@@ -23,11 +35,12 @@ int main ()
|
||||
SearchAndSetResourceDir("resources");
|
||||
|
||||
// Load a texture from the resources directory
|
||||
Image image = LoadImage("emi.png");
|
||||
Image image = LoadImage("mrsh.png");
|
||||
Texture2D emi = LoadTextureFromImage(image);
|
||||
UnloadImage(image);
|
||||
|
||||
|
||||
int HorizontalPosition = 400;
|
||||
int VerticalPosition = 300;
|
||||
|
||||
// game loop
|
||||
while (!WindowShouldClose()) // run the loop until the user presses ESCAPE or presses the Close button on the window
|
||||
@@ -38,14 +51,12 @@ int main ()
|
||||
// Setup the back buffer for drawing (clear color and depth buffers)
|
||||
ClearBackground(BLACK);
|
||||
|
||||
// draw our texture to the screen
|
||||
DrawTexture(emi, 800/2 - emi.width/2, 600/2 - emi.height/2, WHITE);
|
||||
// DrawRectangle(HorizontalPosition, VerticalPosition, 10, 10, BLUE);
|
||||
DrawTexture(emi, player.position.x, player.position.y, WHITE);
|
||||
|
||||
// draw some text using the default font
|
||||
DrawText("Emi la plus belle", 200,50,20,PINK);
|
||||
characterMovement();
|
||||
|
||||
|
||||
// end the frame and get ready for the next one (display frame, poll input, etc...)
|
||||
EndDrawing();
|
||||
}
|
||||
|
||||
@@ -57,3 +68,27 @@ int main ()
|
||||
CloseWindow();
|
||||
return 0;
|
||||
}
|
||||
void characterMovement(void){
|
||||
|
||||
//up
|
||||
if (IsKeyDown(74) ) {
|
||||
// draw some text using the default font
|
||||
player.position.y = player.position.y+10;
|
||||
};
|
||||
//down
|
||||
if (IsKeyDown(75) ) {
|
||||
player.position.y = player.position.y-10;
|
||||
// draw some text using the default font
|
||||
};
|
||||
//left
|
||||
if (IsKeyDown(72) ) {
|
||||
player.position.x = player.position.x-10;
|
||||
// draw some text using the default font
|
||||
};
|
||||
//right
|
||||
if (IsKeyDown(76)) {
|
||||
player.position.x = player.position.x+10;
|
||||
// draw some text using the default font
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user