This commit is contained in:
zongor 2023-09-17 09:40:35 -04:00
parent 0336cfaeb3
commit 8bbf0b584f
1 changed files with 8 additions and 3 deletions

View File

@ -35,18 +35,23 @@ program main
! !
! do login stuff here ! do login stuff here
! !
!call execute_command_line('mkfifo /tmp/fortran-mmo-in.pipe && mkfifo /tmp/fortran-mmo-out.pipe')
!Main game loop !Main game loop
do while (.not. window_should_close()) ! Detect window close button or ESC key do while (.not. window_should_close()) ! Detect window close button or ESC key
if (is_key_down(KEY_RIGHT)) then if (is_key_down(KEY_RIGHT)) then
player_position%x = player_position%x + 0.2_c_float player_position%x = player_position%x + 0.2_c_float
player_updated = .true.
else if (is_key_down(KEY_LEFT)) then else if (is_key_down(KEY_LEFT)) then
player_position%x = player_position%x - 0.2_c_float player_position%x = player_position%x - 0.2_c_float
player_updated = .true.
else if (is_key_down(KEY_DOWN)) then else if (is_key_down(KEY_DOWN)) then
player_position%z = player_position%z + 0.2_c_float player_position%z = player_position%z + 0.2_c_float
player_updated = .true.
else if (is_key_down(KEY_UP)) then else if (is_key_down(KEY_UP)) then
player_position%z = player_position%z - 0.2_c_float player_position%z = player_position%z - 0.2_c_float
player_updated = .true.
end if end if
camera%position%x = player_position%x camera%position%x = player_position%x
@ -59,6 +64,7 @@ program main
! if player updated ! if player updated
! send new player postition to server ! send new player postition to server
! call execute_command_line('nc localhost 35565 < /tmp/fortran-mmo-in.pipe > /tmp/fortran-mmo-out.pipe')
! else ! else
! send ping to server ! send ping to server
! read response ! read response
@ -94,7 +100,6 @@ program main
! !
call close_window() !Close window and OpenGL context call close_window() !Close window and OpenGL context
call execute_command_line('rm /tmp/fortran-mmo.pipe')
contains end program main
end program main