?? sglui2.f90
字號:
module sgl_util
use sgl
implicit none
integer, save :: x=0
integer, save :: y=0
contains
subroutine display()
integer, parameter :: size = 10
call sglClearBuffer()
call sglColor3i(255,255,255)
call sglDrawLine(x-size, y-size, x+size, y+size)
call sglDrawLine(x+size, y-size, x-size, y+size)
call sglUpdateBuffer()
return
end subroutine
subroutine MouseMove(mx,my)
integer mx,my
x = mx
y = my
call display()
return
end subroutine
subroutine MouseDown(key)
integer key
write(*,"('Push mouse button ',I1)") key
end subroutine
subroutine MouseUp(key)
integer key
write(*,"('Release mouse button ',I1)") key
end subroutine
end module
program main
use sgl_util
implicit none
! 設定鼠標在窗口中移動時, 會調用MouseMove
call sglMouseMoveSub(MouseMove)
! 設定鼠標在窗口按下按鈕時, 會調用MouseDown
call sglMouseDownSub(MouseDown) !
! 設定鼠標在窗口松開按鈕時, 會調用MouseDown
call sglMouseUpSub(MouseUp)
call sglDisplaySub(display)
call sglCreateWindow(100,100,400,400,1)
call sglShowCursor(0) ! 隱藏操作系統的鼠標光標
call sglMainLoop()
stop
end program
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -