program main use iso_c_binding use raylib implicit none integer(c_int) :: screen_width = 800 integer(c_int) :: screen_height = 450 type(camera3d), target :: camera type(vector3) :: npc_position type(vector3) :: player_position real(c_float) :: npc_dir ! ! 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 ! 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 call set_target_fps(60_c_int) !Main game loop do while (.not. window_should_close()) ! Detect window close button or ESC key 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 begin_mode_3d(camera) ! Draw floor call draw_grid(30_c_int, 1.0_c_float) ! 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 call close_window() !Close window and OpenGL context contains end program main