diff --git a/.gitignore b/.gitignore index cd6f64e..e943571 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ a.out *.mod *.log -build/ \ No newline at end of file +build/ +fortran/client/client diff --git a/common/docs/game_protocol.md b/common/docs/game_protocol.md new file mode 100644 index 0000000..ca73a6f --- /dev/null +++ b/common/docs/game_protocol.md @@ -0,0 +1,31 @@ +# game protocol + +This is the definition for all of the messages to be sent between client and server to do all the actions. + +* Action + - login + - logs the user in + - broadcast to all other clients that user logged in + - schema + - username: string + - appearance: string + - x_pos: float + - y_pos: float + - logout + - logs the user out + - broadcast to all other connected clients that user has logged out + - schema + - username: string + - move + - send to server + - server sends movement to all connected clients for that user + - schema + - username: string + - x_pos: float + - y_pos: float + - chat + - send message to server + - chat broadcast to all other connected clients + - schema + - username: string + - message: string diff --git a/fortran/client/main.f90 b/fortran/client/main.f90 index 2e5627e..06f1018 100644 --- a/fortran/client/main.f90 +++ b/fortran/client/main.f90 @@ -3,43 +3,84 @@ program main use raylib implicit none - integer(c_int) :: screenWidth = 800 - integer(c_int) :: screenHeight = 450 + integer(c_int) :: screen_width = 800 + integer(c_int) :: screen_height = 450 type(camera3d), target :: camera - type(c_ptr) :: camera_p + type(vector3) :: npc_position + type(vector3) :: player_position + real(c_float) :: npc_dir - call init_window(screenWidth, screenHeight, "fortran client : raylib"//c_null_char) + ! + ! implement a login and logout screen + ! https://www.raylib.com/examples/core/loader.html?name=core_basic_screen_manager + ! https://www.raylib.com/examples/text/loader.html?name=text_input_box + ! - camera%position = vector3(0.0_c_float, 2.0_c_float, 4.0_c_float) !Camera position - camera%target = vector3(0.0_c_float, 2.0_c_float, 0.0_c_float) !Camera looking at point - camera%up = vector3(0.0_c_float, -1.0_c_float, 0.0_c_float) !Camera up vector(rotation towards target) - camera%fovy = 60.0_c_float !Camera field - of - view Y + call init_window(screen_width, screen_height, "fortran client : raylib"//c_null_char) + + player_position = vector3( 0.0_c_float, 1.0_c_float, 2.0_c_float ) + npc_position = vector3( -4.0_c_float, 1.0_c_float, 0.0_c_float ) + npc_dir = 0.1_c_float + + camera%position = vector3(0.0_c_float, 10.0_c_float, 10.0_c_float) !Camera position + camera%target = vector3(0.0_c_float, 0.0_c_float, 0.0_c_float) !Camera looking at point + camera%up = vector3(0.0_c_float, 1.0_c_float, 0.0_c_float) !Camera up vector(rotation towards target) + camera%fovy = 45.0_c_float !Camera field - of - view Y camera%projection = CAMERA_PERSPECTIVE !Camera projection type - camera_p = c_loc(camera) - - call disable_cursor() call set_target_fps(60_c_int) !Main game loop do while (.not. window_should_close()) ! Detect window close button or ESC key - call update_camera(camera_p, CAMERA_THIRD_PERSON) ! Update camera + if (is_key_down(KEY_RIGHT)) then + player_position%x = player_position%x + 0.2_c_float + else if (is_key_down(KEY_LEFT)) then + player_position%x = player_position%x - 0.2_c_float + else if (is_key_down(KEY_DOWN)) then + player_position%z = player_position%z + 0.2_c_float + else if (is_key_down(KEY_UP)) then + player_position%z = player_position%z - 0.2_c_float + end if + + camera%position%x = player_position%x + camera%position%y = player_position%y + 10.0_c_float + camera%position%z = player_position%z + 10.0_c_float + camera%target%x = player_position%x + camera%target%y = player_position%y + camera%target%z = player_position%z + + if (npc_position%x < -10) then + npc_dir = 0.1_c_float + else if (npc_position%x > 10) then + npc_dir = -0.1_c_float + end if + npc_position%x = npc_position%x + npc_dir + + ! + ! implement a user input for texting + ! https://www.raylib.com/examples/text/loader.html?name=text_input_box + ! call begin_drawing() - call clear_background(RAYWHITE) + call clear_background(RAYWHITE) - call begin_mode_3d(camera) - call draw_plane(vector3(0.0_c_float, 0.0_c_float, 0.0_c_float), vector2(32.0_c_float, 32.0_c_float), LIGHTGRAY) !Draw ground - call draw_cube(vector3(-16.0_c_float, 2.5_c_float, 0.0_c_float), 1.0_c_float, 5.0_c_float, 32.0_c_float, BLUE) !Draw a blue wall - call draw_cube(vector3(16.0_c_float, 2.5_c_float, 0.0_c_float), 1.0_c_float, 5.0_c_float, 32.0_c_float, LIME) !Draw a green wall - call draw_cube(vector3(0.0_c_float, 2.5_c_float, 16.0_c_float), 32.0_c_float, 5.0_c_float, 1.0_c_float, GOLD) !Draw a yellow wall + call begin_mode_3d(camera) + ! Draw floor + call draw_grid(30_c_int, 1.0_c_float) - !Draw player cube - call draw_cube(camera%target, 0.5_c_float, 0.5_c_float, 0.5_c_float, PURPLE) - call draw_cube_wires(camera%target, 0.5_c_float, 0.5_c_float, 0.5_c_float, DARKPURPLE) - call end_mode_3d() + ! Draw user & others text over them + ! https://www.raylib.com/examples/text/loader.html?name=text_draw_3d + + !Draw npc cube + call draw_cube(npc_position, 0.5_c_float, 0.5_c_float, 0.5_c_float, GRAY) + call draw_cube_wires(npc_position, 0.5_c_float, 0.5_c_float, 0.5_c_float, DARKGRAY) + + !Draw player cube + call draw_cube(player_position, 0.5_c_float, 0.5_c_float, 0.5_c_float, PURPLE) + call draw_cube_wires(player_position, 0.5_c_float, 0.5_c_float, 0.5_c_float, DARKPURPLE) + call end_mode_3d() call end_drawing() end do diff --git a/fortran/client/raylib.f90 b/fortran/client/raylib.f90 index a6f0496..eae8b48 100644 --- a/fortran/client/raylib.f90 +++ b/fortran/client/raylib.f90 @@ -55,6 +55,287 @@ module raylib integer(c_int) :: projection end type + ! Keyboard keys + integer(c_int) :: KEY_NULL = 0 + ! Alphanumeric keys + integer(c_int) :: KEY_APOSTROPHE = 39 + integer(c_int) :: KEY_COMMA = 44 + integer(c_int) :: KEY_MINUS = 45 + integer(c_int) :: KEY_PERIOD = 46 + integer(c_int) :: KEY_SLASH = 47 + integer(c_int) :: KEY_ZERO = 48 + integer(c_int) :: KEY_ONE = 49 + integer(c_int) :: KEY_TWO = 50 + integer(c_int) :: KEY_THREE = 51 + integer(c_int) :: KEY_FOUR = 52 + integer(c_int) :: KEY_FIVE = 53 + integer(c_int) :: KEY_SIX = 54 + integer(c_int) :: KEY_SEVEN = 55 + integer(c_int) :: KEY_EIGHT = 56 + integer(c_int) :: KEY_NINE = 57 + integer(c_int) :: KEY_SEMICOLON = 59 + integer(c_int) :: KEY_EQUAL = 61 + integer(c_int) :: KEY_A = 65 + integer(c_int) :: KEY_B = 66 + integer(c_int) :: KEY_C = 67 + integer(c_int) :: KEY_D = 68 + integer(c_int) :: KEY_E = 69 + integer(c_int) :: KEY_F = 70 + integer(c_int) :: KEY_G = 71 + integer(c_int) :: KEY_H = 72 + integer(c_int) :: KEY_I = 73 + integer(c_int) :: KEY_J = 74 + integer(c_int) :: KEY_K = 75 + integer(c_int) :: KEY_L = 76 + integer(c_int) :: KEY_M = 77 + integer(c_int) :: KEY_N = 78 + integer(c_int) :: KEY_O = 79 + integer(c_int) :: KEY_P = 80 + integer(c_int) :: KEY_Q = 81 + integer(c_int) :: KEY_R = 82 + integer(c_int) :: KEY_S = 83 + integer(c_int) :: KEY_T = 84 + integer(c_int) :: KEY_U = 85 + integer(c_int) :: KEY_V = 86 + integer(c_int) :: KEY_W = 87 + integer(c_int) :: KEY_X = 88 + integer(c_int) :: KEY_Y = 89 + integer(c_int) :: KEY_Z = 90 + ! Function keys + integer(c_int) :: KEY_SPACE = 32 + integer(c_int) :: KEY_ESCAPE = 256 + integer(c_int) :: KEY_ENTER = 257 + integer(c_int) :: KEY_TAB = 258 + integer(c_int) :: KEY_BACKSPACE = 259 + integer(c_int) :: KEY_INSERT = 260 + integer(c_int) :: KEY_DELETE = 261 + integer(c_int) :: KEY_RIGHT = 262 + integer(c_int) :: KEY_LEFT = 263 + integer(c_int) :: KEY_DOWN = 264 + integer(c_int) :: KEY_UP = 265 + integer(c_int) :: KEY_PAGE_UP = 266 + integer(c_int) :: KEY_PAGE_DOWN = 267 + integer(c_int) :: KEY_HOME = 268 + integer(c_int) :: KEY_END = 269 + integer(c_int) :: KEY_CAPS_LOCK = 280 + integer(c_int) :: KEY_SCROLL_LOCK = 281 + integer(c_int) :: KEY_NUM_LOCK = 282 + integer(c_int) :: KEY_PRINT_SCREEN = 283 + integer(c_int) :: KEY_PAUSE = 284 + integer(c_int) :: KEY_F1 = 290 + integer(c_int) :: KEY_F2 = 291 + integer(c_int) :: KEY_F3 = 292 + integer(c_int) :: KEY_F4 = 293 + integer(c_int) :: KEY_F5 = 294 + integer(c_int) :: KEY_F6 = 295 + integer(c_int) :: KEY_F7 = 296 + integer(c_int) :: KEY_F8 = 297 + integer(c_int) :: KEY_F9 = 298 + integer(c_int) :: KEY_F10 = 299 + integer(c_int) :: KEY_F11 = 300 + integer(c_int) :: KEY_F12 = 301 + integer(c_int) :: KEY_LEFT_SHIFT = 340 + integer(c_int) :: KEY_LEFT_CONTROL = 341 + integer(c_int) :: KEY_LEFT_ALT = 342 + integer(c_int) :: KEY_LEFT_SUPER = 343 + integer(c_int) :: KEY_RIGHT_SHIFT = 344 + integer(c_int) :: KEY_RIGHT_CONTROL = 345 + integer(c_int) :: KEY_RIGHT_ALT = 346 + integer(c_int) :: KEY_RIGHT_SUPER = 347 + integer(c_int) :: KEY_KB_MENU = 348 + integer(c_int) :: KEY_LEFT_BRACKET = 91 + integer(c_int) :: KEY_BACKSLASH = 92 + integer(c_int) :: KEY_RIGHT_BRACKET = 93 + integer(c_int) :: KEY_GRAVE = 96 + ! Keypad keys + integer(c_int) :: KEY_KP_0 = 320 + integer(c_int) :: KEY_KP_1 = 321 + integer(c_int) :: KEY_KP_2 = 322 + integer(c_int) :: KEY_KP_3 = 323 + integer(c_int) :: KEY_KP_4 = 324 + integer(c_int) :: KEY_KP_5 = 325 + integer(c_int) :: KEY_KP_6 = 326 + integer(c_int) :: KEY_KP_7 = 327 + integer(c_int) :: KEY_KP_8 = 328 + integer(c_int) :: KEY_KP_9 = 329 + integer(c_int) :: KEY_KP_DECIMAL = 330 + integer(c_int) :: KEY_KP_DIVIDE = 331 + integer(c_int) :: KEY_KP_MULTIPLY = 332 + integer(c_int) :: KEY_KP_SUBTRACT = 333 + integer(c_int) :: KEY_KP_ADD = 334 + integer(c_int) :: KEY_KP_ENTER = 335 + integer(c_int) :: KEY_KP_EQUAL = 336 + ! Android key buttons + integer(c_int) :: KEY_BACK = 4 + integer(c_int) :: KEY_MENU = 82 + integer(c_int) :: KEY_VOLUME_UP = 24 + integer(c_int) :: KEY_VOLUME_DOWN = 25 + ! Mouse buttons + integer(c_int) :: MOUSE_LEFT_BUTTON = 0 + integer(c_int) :: MOUSE_RIGHT_BUTTON = 1 + integer(c_int) :: MOUSE_MIDDLE_BUTTON = 2 + ! Mouse cursor + integer(c_int) :: MOUSE_CURSOR_DEFAULT = 0 + integer(c_int) :: MOUSE_CURSOR_ARROW = 1 + integer(c_int) :: MOUSE_CURSOR_IBEAM = 2 + integer(c_int) :: MOUSE_CURSOR_CROSSHAIR = 3 + integer(c_int) :: MOUSE_CURSOR_POINTING_HAND = 4 + integer(c_int) :: MOUSE_CURSOR_RESIZE_EW = 5 + integer(c_int) :: MOUSE_CURSOR_RESIZE_NS = 6 + integer(c_int) :: MOUSE_CURSOR_RESIZE_NWSE = 7 + integer(c_int) :: MOUSE_CURSOR_RESIZE_NESW = 8 + integer(c_int) :: MOUSE_CURSOR_RESIZE_ALL = 9 + integer(c_int) :: MOUSE_CURSOR_NOT_ALLOWED = 10 + ! Gamepad buttons + integer(c_int) :: GAMEPAD_BUTTON_UNKNOWN = 0 + ! This is normally a DPAD + integer(c_int) :: GAMEPAD_BUTTON_LEFT_FACE_UP = 1 + integer(c_int) :: GAMEPAD_BUTTON_LEFT_FACE_RIGHT = 2 + integer(c_int) :: GAMEPAD_BUTTON_LEFT_FACE_DOWN = 3 + integer(c_int) :: GAMEPAD_BUTTON_LEFT_FACE_LEFT = 4 + ! This normally corresponds with PlayStation and Xbox controllers + ! XBOX: [Y,X,A,B] + ! PS3: [Triangle,Square,Cross,Circle] + ! No support for 6 button controllers though.. + integer(c_int) :: GAMEPAD_BUTTON_RIGHT_FACE_UP = 5 + integer(c_int) :: GAMEPAD_BUTTON_RIGHT_FACE_RIGHT = 6 + integer(c_int) :: GAMEPAD_BUTTON_RIGHT_FACE_DOWN = 7 + integer(c_int) :: GAMEPAD_BUTTON_RIGHT_FACE_LEFT = 8 + integer(c_int) :: GAMEPAD_BUTTON_LEFT_TRIGGER_1 = 9 + integer(c_int) :: GAMEPAD_BUTTON_LEFT_TRIGGER_2 = 10 + integer(c_int) :: GAMEPAD_BUTTON_RIGHT_TRIGGER_1 = 11 + integer(c_int) :: GAMEPAD_BUTTON_RIGHT_TRIGGER_2 = 12 + integer(c_int) :: GAMEPAD_BUTTON_MIDDLE_LEFT = 13 ! PS3 Select + integer(c_int) :: GAMEPAD_BUTTON_MIDDLE = 14 ! PS Button/XBOX Button + integer(c_int) :: GAMEPAD_BUTTON_MIDDLE_RIGHT = 15 ! PS3 Start + ! These are the joystick press in buttons + integer(c_int) :: GAMEPAD_BUTTON_LEFT_THUMB = 16 + integer(c_int) :: GAMEPAD_BUTTON_RIGHT_THUMB = 17 + ! Gamepad axis + integer(c_int) :: GAMEPAD_AXIS_LEFT_X = 0 + integer(c_int) :: GAMEPAD_AXIS_LEFT_Y = 1 + integer(c_int) :: GAMEPAD_AXIS_RIGHT_X = 2 + integer(c_int) :: GAMEPAD_AXIS_RIGHT_Y = 3 + integer(c_int) :: GAMEPAD_AXIS_LEFT_TRIGGER = 4 ! [1..-1] (pressure-level) + integer(c_int) :: GAMEPAD_AXIS_RIGHT_TRIGGER = 5 ! [1..-1] (pressure-level) + ! Material map index + integer(c_int) :: MATERIAL_MAP_ALBEDO = 0 + integer(c_int) :: MATERIAL_MAP_DIFFUSE = 0 ! same as MATERIAL_MAP_ALBEDO + integer(c_int) :: MATERIAL_MAP_METALNESS = 1 + integer(c_int) :: MATERIAL_MAP_SPECULAR = 1 ! same as MATERIAL_MAP_METALNESS + integer(c_int) :: MATERIAL_MAP_NORMAL = 2 + integer(c_int) :: MATERIAL_MAP_ROUGHNESS = 3 + integer(c_int) :: MATERIAL_MAP_OCCLUSION = 4 + integer(c_int) :: MATERIAL_MAP_EMISSION = 5 + integer(c_int) :: MATERIAL_MAP_HEIGHT = 6 + integer(c_int) :: MATERIAL_MAP_BRDG = 7 + integer(c_int) :: MATERIAL_MAP_CUBEMAP = 8 ! NOTE: Uses GL_TEXTURE_CUBE_MAP + integer(c_int) :: MATERIAL_MAP_IRRADIANCE = 9 ! NOTE: Uses GL_TEXTURE_CUBE_MAP + integer(c_int) :: MATERIAL_MAP_PREFILTER = 10 ! NOTE: Uses GL_TEXTURE_CUBE_MAP + ! Shader location index + integer(c_int) :: SHADER_LOC_VERTEX_POSITION = 0 + integer(c_int) :: SHADER_LOC_VERTEX_TEXCOORD01 = 1 + integer(c_int) :: SHADER_LOC_VERTEX_TEXCOORD02 = 2 + integer(c_int) :: SHADER_LOC_VERTEX_NORMAL = 3 + integer(c_int) :: SHADER_LOC_VERTEX_TANGENT = 4 + integer(c_int) :: SHADER_LOC_VERTEX_COLOR = 5 + integer(c_int) :: SHADER_LOC_MATRIX_MVP = 6 + integer(c_int) :: SHADER_LOC_MATRIX_VIEW = 7 + integer(c_int) :: SHADER_LOC_MATRIX_PROJECTION = 8 + integer(c_int) :: SHADER_LOC_MATRIX_MODEL = 9 + integer(c_int) :: SHADER_LOC_MATRIX_NORMAL = 10 + integer(c_int) :: SHADER_LOC_VECTOR_VIEW = 11 + integer(c_int) :: SHADER_LOC_COLOR_DIFFUSE = 12 + integer(c_int) :: SHADER_LOC_COLOR_SPECULAR = 13 + integer(c_int) :: SHADER_LOC_COLOR_AMBIENT = 14 + integer(c_int) :: SHADER_LOC_MAP_ALBEDO = 15 + integer(c_int) :: SHADER_LOC_MAP_DIFFUSE = 15 ! same as SHADER_LOC_MAP_ALBEDO + integer(c_int) :: SHADER_LOC_MAP_METALNESS = 16 + integer(c_int) :: SHADER_LOC_MAP_SPECULAR = 16 ! same as SHADER_LOC_MAP_METALNESS + integer(c_int) :: SHADER_LOC_MAP_NORMAL = 17 + integer(c_int) :: SHADER_LOC_MAP_ROUGHNESS = 18 + integer(c_int) :: SHADER_LOC_MAP_OCCLUSION = 19 + integer(c_int) :: SHADER_LOC_MAP_EMISSION = 20 + integer(c_int) :: SHADER_LOC_MAP_HEIGHT = 21 + integer(c_int) :: SHADER_LOC_MAP_CUBEMAP = 22 + integer(c_int) :: SHADER_LOC_MAP_IRRADIANCE = 23 + integer(c_int) :: SHADER_LOC_MAP_PREFILTER = 24 + integer(c_int) :: SHADER_LOC_MAP_BRDF = 25 + ! Shader uniform data type + integer(c_int) :: SHADER_UNIFORM_FLOAT = 0 + integer(c_int) :: SHADER_UNIFORM_VEC2 = 1 + integer(c_int) :: SHADER_UNIFORM_VEC3 = 2 + integer(c_int) :: SHADER_UNIFORM_VEC4 = 3 + integer(c_int) :: SHADER_UNIFORM_INT = 4 + integer(c_int) :: SHADER_UNIFORM_IVEC2 = 5 + integer(c_int) :: SHADER_UNIFORM_IVEC3 = 6 + integer(c_int) :: SHADER_UNIFORM_IVEC4 = 7 + integer(c_int) :: SHADER_UNIFORM_SAMPLER2D = 8 + ! Pixel formats + integer(c_int) :: PIXELFORMAT_UNCOMPRESSED_GRAYSCALE = 1 ! 8 bit per pixel (no alpha) + integer(c_int) :: PIXELFORMAT_UNCOMPRESSED_GRAY_ALPHA = 2 ! 8*2 bpp (2 channels) + integer(c_int) :: PIXELFORMAT_UNCOMPRESSED_R5G6B5 = 3 ! 16 bpp + integer(c_int) :: PIXELFORMAT_UNCOMPRESSED_R8G8B8 = 4 ! 24 bpp + integer(c_int) :: PIXELFORMAT_UNCOMPRESSED_R5G5B5A1 = 5 ! 16 bpp (1 bit alpha) + integer(c_int) :: PIXELFORMAT_UNCOMPRESSED_R4G4B4A4 = 6 ! 16 bpp (4 bit alpha) + integer(c_int) :: PIXELFORMAT_UNCOMPRESSED_R8G8B8A8 = 7 ! 32 bpp + integer(c_int) :: PIXELFORMAT_UNCOMPRESSED_R32 = 8 ! 32 bpp (1 channel - float) + integer(c_int) :: PIXELFORMAT_UNCOMPRESSED_R32G32B32 = 9 ! 32*3 bpp (3 channels - float) + integer(c_int) :: PIXELFORMAT_UNCOMPRESSED_R32G32B32A32 = 10 ! 32*4 bpp (4 channels - float) + integer(c_int) :: PIXELFORMAT_COMPRESSED_DXT1_RGB = 11 ! 4 bpp (no alpha) + integer(c_int) :: PIXELFORMAT_COMPRESSED_DXT1_RGBA = 12 ! 4 bpp (1 bit alpha) + integer(c_int) :: PIXELFORMAT_COMPRESSED_DXT3_RGBA = 13 ! 8 bpp + integer(c_int) :: PIXELFORMAT_COMPRESSED_DXT5_RGBA = 14 ! 8 bpp + integer(c_int) :: PIXELFORMAT_COMPRESSED_ETC1_RGB = 15 ! 4 bpp + integer(c_int) :: PIXELFORMAT_COMPRESSED_ETC2_RGB = 16 ! 4 bpp + integer(c_int) :: PIXELFORMAT_COMPRESSED_ETC2_EAC_RGBA = 17 ! 8 bpp + integer(c_int) :: PIXELFORMAT_COMPRESSED_PVRT_RGB = 18 ! 4 bpp + integer(c_int) :: PIXELFORMAT_COMPRESSED_PVRT_RGBA = 19 ! 4 bpp + integer(c_int) :: PIXELFORMAT_COMPRESSED_ASTC_4x4_RGBA = 20 ! 8 bpp + integer(c_int) :: PIXELFORMAT_COMPRESSED_ASTC_8x8_RGBA = 21 ! 2 bpp + ! Texture parameters: filter mode + integer(c_int) :: TEXTURE_FILTER_POINT = 0 ! No filter, just pixel aproximation + integer(c_int) :: TEXTURE_FILTER_BILINEAR = 1 ! Linear filtering + integer(c_int) :: TEXTURE_FILTER_TRILINEAR = 2 ! Trilinear filtering (linear with mipmaps) + integer(c_int) :: TEXTURE_FILTER_ANISOTROPIC_4X = 3 ! Anisotropic filtering 4x + integer(c_int) :: TEXTURE_FILTER_ANISOTROPIC_8X = 4 ! Anisotropic filtering 8x + integer(c_int) :: TEXTURE_FILTER_ANISOTROPIC_16X = 5 ! Anisotropic filtering 16x + ! Texture parameters: wrap mode + integer(c_int) :: TEXTURE_WRAP_REPEAT = 0 ! Repeats texture in tiled mode + integer(c_int) :: TEXTURE_WRAP_CLAMP = 1 ! Clamps texture to edge pixel in tiled mode + integer(c_int) :: TEXTURE_WRAP_MIRROR_REPEAT = 2 ! Mirrors and repeats the texture in tiled mode + integer(c_int) :: TEXTURE_WRAP_MIRROR_CLAMP = 3 ! Mirrors and clamps to border the texture in tiled mode + ! Cubemap layouts + integer(c_int) :: CUBEMAP_LAYOUT_AUTO_DETECT = 0 ! Automatically detect layout type + integer(c_int) :: CUBEMAP_LAYOUT_LINE_VERTICAL = 1 ! Layout is defined by a vertical line with faces + integer(c_int) :: CUBEMAP_LAYOUT_LINE_HORIZONTAL = 2 ! Layout is defined by an horizontal line with faces + integer(c_int) :: CUBEMAP_LAYOUT_CROSS_THREE_BY_FOUR = 3 ! Layout is defined by a 3x4 cross with cubemap faces + integer(c_int) :: CUBEMAP_LAYOUT_CROSS_FOUR_BY_THREE = 4 ! Layout is defined by a 4x3 cross with cubemap faces + integer(c_int) :: CUBEMAP_LAYOUT_PANORAMA = 5 ! Layout is defined by a panorama image (equirectangular map) + ! Font type, defines generation method + integer(c_int) :: FONT_DEFAULT = 0 ! Default font generation, anti-aliased + integer(c_int) :: FONT_BITMAP = 1 ! Bitmap font generation, no anti-aliasing + integer(c_int) :: FONT_SDF = 2 ! SDF font generation, requires external shader + ! Color blending modes (pre-defined) + integer(c_int) :: BLEND_ALPHA = 0 ! Blend textures considering alpha (default) + integer(c_int) :: BLEND_ADDITIVE = 1 ! Blend textures adding colors + integer(c_int) :: BLEND_MULTIPLIED = 2 ! Blend textures multiplying colors + integer(c_int) :: BLEND_ADD_COLORS = 3 ! Blend textures adding colors (alternative) + integer(c_int) :: BLEND_SUBTRACT_COLORS = 4 ! Blend textures subtracting colors (alternative) + integer(c_int) :: BLEND_CUSTOM = 5 ! Belnd textures using custom src/dst factors (use rlSetBlendMode()) + ! Gestures + integer(c_int) :: GESTURE_NONE = 0 + integer(c_int) :: GESTURE_TAP = 1 + integer(c_int) :: GESTURE_DOUBLETAP = 2 + integer(c_int) :: GESTURE_HOLD = 4 + integer(c_int) :: GESTURE_DRAG = 8 + integer(c_int) :: GESTURE_SWIPE_RIGHT = 16 + integer(c_int) :: GESTURE_SWIPE_LEFT = 32 + integer(c_int) :: GESTURE_SWIPE_UP = 64 + integer(c_int) :: GESTURE_SWIPE_DOWN = 128 + integer(c_int) :: GESTURE_PINCH_IN = 256 + integer(c_int) :: GESTURE_PINCH_OUT = 512 + !Camera system modes integer(c_int) :: CAMERA_CUSTOM = 0 integer(c_int) :: CAMERA_FREE = 1 @@ -126,6 +407,41 @@ module raylib subroutine disable_cursor() bind(c, name="DisableCursor") end subroutine disable_cursor + function is_key_pressed(key) result (res) bind(c, name="IsKeyPressed") + import :: c_int + import :: c_bool + logical(c_bool) :: res + integer(c_int), intent(in), value :: key + end function is_key_pressed + + function is_key_down(key) result (res) bind(c, name="IsKeyDown") + import :: c_int + import :: c_bool + logical(c_bool) :: res + integer(c_int), intent(in), value :: key + end function is_key_down + + function is_key_released(key) result (res) bind(c, name="IsKeyReleased") + import :: c_int + import :: c_bool + logical(c_bool) :: res + integer(c_int), intent(in), value :: key + end function is_key_released + + function is_key_up(key) result (res) bind(c, name="IsKeyUp") + import :: c_int + import :: c_bool + logical(c_bool) :: res + integer(c_int), intent(in), value :: key + end function is_key_up + + subroutine draw_grid(slices, spacing) bind(c, name="DrawGrid") + import :: c_int + import :: c_float + integer(c_int), intent(in), value :: slices + real(c_float), intent(in), value :: spacing + end subroutine draw_grid + subroutine draw_text(text, posX, posY, fontSize, col) bind(c, name="DrawText") import :: c_int import :: color