added anti aliasing. new fps game
This commit is contained in:
parent
798434a55d
commit
7b73c86113
40 changed files with 2386 additions and 564 deletions
|
|
@ -5,6 +5,10 @@
|
|||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
// Include GC header for TypeInfo
|
||||
#include "suicmez_gc.h"
|
||||
|
||||
// Raylib support
|
||||
#include "raylib.h"
|
||||
|
|
@ -52,11 +56,43 @@ static inline suic_vec3 suic_from_rl_vec3(Vector3 v) {
|
|||
return (suic_vec3){v.x, v.y, v.z};
|
||||
}
|
||||
|
||||
// Keyboard key constants (from raylib)
|
||||
#define KEY_W 87
|
||||
#define KEY_A 65
|
||||
#define KEY_S 83
|
||||
#define KEY_D 68
|
||||
#define KEY_SPACE 32
|
||||
#define KEY_LEFT_SHIFT 341
|
||||
#define KEY_LEFT_CTRL 341 // Platform dependent
|
||||
#define KEY_LEFT_ALT 342
|
||||
#define KEY_UP 265
|
||||
#define KEY_DOWN 264
|
||||
#define KEY_LEFT 263
|
||||
#define KEY_RIGHT 262
|
||||
#define KEY_ESCAPE 256
|
||||
#define KEY_ENTER 257
|
||||
#define KEY_TAB 258
|
||||
#define KEY_BACKSPACE 259
|
||||
#define KEY_DELETE 261
|
||||
#define KEY_HOME 268
|
||||
#define KEY_END 269
|
||||
#define KEY_EQUAL 61
|
||||
#define KEY_MINUS 45
|
||||
#define KEY_KP_ADD 334
|
||||
#define KEY_KP_SUBTRACT 333
|
||||
#define KEY_F1 290
|
||||
|
||||
// Mouse button constants
|
||||
#define MOUSE_LEFT 0
|
||||
#define MOUSE_RIGHT 1
|
||||
#define MOUSE_MIDDLE 2
|
||||
|
||||
// Window management
|
||||
bool suic_init_window(int width, int height, const char *title);
|
||||
void suic_close_window(void);
|
||||
bool suic_window_should_close(void);
|
||||
void suic_set_target_fps(int fps);
|
||||
void suic_enable_msaa_4x(void);
|
||||
|
||||
// Drawing (2D)
|
||||
void suic_begin_drawing(void);
|
||||
|
|
@ -80,10 +116,37 @@ void suic_end_mode3d(void);
|
|||
void suic_draw_cube(float x, float y, float z, float width, float height, float length, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
|
||||
void suic_draw_cube_wires(float x, float y, float z, float width, float height, float length, unsigned char r, unsigned char g, unsigned char b, unsigned char a);
|
||||
|
||||
// Input
|
||||
// Input - Keyboard
|
||||
bool suic_is_key_down(int key);
|
||||
bool suic_is_key_pressed(int key);
|
||||
bool suic_is_key_released(int key);
|
||||
|
||||
// Input - Mouse
|
||||
bool suic_is_mouse_button_down(int b);
|
||||
bool suic_is_mouse_button_pressed(int b);
|
||||
bool suic_is_mouse_button_released(int b);
|
||||
suic_vec2 suic_get_mouse_position(void);
|
||||
suic_vec2 suic_get_mouse_delta(void);
|
||||
float suic_get_mouse_x(void);
|
||||
float suic_get_mouse_y(void);
|
||||
float suic_get_mouse_delta_x(void);
|
||||
float suic_get_mouse_delta_y(void);
|
||||
|
||||
// Input - Helper functions for gamedev
|
||||
int suic_is_movement_input(void); // Returns bitmask: 1=W, 2=A, 4=S, 8=D
|
||||
int suic_is_sprint_held(void);
|
||||
int suic_is_jump_pressed(void);
|
||||
|
||||
// Cursor management
|
||||
void suic_disable_cursor(void);
|
||||
void suic_enable_cursor(void);
|
||||
bool suic_is_cursor_hidden(void);
|
||||
|
||||
// Matrix operations for 3D transformations
|
||||
void suic_rl_push_matrix(void);
|
||||
void suic_rl_pop_matrix(void);
|
||||
void suic_rl_translate_f(float x, float y, float z);
|
||||
void suic_rl_rotate_f(float angle, float x, float y, float z);
|
||||
|
||||
// Images and Textures
|
||||
typedef struct suic_image_handle {
|
||||
|
|
@ -119,10 +182,23 @@ void suic_sound_play(suic_sound_handle snd);
|
|||
void suic_sound_set_volume(suic_sound_handle snd, float volume);
|
||||
void suic_sound_free(suic_sound_handle *snd);
|
||||
|
||||
// Player controller for FPS-style movement
|
||||
typedef struct suic_player_controller {
|
||||
suic_vec3 position;
|
||||
suic_vec3 velocity;
|
||||
suic_vec3 forward; // Camera forward direction
|
||||
suic_vec3 right; // Camera right direction
|
||||
float move_speed;
|
||||
float sprint_speed;
|
||||
float jump_force;
|
||||
float gravity;
|
||||
int is_grounded;
|
||||
} suic_player_controller;
|
||||
|
||||
// Raycasting
|
||||
typedef struct suic_ray {
|
||||
suic_vec3 origin;
|
||||
suic_vec3 direction;
|
||||
suic_vec3 origin;
|
||||
suic_vec3 direction;
|
||||
} suic_ray;
|
||||
|
||||
typedef struct suic_rayhit {
|
||||
|
|
@ -230,4 +306,15 @@ void suic_game_object_set_velocity(suic_game_object* obj, float x, float y, floa
|
|||
void suic_game_object_get_velocity(suic_game_object* obj, float *x, float *y, float *z);
|
||||
void suic_game_object_draw(suic_game_object* obj);
|
||||
|
||||
// Player controller functions for FPS-style games
|
||||
suic_player_controller* suic_player_controller_create(float x, float y, float z);
|
||||
void suic_player_controller_destroy(suic_player_controller* player);
|
||||
void suic_player_controller_update(suic_player_controller* player, float delta_time);
|
||||
void suic_player_controller_set_direction(suic_player_controller* player, float forward_x, float forward_y, float forward_z, float right_x, float right_y, float right_z);
|
||||
void suic_player_controller_move_forward(suic_player_controller* player, float amount);
|
||||
void suic_player_controller_move_right(suic_player_controller* player, float amount);
|
||||
void suic_player_controller_jump(suic_player_controller* player);
|
||||
void suic_player_controller_get_position(suic_player_controller* player, float *x, float *y, float *z);
|
||||
void suic_player_controller_set_position(suic_player_controller* player, float x, float y, float z);
|
||||
|
||||
#endif // LIBSUICMEZ_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue