Compare commits
6 Commits
81d0cbc673
...
cube_game
| Author | SHA1 | Date | |
|---|---|---|---|
| c2b802807d | |||
| e2fb018c61 | |||
| a7d368cdcc | |||
| 4b545205aa | |||
| c4930f77df | |||
| b8d2ef243a |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.vscode/
|
||||||
18
.vscode/c_cpp_properties.json
vendored
18
.vscode/c_cpp_properties.json
vendored
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "linux-gcc-x64",
|
|
||||||
"includePath": [
|
|
||||||
"${workspaceFolder}/**"
|
|
||||||
],
|
|
||||||
"compilerPath": "/usr/bin/gcc",
|
|
||||||
"cStandard": "${default}",
|
|
||||||
"cppStandard": "${default}",
|
|
||||||
"intelliSenseMode": "linux-gcc-x64",
|
|
||||||
"compilerArgs": [
|
|
||||||
""
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version": 4
|
|
||||||
}
|
|
||||||
14
.vscode/launch.json
vendored
14
.vscode/launch.json
vendored
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Debug with CodeLLDB",
|
|
||||||
"type": "lldb",
|
|
||||||
"request": "launch",
|
|
||||||
"program": "${fileDirname}/${fileBasenameNoExtension}",
|
|
||||||
"args": [],
|
|
||||||
"cwd": "${fileDirname}",
|
|
||||||
"preLaunchTask": "C/C++: gcc build active file"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
59
.vscode/settings.json
vendored
59
.vscode/settings.json
vendored
@@ -1,59 +0,0 @@
|
|||||||
{
|
|
||||||
"C_Cpp_Runner.cCompilerPath": "gcc",
|
|
||||||
"C_Cpp_Runner.cppCompilerPath": "g++",
|
|
||||||
"C_Cpp_Runner.debuggerPath": "gdb",
|
|
||||||
"C_Cpp_Runner.cStandard": "",
|
|
||||||
"C_Cpp_Runner.cppStandard": "",
|
|
||||||
"C_Cpp_Runner.msvcBatchPath": "",
|
|
||||||
"C_Cpp_Runner.useMsvc": false,
|
|
||||||
"C_Cpp_Runner.warnings": [
|
|
||||||
"-Wall",
|
|
||||||
"-Wextra",
|
|
||||||
"-Wpedantic",
|
|
||||||
"-Wshadow",
|
|
||||||
"-Wformat=2",
|
|
||||||
"-Wcast-align",
|
|
||||||
"-Wconversion",
|
|
||||||
"-Wsign-conversion",
|
|
||||||
"-Wnull-dereference"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.msvcWarnings": [
|
|
||||||
"/W4",
|
|
||||||
"/permissive-",
|
|
||||||
"/w14242",
|
|
||||||
"/w14287",
|
|
||||||
"/w14296",
|
|
||||||
"/w14311",
|
|
||||||
"/w14826",
|
|
||||||
"/w44062",
|
|
||||||
"/w44242",
|
|
||||||
"/w14905",
|
|
||||||
"/w14906",
|
|
||||||
"/w14263",
|
|
||||||
"/w44265",
|
|
||||||
"/w14928"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.enableWarnings": true,
|
|
||||||
"C_Cpp_Runner.warningsAsError": false,
|
|
||||||
"C_Cpp_Runner.compilerArgs": [],
|
|
||||||
"C_Cpp_Runner.linkerArgs": [],
|
|
||||||
"C_Cpp_Runner.includePaths": [],
|
|
||||||
"C_Cpp_Runner.includeSearch": [
|
|
||||||
"*",
|
|
||||||
"**/*"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.excludeSearch": [
|
|
||||||
"**/build",
|
|
||||||
"**/build/**",
|
|
||||||
"**/.*",
|
|
||||||
"**/.*/**",
|
|
||||||
"**/.vscode",
|
|
||||||
"**/.vscode/**"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.useAddressSanitizer": false,
|
|
||||||
"C_Cpp_Runner.useUndefinedSanitizer": false,
|
|
||||||
"C_Cpp_Runner.useLeakSanitizer": false,
|
|
||||||
"C_Cpp_Runner.showCompilationTime": false,
|
|
||||||
"C_Cpp_Runner.useLinkTimeOptimization": false,
|
|
||||||
"C_Cpp_Runner.msvcSecureNoWarnings": false
|
|
||||||
}
|
|
||||||
26
.vscode/tasks.json
vendored
26
.vscode/tasks.json
vendored
@@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "2.0.0",
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"type": "shell",
|
|
||||||
"label": "C/C++: gcc build active file",
|
|
||||||
"command": "/usr/bin/gcc",
|
|
||||||
"args": [
|
|
||||||
"-g",
|
|
||||||
"${file}",
|
|
||||||
"-o",
|
|
||||||
"${fileDirname}/${fileBasenameNoExtension}"
|
|
||||||
],
|
|
||||||
"options": {
|
|
||||||
"cwd": "${fileDirname}"
|
|
||||||
},
|
|
||||||
"problemMatcher": [
|
|
||||||
"$gcc"
|
|
||||||
],
|
|
||||||
"group": {
|
|
||||||
"kind": "build",
|
|
||||||
"isDefault": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
22
Makefile
Normal file
22
Makefile
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
CC=gcc
|
||||||
|
|
||||||
|
SRC=src/main.c \
|
||||||
|
src/world.c \
|
||||||
|
src/player.c \
|
||||||
|
src/physics.c \
|
||||||
|
src/render.c
|
||||||
|
|
||||||
|
OUT=wrldbox
|
||||||
|
|
||||||
|
INCLUDES=-Iinclude
|
||||||
|
LIBPATH=-Llib
|
||||||
|
|
||||||
|
CFLAGS=-O2 -Wall
|
||||||
|
|
||||||
|
LIBS=-lraylib -lX11 -ldl -lpthread -lm
|
||||||
|
|
||||||
|
all:
|
||||||
|
$(CC) $(SRC) $(CFLAGS) $(INCLUDES) $(LIBPATH) -o $(OUT) $(LIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OUT)
|
||||||
21
OLD/Makefile
Normal file
21
OLD/Makefile
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# 1. Variables (to avoid repeating yourself)
|
||||||
|
CC = gcc
|
||||||
|
CFLAGS = -Iinclude
|
||||||
|
LDFLAGS = -Llib -lraylib -lGL -lm -lpthread -ldl -lrt -lX11
|
||||||
|
|
||||||
|
# 2. Default target (runs when you just type 'make')
|
||||||
|
default: visual text
|
||||||
|
|
||||||
|
# 3. Specific build targets
|
||||||
|
visual: ray.c
|
||||||
|
$(CC) ray.c -o ray.out $(CFLAGS) $(LDFLAGS)
|
||||||
|
|
||||||
|
text: text_physics.c
|
||||||
|
$(CC) text_physics.c -o text_physics.out $(CFLAGS) $(LDFLAGS)
|
||||||
|
|
||||||
|
# 4. Cleanup targets (all mapped to the same action)
|
||||||
|
clean clear rm remove wipe:
|
||||||
|
rm -f ray.out text_physics.out
|
||||||
|
|
||||||
|
# 5. Phony targets (tells make these are actions, not actual files)
|
||||||
|
.PHONY: default visual text clean clear rm remove wipe
|
||||||
1743
OLD/include/raylib.h
Executable file
1743
OLD/include/raylib.h
Executable file
File diff suppressed because it is too large
Load Diff
BIN
OLD/lib/libraylib.a
Executable file
BIN
OLD/lib/libraylib.a
Executable file
Binary file not shown.
@@ -1,8 +1,17 @@
|
|||||||
|
// ray.c A-0-i by team wholeworldcoding.
|
||||||
|
// working physics simulation with 1 object, limited playground and fixed parameters
|
||||||
|
// This is P7MJ, out.
|
||||||
|
|
||||||
|
// Changes:
|
||||||
|
// Reversing gravity makes it work?!!!
|
||||||
|
// Added scale factor, mathed the shit out of that.
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
const float g = -9.81;
|
const float scale=43.7445319335; // We must find a scale factor, as gravity is calculated based on PIXELS rather than METERS. We say the character is 3 ft so we divide 40 pixels by the equvalent amount of meters for 3ft which is .9144. so 40/.9144 to get what one pixel is in terms of meters. Left as a variable because this will probably be recalculated eventually.
|
||||||
|
const float g = 9.81*scale; // Gravity is inversed cause raylib uses top right corner as origin.
|
||||||
float obj_x = 100; // Starting X (pixels)
|
float obj_x = 100; // Starting X (pixels)
|
||||||
float obj_y = 100; // Starting Y (pixels)
|
float obj_y = 100; // Starting Y (pixels)
|
||||||
float obj_vel_x = 50; // Velocity X (pixels/second)
|
float obj_vel_x = 50; // Velocity X (pixels/second)
|
||||||
@@ -14,26 +23,26 @@ float rect_size = 40; // Size of the rectangle
|
|||||||
int main(void) {
|
int main(void) {
|
||||||
const int screenWidth = 800;
|
const int screenWidth = 800;
|
||||||
const int screenHeight = 600;
|
const int screenHeight = 600;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "Physics Engine - Falling Rectangle");
|
InitWindow(screenWidth, screenHeight, "WrldBox // ray.c");
|
||||||
SetTargetFPS(60); // 60 frames per second
|
SetTargetFPS(60); // 60 frames per second
|
||||||
|
|
||||||
float deltaTime = 0.0f;
|
float deltaTime = 0.0f;
|
||||||
bool isSimulating = true;
|
bool isSimulating = true;
|
||||||
|
|
||||||
printf(">= SIMULATION PARAMETERS =<\n");
|
printf(">= SIMULATION PARAMETERS =<\n");
|
||||||
printf("g= %f\nX= %.2f Y= %.2f GROUND_Y= %.2f\nVEL_X= %.2f VEL_Y= %.2f\n\n",
|
printf("g= %f\nX= %.2f Y= %.2f GROUND_Y= %.2f\nVEL_X= %.2f VEL_Y= %.2f\n\n",
|
||||||
g, obj_x, obj_y, ground_y, obj_vel_x, obj_vel_y);
|
g, obj_x, obj_y, ground_y, obj_vel_x, obj_vel_y);
|
||||||
|
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) {
|
||||||
// Calculate delta time (time since last frame)
|
// Calculate delta time (time since last frame)
|
||||||
deltaTime = GetFrameTime();
|
deltaTime = GetFrameTime();
|
||||||
|
|
||||||
// Control simulation with spacebar
|
// Control simulation with spacebar
|
||||||
if (IsKeyPressed(KEY_SPACE)) {
|
if (IsKeyPressed(KEY_SPACE)) {
|
||||||
isSimulating = !isSimulating;
|
isSimulating = !isSimulating;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset with R key
|
// Reset with R key
|
||||||
if (IsKeyPressed(KEY_R)) {
|
if (IsKeyPressed(KEY_R)) {
|
||||||
obj_x = 100;
|
obj_x = 100;
|
||||||
@@ -44,74 +53,74 @@ int main(void) {
|
|||||||
isSimulating = true;
|
isSimulating = true;
|
||||||
printf("\n>= SIMULATION RESET =<\n");
|
printf("\n>= SIMULATION RESET =<\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update physics if simulating and object is above ground
|
// Update physics if simulating and object is above ground
|
||||||
if (isSimulating && obj_y + rect_size/2 < ground_y) {
|
if (isSimulating && obj_y + rect_size/2 < ground_y) {
|
||||||
// Your original physics logic with deltaTime
|
// Your original physics logic with deltaTime
|
||||||
obj_vel_y += deltaTime * g; // v = u + at
|
obj_vel_y += deltaTime * g; // v = u + at
|
||||||
obj_y += obj_vel_y * deltaTime; // s = ut + 1/2 at^2 is handled by this
|
obj_y += obj_vel_y * deltaTime; // s = ut + 1/2 at^2 is handled by this
|
||||||
obj_x += obj_vel_x * deltaTime;
|
obj_x += obj_vel_x * deltaTime;
|
||||||
|
|
||||||
time_step += deltaTime;
|
time_step += deltaTime;
|
||||||
|
|
||||||
// Real-time console output (optional)
|
// Real-time console output (optional)
|
||||||
if ((int)(time_step * 60) % 30 == 0) { // Print every ~0.5 seconds
|
if ((int)(time_step * 60) % 30 == 0) { // Print every ~0.5 seconds
|
||||||
printf("\r[%.2fs] X: %.2f Y: %.2f VEL_X: %.2f VEL_Y: %.2f",
|
printf("\r[%.2fs] X: %.2f Y: %.2f VEL_X: %.2f VEL_Y: %.2f",
|
||||||
time_step, obj_x, obj_y, obj_vel_x, obj_vel_y);
|
time_step, obj_x, obj_y, obj_vel_x, obj_vel_y);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clamp to ground (prevent going through)
|
// Clamp to ground (prevent going through)
|
||||||
if (obj_y + rect_size/2 >= ground_y) {
|
if (obj_y + rect_size/2 >= ground_y) {
|
||||||
obj_y = ground_y - rect_size/2;
|
obj_y = ground_y - rect_size/2;
|
||||||
if (isSimulating) {
|
if (isSimulating) {
|
||||||
printf("\n\n>= Object Hit Ground =<\n");
|
printf("\n\n>= Object Hit Ground =<\n");
|
||||||
printf("X: %.2f, Y: %.2f, VEL_X: %.2f, VEL_Y: %.2f TIME: %.2f\n",
|
printf("X: %.2f, Y: %.2f, VEL_X: %.2f, VEL_Y: %.2f TIME: %.2f\n",
|
||||||
obj_x, obj_y, obj_vel_x, obj_vel_y, time_step);
|
obj_x, obj_y, obj_vel_x, obj_vel_y, time_step);
|
||||||
isSimulating = false;
|
isSimulating = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keep rectangle in screen bounds horizontally
|
// Keep rectangle in screen bounds horizontally
|
||||||
if (obj_x - rect_size/2 < 0) obj_x = rect_size/2;
|
if (obj_x - rect_size/2 < 0) obj_x = rect_size/2;
|
||||||
if (obj_x + rect_size/2 > screenWidth) obj_x = screenWidth - rect_size/2;
|
if (obj_x + rect_size/2 > screenWidth) obj_x = screenWidth - rect_size/2;
|
||||||
|
|
||||||
// Drawing
|
// Drawing
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
// Draw ground line
|
// Draw ground line
|
||||||
DrawLine(0, ground_y, screenWidth, ground_y, DARKGRAY);
|
DrawLine(0, ground_y, screenWidth, ground_y, DARKGRAY);
|
||||||
|
|
||||||
// Draw ground label
|
// Draw ground label
|
||||||
DrawText("GROUND", 10, ground_y + 5, 20, DARKGRAY);
|
DrawText("GROUND", 10, ground_y + 5, 20, DARKGRAY);
|
||||||
|
|
||||||
// Draw the falling rectangle
|
// Draw the falling rectangle
|
||||||
Rectangle rect = { obj_x - rect_size/2, obj_y - rect_size/2, rect_size, rect_size };
|
Rectangle rect = { obj_x - rect_size/2, obj_y - rect_size/2, rect_size, rect_size };
|
||||||
DrawRectangleRec(rect, RED);
|
DrawRectangleRec(rect, RED);
|
||||||
DrawRectangleLinesEx(rect, 2, MAROON);
|
DrawRectangleLinesEx(rect, 2, MAROON);
|
||||||
|
|
||||||
// Draw info text
|
// Draw info text
|
||||||
DrawText(TextFormat("Time: %.2f s", time_step), 10, 10, 20, DARKGRAY);
|
DrawText(TextFormat("Time: %.2f s", time_step), 10, 10, 20, DARKGRAY);
|
||||||
DrawText(TextFormat("Position: (%.1f, %.1f)", obj_x, obj_y), 10, 35, 20, DARKGRAY);
|
DrawText(TextFormat("Position: (%.1f, %.1f)", obj_x, obj_y), 10, 35, 20, DARKGRAY);
|
||||||
DrawText(TextFormat("Velocity: (%.1f, %.1f)", obj_vel_x, obj_vel_y), 10, 60, 20, DARKGRAY);
|
DrawText(TextFormat("Velocity: (%.1f, %.1f)", obj_vel_x, obj_vel_y), 10, 60, 20, DARKGRAY);
|
||||||
DrawText(TextFormat("Status: %s", isSimulating ? "SIMULATING" : "PAUSED"), 10, 85, 20, isSimulating ? GREEN : RED);
|
DrawText(TextFormat("Status: %s", isSimulating ? "SIMULATING" : "PAUSED"), 10, 85, 20, isSimulating ? GREEN : RED);
|
||||||
|
|
||||||
// Draw controls help
|
// Draw controls help
|
||||||
DrawText("Controls:", screenWidth - 200, 10, 20, DARKGRAY);
|
DrawText("Controls:", screenWidth - 200, 10, 20, DARKGRAY);
|
||||||
DrawText("SPACE: Pause/Resume", screenWidth - 200, 35, 15, DARKGRAY);
|
DrawText("SPACE: Pause/Resume", screenWidth - 200, 35, 15, DARKGRAY);
|
||||||
DrawText("R: Reset", screenWidth - 200, 55, 15, DARKGRAY);
|
DrawText("R: Reset", screenWidth - 200, 55, 15, DARKGRAY);
|
||||||
DrawText("ESC: Exit", screenWidth - 200, 75, 15, DARKGRAY);
|
DrawText("ESC: Exit", screenWidth - 200, 75, 15, DARKGRAY);
|
||||||
|
|
||||||
// Draw velocity vector (optional visualization)
|
// Draw velocity vector (optional visualization)
|
||||||
Vector2 velocityEnd = { obj_x + obj_vel_x * 0.1f, obj_y + obj_vel_y * 0.1f };
|
Vector2 velocityEnd = { obj_x + obj_vel_x * 0.1f, obj_y + obj_vel_y * 0.1f };
|
||||||
DrawLineEx((Vector2){obj_x, obj_y}, velocityEnd, 3, BLUE);
|
DrawLineEx((Vector2){obj_x, obj_y}, velocityEnd, 3, BLUE);
|
||||||
DrawText("Velocity Vector", obj_x + 5, obj_y - 10, 15, BLUE);
|
DrawText("Velocity Vector", obj_x + 5, obj_y - 10, 15, BLUE);
|
||||||
|
|
||||||
EndDrawing();
|
EndDrawing();
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
4
OLD/structure.txt
Normal file
4
OLD/structure.txt
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
launcher.c
|
||||||
|
render.c
|
||||||
|
character.c
|
||||||
|
physics.c
|
||||||
33
README.md
Normal file
33
README.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# WrldBox Sandbox Simulator
|
||||||
|
|
||||||
|
## 🧊Introduction
|
||||||
|
|
||||||
|
**WrldBox** is a work-in-progress sandbox simulator made by Team wholeworldcoding. It is currently in a pretty developed experimental stage.
|
||||||
|
|
||||||
|
It consists of several components:
|
||||||
|
|
||||||
|
- `src/main.c`, Main script. Takes all other src and actually renders the engine.
|
||||||
|
- `src/physics.c`, All the science & math crap. Ugh. (physics.h: exposes UpdateEntities function)
|
||||||
|
- `src/render.c`, Rendering of entities. Entities are currently limited to rectangles for... no particular reason. (render.h: exposes DrawEntities function)
|
||||||
|
- `src/player.c`, Player control scripting. (player.h: exposes UpdatePlayerControls function)
|
||||||
|
|
||||||
|
|
||||||
|
- More stuff in src. README in progress.
|
||||||
|
|
||||||
|
- OLD contains the original logic this came from.
|
||||||
|
|
||||||
|
This project *is* the next major `wholeworldcoding` project.
|
||||||
|
|
||||||
|
## 🛠️ Build and Compile
|
||||||
|
|
||||||
|
Clone the repository. Once you have navigated to the folder, you can run:
|
||||||
|
|
||||||
|
- `make`
|
||||||
|
|
||||||
|
## 🌳 This Branch
|
||||||
|
|
||||||
|
This is the branch for the cube-based RPG.
|
||||||
|
|
||||||
|
## 🏅Credits
|
||||||
|
|
||||||
|
This project was impossible without the support of all three `wholeworldcoding` members.
|
||||||
13
home/p7mj/idea.txt
Normal file
13
home/p7mj/idea.txt
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
Develop a particular branch of this game into a RPG with a storyline and characters as cubes.
|
||||||
|
|
||||||
|
So the storyline I can think of now is:
|
||||||
|
|
||||||
|
You are a cube (pick name w/o numbers or symbols, and color)
|
||||||
|
|
||||||
|
You are in school
|
||||||
|
|
||||||
|
You like another cube, but the cube likes someone else
|
||||||
|
|
||||||
|
they get together and u get angry, first few missions is sabotage daily life of the other cube's xxxfriend
|
||||||
|
|
||||||
|
then it evolves into all out war
|
||||||
21
src/config.h
Normal file
21
src/config.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#define MAX_ENTITIES 512
|
||||||
|
|
||||||
|
extern const float scale;
|
||||||
|
extern const float g;
|
||||||
|
|
||||||
|
extern const float PLAYER_FORCE;
|
||||||
|
extern const float JUMP_FORCE;
|
||||||
|
|
||||||
|
extern const float AIR_DRAG;
|
||||||
|
|
||||||
|
extern const float GROUND_FRICTION;
|
||||||
|
extern const float MAX_PLAYER_SPEED;
|
||||||
|
|
||||||
|
extern const float BOUNCE;
|
||||||
|
|
||||||
|
extern const float ground_y;
|
||||||
|
|
||||||
|
#endif
|
||||||
10
src/docprogress.txt
Normal file
10
src/docprogress.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
main.c - Done
|
||||||
|
physics.c - Done, refine later
|
||||||
|
physics.h - Done
|
||||||
|
render.c - Done
|
||||||
|
render.h - Done
|
||||||
|
player.c - Done
|
||||||
|
player.h - Done
|
||||||
|
world.c
|
||||||
|
world.h
|
||||||
|
config.h
|
||||||
26
src/entity.h
Normal file
26
src/entity.h
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
#ifndef ENTITY_H
|
||||||
|
#define ENTITY_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
typedef struct Entity
|
||||||
|
{
|
||||||
|
bool active;
|
||||||
|
|
||||||
|
bool isPlayer;
|
||||||
|
bool affectedByGravity;
|
||||||
|
|
||||||
|
float mass;
|
||||||
|
float size;
|
||||||
|
|
||||||
|
Vector2 position;
|
||||||
|
Vector2 velocity;
|
||||||
|
Vector2 acceleration;
|
||||||
|
Vector2 force;
|
||||||
|
|
||||||
|
Color color;
|
||||||
|
|
||||||
|
} Entity;
|
||||||
|
|
||||||
|
#endif
|
||||||
185
src/main.c
Normal file
185
src/main.c
Normal file
@@ -0,0 +1,185 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
// add all the shit from the other shit
|
||||||
|
#include "raylib.h"
|
||||||
|
#include "world.h"
|
||||||
|
#include "physics.h"
|
||||||
|
#include "player.h"
|
||||||
|
#include "render.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
// Let's make a window
|
||||||
|
const int screenWidth = 1000;
|
||||||
|
const int screenHeight = 600;
|
||||||
|
|
||||||
|
InitWindow(
|
||||||
|
screenWidth,
|
||||||
|
screenHeight,
|
||||||
|
"WrldBox Sandbox");
|
||||||
|
|
||||||
|
SetTargetFPS(60);
|
||||||
|
|
||||||
|
InitWorld(); // from world.h
|
||||||
|
|
||||||
|
printf("WrldBox engine started\n");
|
||||||
|
printf("Gravity = %.2f\n", g);
|
||||||
|
|
||||||
|
while (!WindowShouldClose())
|
||||||
|
{
|
||||||
|
|
||||||
|
// Calculate delta time for consistent performace across different FPSes
|
||||||
|
float dt = GetFrameTime();
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_P))
|
||||||
|
{
|
||||||
|
// Toggle simulation
|
||||||
|
isSimulating = !isSimulating;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_R))
|
||||||
|
{
|
||||||
|
// VERY complicated reset logic
|
||||||
|
InitWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsKeyPressed(KEY_Q))
|
||||||
|
{
|
||||||
|
// Test feature: spawn random cube
|
||||||
|
SpawnEntity(
|
||||||
|
GetRandomValue(50, 950),
|
||||||
|
GetRandomValue(20, 150),
|
||||||
|
GetRandomValue(15, 45),
|
||||||
|
1.0f,
|
||||||
|
(Color)
|
||||||
|
{
|
||||||
|
GetRandomValue(50,255),
|
||||||
|
GetRandomValue(50,255),
|
||||||
|
GetRandomValue(50,255),
|
||||||
|
255
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsMouseButtonPressed(MOUSE_BUTTON_LEFT))
|
||||||
|
{
|
||||||
|
// Spawn cube where the mouse is when it clicks!
|
||||||
|
Vector2 m = GetMousePosition();
|
||||||
|
|
||||||
|
SpawnEntity(
|
||||||
|
m.x,
|
||||||
|
m.y,
|
||||||
|
25,
|
||||||
|
1.0f,
|
||||||
|
ORANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isSimulating)
|
||||||
|
{
|
||||||
|
// allow player to be controlled, fit everything within the size of the screen
|
||||||
|
UpdatePlayerControls();
|
||||||
|
UpdateEntities(dt, screenWidth);
|
||||||
|
|
||||||
|
simTime += dt;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UI shenanigans
|
||||||
|
BeginDrawing();
|
||||||
|
|
||||||
|
ClearBackground(RAYWHITE);
|
||||||
|
|
||||||
|
// Ground line
|
||||||
|
DrawLine(
|
||||||
|
0,
|
||||||
|
(int)ground_y,
|
||||||
|
screenWidth,
|
||||||
|
(int)ground_y,
|
||||||
|
DARKGRAY);
|
||||||
|
|
||||||
|
// Ground Text
|
||||||
|
DrawText(
|
||||||
|
"GROUND",
|
||||||
|
10,
|
||||||
|
(int)ground_y + 5,
|
||||||
|
20,
|
||||||
|
DARKGRAY);
|
||||||
|
|
||||||
|
DrawEntities(); // from render.c
|
||||||
|
|
||||||
|
DrawRectangle( // title box
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
screenWidth,
|
||||||
|
120,
|
||||||
|
Fade(LIGHTGRAY, 0.4f));
|
||||||
|
|
||||||
|
DrawText(
|
||||||
|
"WRLDBOX SANDBOX",
|
||||||
|
10,
|
||||||
|
10,
|
||||||
|
28,
|
||||||
|
BLACK);
|
||||||
|
|
||||||
|
DrawText(
|
||||||
|
TextFormat("Time: %.2f", simTime),
|
||||||
|
10,
|
||||||
|
45,
|
||||||
|
20,
|
||||||
|
BLACK);
|
||||||
|
|
||||||
|
DrawText(
|
||||||
|
TextFormat("Entities: %d",
|
||||||
|
CountEntities()),
|
||||||
|
10,
|
||||||
|
70,
|
||||||
|
20,
|
||||||
|
BLACK);
|
||||||
|
|
||||||
|
|
||||||
|
// if player exists, draw position and velocity
|
||||||
|
if (player)
|
||||||
|
{
|
||||||
|
DrawText(
|
||||||
|
TextFormat(
|
||||||
|
"Player Pos: %.1f %.1f",
|
||||||
|
player->position.x,
|
||||||
|
player->position.y),
|
||||||
|
250,
|
||||||
|
45,
|
||||||
|
20,
|
||||||
|
BLACK);
|
||||||
|
|
||||||
|
DrawText(
|
||||||
|
TextFormat(
|
||||||
|
"Player Vel: %.1f %.1f",
|
||||||
|
player->velocity.x,
|
||||||
|
player->velocity.y),
|
||||||
|
250,
|
||||||
|
70,
|
||||||
|
20,
|
||||||
|
BLACK);
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawText(
|
||||||
|
isSimulating ?
|
||||||
|
"SIMULATING" :
|
||||||
|
"PAUSED",
|
||||||
|
850,
|
||||||
|
15,
|
||||||
|
25,
|
||||||
|
isSimulating ?
|
||||||
|
GREEN :
|
||||||
|
RED);
|
||||||
|
|
||||||
|
DrawText("A/D = Move", 700, 45, 18, BLACK);
|
||||||
|
DrawText("SPACE = Jump", 700, 65, 18, BLACK);
|
||||||
|
DrawText("LMB = Spawn Cube", 700, 85, 18, BLACK);
|
||||||
|
DrawText("Q = Random Cube", 700, 105, 18, BLACK);
|
||||||
|
DrawText("P = Pause | R = Reset", 700, 125, 18, BLACK);
|
||||||
|
|
||||||
|
EndDrawing(); // end the current draw loop
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point the window was closed
|
||||||
|
CloseWindow();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
132
src/physics.c
Normal file
132
src/physics.c
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
#include <math.h>
|
||||||
|
// better hope you were paying attention in physics class for this one
|
||||||
|
#include "physics.h"
|
||||||
|
#include "world.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
// Main physics update loop for all entities
|
||||||
|
void UpdateEntities(float dt, int screenWidth)
|
||||||
|
{
|
||||||
|
// Iterate through all possible entities
|
||||||
|
for (int i = 0; i < MAX_ENTITIES; i++)
|
||||||
|
{
|
||||||
|
Entity *e = &entities[i];
|
||||||
|
|
||||||
|
// Skip inactive entities
|
||||||
|
if (!e->active)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Check if entity is currently touching the ground
|
||||||
|
// YOU'RE GROUNDED!!! lol
|
||||||
|
bool onGround = IsGrounded(e);
|
||||||
|
|
||||||
|
// Apply gravity force if enabled for this entity
|
||||||
|
if (e->affectedByGravity)
|
||||||
|
{
|
||||||
|
ApplyForce(
|
||||||
|
e,
|
||||||
|
(Vector2){0, e->mass * g}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compute acceleration from accumulated forces (F = ma)
|
||||||
|
e->acceleration.x =
|
||||||
|
e->force.x / e->mass;
|
||||||
|
|
||||||
|
e->acceleration.y =
|
||||||
|
e->force.y / e->mass;
|
||||||
|
|
||||||
|
// Integrate velocity from acceleration
|
||||||
|
e->velocity.x +=
|
||||||
|
e->acceleration.x * dt;
|
||||||
|
|
||||||
|
e->velocity.y +=
|
||||||
|
e->acceleration.y * dt;
|
||||||
|
|
||||||
|
// Apply air drag to slow movement over time
|
||||||
|
e->velocity.x *= AIR_DRAG;
|
||||||
|
e->velocity.y *= AIR_DRAG;
|
||||||
|
|
||||||
|
// Apply ground friction when on the ground
|
||||||
|
if (onGround)
|
||||||
|
{
|
||||||
|
if (e->velocity.x > 0)
|
||||||
|
{
|
||||||
|
e->velocity.x -=
|
||||||
|
GROUND_FRICTION * dt;
|
||||||
|
|
||||||
|
if (e->velocity.x < 0)
|
||||||
|
e->velocity.x = 0;
|
||||||
|
}
|
||||||
|
else if (e->velocity.x < 0)
|
||||||
|
{
|
||||||
|
e->velocity.x +=
|
||||||
|
GROUND_FRICTION * dt;
|
||||||
|
|
||||||
|
if (e->velocity.x > 0)
|
||||||
|
e->velocity.x = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clamp player horizontal speed
|
||||||
|
if (e->isPlayer)
|
||||||
|
{
|
||||||
|
if (e->velocity.x > MAX_PLAYER_SPEED)
|
||||||
|
e->velocity.x = MAX_PLAYER_SPEED;
|
||||||
|
|
||||||
|
if (e->velocity.x < -MAX_PLAYER_SPEED)
|
||||||
|
e->velocity.x = -MAX_PLAYER_SPEED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Integrate position from velocity
|
||||||
|
e->position.x +=
|
||||||
|
e->velocity.x * dt;
|
||||||
|
|
||||||
|
e->position.y +=
|
||||||
|
e->velocity.y * dt;
|
||||||
|
|
||||||
|
// Reset forces after integration step
|
||||||
|
e->force = (Vector2){0, 0};
|
||||||
|
|
||||||
|
// Ground collision
|
||||||
|
if (e->position.y +
|
||||||
|
e->size * 0.5f >=
|
||||||
|
ground_y)
|
||||||
|
{
|
||||||
|
e->position.y =
|
||||||
|
ground_y -
|
||||||
|
e->size * 0.5f;
|
||||||
|
|
||||||
|
e->velocity.y *=
|
||||||
|
-BOUNCE;
|
||||||
|
|
||||||
|
// Stop tiny bounces... or at least, attempt to.
|
||||||
|
if (fabsf(e->velocity.y) < 15.0f)
|
||||||
|
{
|
||||||
|
e->velocity.y = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Left wall collision
|
||||||
|
if (e->position.x -
|
||||||
|
e->size * 0.5f < 0)
|
||||||
|
{
|
||||||
|
e->position.x =
|
||||||
|
e->size * 0.5f;
|
||||||
|
|
||||||
|
e->velocity.x *= -0.6f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Right wall collision
|
||||||
|
if (e->position.x +
|
||||||
|
e->size * 0.5f >
|
||||||
|
screenWidth)
|
||||||
|
{
|
||||||
|
e->position.x =
|
||||||
|
screenWidth -
|
||||||
|
e->size * 0.5f;
|
||||||
|
|
||||||
|
e->velocity.x *= -0.6f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
src/physics.h
Normal file
9
src/physics.h
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#ifndef PHYSICS_H
|
||||||
|
#define PHYSICS_H
|
||||||
|
|
||||||
|
// FUNction declaration! yay!!!
|
||||||
|
// used by main script to update entities as time goes on
|
||||||
|
// i don't think it's used anywhere else, but double check me
|
||||||
|
void UpdateEntities(float dt, int screenWidth);
|
||||||
|
|
||||||
|
#endif
|
||||||
55
src/player.c
Normal file
55
src/player.c
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
#include "player.h"
|
||||||
|
|
||||||
|
#include "world.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
|
||||||
|
// let's a go!
|
||||||
|
float curhorvel=0.0f; //current horizonatal velocity
|
||||||
|
void UpdatePlayerControls(void)
|
||||||
|
{
|
||||||
|
// if there isn't a player, you probably can't do much
|
||||||
|
if (!player){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(curhorvel==0.0f){
|
||||||
|
curhorvel=10.0f*scale;
|
||||||
|
}
|
||||||
|
// if a key pressed, push player to the left
|
||||||
|
if (IsKeyDown(KEY_A))
|
||||||
|
{
|
||||||
|
if(curhorvel<PMV){
|
||||||
|
curhorvel=curhorvel*PLAYER_SPEED_FACTOR;
|
||||||
|
}
|
||||||
|
ApplyForce(
|
||||||
|
player,
|
||||||
|
(Vector2){-curhorvel, 0}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
// if d key pressed, push player to the right
|
||||||
|
else if (IsKeyDown(KEY_D))
|
||||||
|
{
|
||||||
|
if(curhorvel<=PMV){
|
||||||
|
curhorvel=curhorvel*PLAYER_SPEED_FACTOR;
|
||||||
|
}
|
||||||
|
ApplyForce(
|
||||||
|
player,
|
||||||
|
(Vector2){curhorvel, 0}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
curhorvel=10.0f*scale;
|
||||||
|
}
|
||||||
|
// if sspace key pressed (and player isn't already jumping), push player
|
||||||
|
if (IsGrounded(player) &&
|
||||||
|
IsKeyPressed(KEY_SPACE))
|
||||||
|
{
|
||||||
|
player->velocity.y = 0;
|
||||||
|
|
||||||
|
ApplyForce(
|
||||||
|
player,
|
||||||
|
(Vector2){0, -JUMP_FORCE}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
8
src/player.h
Normal file
8
src/player.h
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#ifndef PLAYER_H
|
||||||
|
#define PLAYER_H
|
||||||
|
|
||||||
|
// FUNction declaration! yay!!!
|
||||||
|
// run by main.c constantly to allow player input.
|
||||||
|
void UpdatePlayerControls(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
38
src/render.c
Normal file
38
src/render.c
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#include "render.h"
|
||||||
|
#include "world.h"
|
||||||
|
|
||||||
|
#include "raylib.h"
|
||||||
|
// Take entities, put em on the screen. Basic rendering file. Our entities are just rectangles, which we should lowkey fix... but uh... that's a problem for LATER...
|
||||||
|
void DrawEntities(void)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MAX_ENTITIES; i++)
|
||||||
|
{
|
||||||
|
Entity *e = &entities[i];
|
||||||
|
|
||||||
|
if (!e->active)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Rectangle rect =
|
||||||
|
{
|
||||||
|
e->position.x - e->size * 0.5f,
|
||||||
|
e->position.y - e->size * 0.5f,
|
||||||
|
e->size,
|
||||||
|
e->size
|
||||||
|
};
|
||||||
|
|
||||||
|
DrawRectangleRec(rect, e->color);
|
||||||
|
DrawRectangleLinesEx(rect, 2, BLACK);
|
||||||
|
|
||||||
|
Vector2 velEnd =
|
||||||
|
{
|
||||||
|
e->position.x + e->velocity.x * 0.10f,
|
||||||
|
e->position.y + e->velocity.y * 0.10f
|
||||||
|
};
|
||||||
|
|
||||||
|
DrawLineEx(
|
||||||
|
e->position,
|
||||||
|
velEnd,
|
||||||
|
2,
|
||||||
|
DARKBLUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
7
src/render.h
Normal file
7
src/render.h
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#ifndef RENDER_H
|
||||||
|
#define RENDER_H
|
||||||
|
// FUNction declaration! yay!!!
|
||||||
|
// Make an entity! Once again, pretty sure this is must used in main.c
|
||||||
|
void DrawEntities(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
140
src/world.c
Normal file
140
src/world.c
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
#include <stddef.h>
|
||||||
|
#include "world.h"
|
||||||
|
|
||||||
|
// the beeg one. hooooooooooooooooh boy
|
||||||
|
|
||||||
|
const float scale = 43.7445319335f;
|
||||||
|
const float g = 9.81f * scale;
|
||||||
|
|
||||||
|
const float PMV = 10000.0*scale; //Player Max Velocity
|
||||||
|
const float PLAYER_SPEED_FACTOR =1.3f;
|
||||||
|
const float JUMP_FORCE = 300.0f*scale;
|
||||||
|
|
||||||
|
const float AIR_DRAG = 0.999f;
|
||||||
|
|
||||||
|
const float GROUND_FRICTION = 1200.0f;
|
||||||
|
const float MAX_PLAYER_SPEED = 300.0f;
|
||||||
|
|
||||||
|
const float BOUNCE = 0.45f;
|
||||||
|
|
||||||
|
const float ground_y = 550.0f;
|
||||||
|
|
||||||
|
Entity entities[MAX_ENTITIES];
|
||||||
|
|
||||||
|
Entity *player = NULL;
|
||||||
|
|
||||||
|
bool isSimulating = true;
|
||||||
|
|
||||||
|
float simTime = 0.0f;
|
||||||
|
|
||||||
|
void ApplyForce(Entity *e, Vector2 force)
|
||||||
|
{
|
||||||
|
if (!e || !e->active)
|
||||||
|
return;
|
||||||
|
|
||||||
|
e->force.x += force.x;
|
||||||
|
e->force.y += force.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsGrounded(Entity *e)
|
||||||
|
{
|
||||||
|
if (!e)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (
|
||||||
|
e->position.y +
|
||||||
|
e->size * 0.5f >=
|
||||||
|
ground_y - 2.0f
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity *SpawnEntity(
|
||||||
|
float x,
|
||||||
|
float y,
|
||||||
|
float size,
|
||||||
|
float mass,
|
||||||
|
Color color)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MAX_ENTITIES; i++)
|
||||||
|
{
|
||||||
|
if (!entities[i].active)
|
||||||
|
{
|
||||||
|
Entity *e = &entities[i];
|
||||||
|
|
||||||
|
e->active = true;
|
||||||
|
|
||||||
|
e->isPlayer = false;
|
||||||
|
e->affectedByGravity = true;
|
||||||
|
|
||||||
|
e->mass = mass;
|
||||||
|
e->size = size;
|
||||||
|
|
||||||
|
e->position = (Vector2){x, y};
|
||||||
|
e->velocity = (Vector2){0, 0};
|
||||||
|
e->acceleration = (Vector2){0, 0};
|
||||||
|
e->force = (Vector2){0, 0};
|
||||||
|
|
||||||
|
e->color = color;
|
||||||
|
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
// say bye bye to EVERYTHINGGGG AHAHAHAHAHAAH
|
||||||
|
// im a little mad with power
|
||||||
|
// this is literally just a helper function to clear the entities and player
|
||||||
|
void ClearWorld(void)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MAX_ENTITIES; i++)
|
||||||
|
{
|
||||||
|
entities[i].active = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
player = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// used in main.c to start the actual engine behaviors. spawns the player, and a few other boxes for funsies.
|
||||||
|
void InitWorld(void)
|
||||||
|
{
|
||||||
|
ClearWorld();
|
||||||
|
|
||||||
|
player = SpawnEntity(
|
||||||
|
120,
|
||||||
|
120,
|
||||||
|
40,
|
||||||
|
1.0f,
|
||||||
|
BLUE);
|
||||||
|
|
||||||
|
if (player)
|
||||||
|
{
|
||||||
|
player->isPlayer = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
SpawnEntity(
|
||||||
|
300 + i * 50,
|
||||||
|
50,
|
||||||
|
25,
|
||||||
|
1.0f,
|
||||||
|
RED);
|
||||||
|
}
|
||||||
|
|
||||||
|
simTime = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// helper function: count number of entities. Something somewhere uses this. I think it's probably for entity counting. Don't quote me on that.
|
||||||
|
int CountEntities(void)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < MAX_ENTITIES; i++)
|
||||||
|
{
|
||||||
|
if (entities[i].active)
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
34
src/world.h
Normal file
34
src/world.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
#ifndef WORLD_H
|
||||||
|
#define WORLD_H
|
||||||
|
|
||||||
|
#include "entity.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
extern Entity entities[MAX_ENTITIES];
|
||||||
|
|
||||||
|
extern Entity *player;
|
||||||
|
|
||||||
|
extern bool isSimulating;
|
||||||
|
|
||||||
|
extern float simTime;
|
||||||
|
|
||||||
|
extern const float PMV;
|
||||||
|
|
||||||
|
extern const float PLAYER_SPEED_FACTOR;
|
||||||
|
|
||||||
|
void ApplyForce(Entity *e, Vector2 force);
|
||||||
|
bool IsGrounded(Entity *e);
|
||||||
|
|
||||||
|
Entity *SpawnEntity(
|
||||||
|
float x,
|
||||||
|
float y,
|
||||||
|
float size,
|
||||||
|
float mass,
|
||||||
|
Color color);
|
||||||
|
|
||||||
|
void ClearWorld(void);
|
||||||
|
void InitWorld(void);
|
||||||
|
|
||||||
|
int CountEntities(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user