This commit is contained in:
Casey 2022-10-16 13:44:53 +03:00
parent 308a985519
commit e3fe9136e5
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
4 changed files with 3276 additions and 4 deletions

1
CREDITS Normal file
View File

@ -0,0 +1 @@
Rat model (assets/rat.obj): https://www.turbosquid.com/3d-models/maya-rat-games/611560

View File

@ -1,7 +1,10 @@
CFLAGS +=
LDFLAGS := -lm
LDFLAGS := -lraylib
OBJECTS :=
run: cyber-rat
./cyber-rat
cyber-rat: lib
$(CC) $(CFLAGS) $(OBJECTS) src/main.c $(LDFLAGS) -o cyber-rat

3230
assets/rat.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,44 @@
#include <stdio.h>
#include <math.h>
// x-run: make -C.. clean run
#include <raylib.h>
#include <rlgl.h>
#include <raymath.h>
int main(void) {
printf("Hi!\n");
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
InitWindow(800, 600, "c y b e r r a t");
SetTargetFPS(60);
Camera3D camera = {
.projection = CAMERA_PERSPECTIVE,
.fovy = 60.,
.position.x = 20.0,
.position.y = 20.0,
.position.z = 20.0,
.target.x = 0.0,
.target.y = 0.0,
.target.z = 0.0,
.up.x = 0.0,
.up.y = 1.0,
.up.z = 0.0,
};
SetCameraMode(camera, CAMERA_ORBITAL);
Model mod_rat = LoadModel("assets/rat.obj");
BoundingBox bbox_rat = GetModelBoundingBox(mod_rat);
for (int frame = 0; !WindowShouldClose(); frame++) {
UpdateCamera(&camera);
BeginDrawing();
{
ClearBackground(BLANK);
BeginMode3D(camera);
DrawGrid(10, 1.0);
rlDisableBackfaceCulling();
DrawModelWires(mod_rat, Vector3Zero(), 0.05, RED);
rlEnableBackfaceCulling();
EndMode3D();
}
EndDrawing();
}
}