1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#include <raylib.h>
#include <rlgl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "gunner/config.h"
#include "gunner/utils.h"
#include "gunner/text.c"
#include "gunner/texture_sys.c"
#include "gunner/shader_sys.c"
#include "gunner/controller.c"
#include "gunner/rumble.c"
#include "gunner/rand_sys.c"
#include "gunner/audio_sys.c"
#include "game/config.h"
int main()
{
SetTraceLogLevel(LOG_WARNING);
InitWindow(GAME_WIDTH * DEFAULT_SCALE, GAME_HEIGHT * DEFAULT_SCALE, GAME_NAME);
SetTargetFPS(FRAMERATE);
InitAudioDevice();
rand_seed();
init_tex_sys();
init_shader_sys();
i32 idx = load_font("assets/fonts/berry-rotunda.fnt");
//load_music("assets/wicked_glee.ogg");
//set_music_loop_point(15.73f);
//play_music();
Model amanita = LoadModel("assets/models/amanita.m3d");
RenderTexture2D tex = LoadRenderTexture(320, 240);
Camera camera = { 0 };
camera.position = (Vector3){ 0.5f, .5f, 1.5f }; // Camera position
camera.target = (Vector3){ 0.0f, .5f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Shader psx = LoadShader("assets/shaders/ps1vert.vs", "assets/shaders/ps1frag.fs");
amanita.materials[1].shader = psx;
while(!WindowShouldClose()){
float dt = GetFrameTime();
poll_rumble(dt);
update_audio();
update_textures();
update_shaders();
ClearBackground(WHITE);
BeginDrawing();
BeginTextureMode(tex);
ClearBackground(WHITE);
BeginMode3D(camera);
rlDisableBackfaceCulling();
DrawModel(amanita, (Vector3){0.f, 0.f, 0.f}, 1.0f, WHITE);
rlEnableBackfaceCulling();
EndMode3D();
draw_text_font_centered(idx, "Amanita", 4.f, 18, BLACK);
EndTextureMode();
DrawTexturePro(tex.texture, (Rectangle){0, 0, 320, -240}, (Rectangle){0, 0, 640, 480}, (Vector2){0, 0}, 0.f, WHITE);
EndDrawing();
}
UnloadRenderTexture(tex);
UnloadShader(psx);
UnloadModel(amanita);
unload_all_fonts();
unload_active_audio();
unload_current_music();
unload_active_textures();
unload_active_shaders();
CloseAudioDevice();
CloseWindow();
return 0;
}
|