sgldraw4.f90

来自「Fortran 95程序设计&Code-彭国伦」· F90 代码 · 共 38 行

F90
38
字号
module sgl_util
  use sgl
  implicit none
contains
  subroutine Display()
    call sglClearBuffer() 
	call sglColor3f(1.0,0,0) 
	call sglFilledRect(100,100, 120,200) ! 蜡烛
	call sglFilledRectV(0.5, 0.5, 0.58, 0.9)
	call sglColor3f(1.0,1.0,0.0)
	call sglFilledEllipse(110, 70, 5,30) ! 火焰
	call sglArc( 110, 70, 50, 0.0, 3.14159) ! 光环
	call sglFilledEllipseV(0.54,0.4, 0.03, 0.1)
	call sglArcV(0.54,0.4,0.4, 0.0, 3.14159)
	call sglUpdateBuffer();
  end subroutine
  subroutine resize(width, height)
    integer width, height
	real r
	r = real(height)/real(width)
	if ( r>1.0 ) then
	  call sglSetVirtual(-1.0, -r, 1.0, +r)
	else
	  call sglSetVirtual(-1.0/r, -1.0, 1.0/r, 1.0)
	end if
  end subroutine
end module

program main
  use sgl_util
  implicit none
  call sglDisplaySub(Display)
  call sglReshapeSub(resize) 
  call sglSetVirtual(-1.0, -1.0, 1.0, 1.0)
  call sglCreateWindow(100,100,400,400,1)
  call sglMainLoop()
  stop
end program

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?