program main use iso_c_binding use raylib implicit none integer(c_int) :: screenWidth = 800 integer(c_int) :: screenHeight = 450 type(camera3d), target :: camera type(c_ptr) :: camera_p call init_window(screenWidth, screenHeight, "fortran client : raylib"//c_null_char) 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 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 call begin_drawing() 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 !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() call end_drawing() end do call close_window() !Close window and OpenGL context contains end program main