OK boomer
This commit is contained in:
parent
ecfcef2303
commit
8535ba09d9
1
GrafAnim/.gitignore
vendored
1
GrafAnim/.gitignore
vendored
@ -1,5 +1,6 @@
|
||||
|
||||
essai
|
||||
doubledice
|
||||
|
||||
*.scratch
|
||||
*.tga
|
||||
|
@ -7,6 +7,9 @@ GFOPT = -Wall -Wextra -g -time
|
||||
essai: essai.f90 usegenplot.o Makefile
|
||||
gfortran $(GFOPT) $< usegenplot.o -o $@
|
||||
|
||||
doubledice: doubledice.f90 usegenplot.o Makefile
|
||||
gfortran $(GFOPT) $< usegenplot.o -o $@
|
||||
|
||||
usegenplot.o: usegenplot.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
|
@ -2,8 +2,8 @@ program doubledice
|
||||
use usegenplot
|
||||
implicit none
|
||||
|
||||
call init_genplot("essai.genplot")
|
||||
|
||||
|
||||
|
||||
call end_genplot("OK boomer")
|
||||
|
||||
end program
|
||||
|
@ -4,7 +4,7 @@ program essai
|
||||
|
||||
integer :: foo, bar
|
||||
integer :: nbarg
|
||||
integer :: numframe = 1
|
||||
integer :: numframe = 0
|
||||
character(len=32) :: arg
|
||||
|
||||
! write(0, *) "------------ essai graf anim ---------------"
|
||||
@ -12,30 +12,35 @@ program essai
|
||||
nbarg = IARGC()
|
||||
if (nbarg .GT. 0) then
|
||||
call GETARG(1, arg)
|
||||
write (0, '(A40, A5)') "argument = ", arg
|
||||
! write (0, '(A40, A5)') "argument = ", arg
|
||||
read (arg, *) numframe
|
||||
endif
|
||||
|
||||
write(0, '(A40, I5)') "frame number =", numframe
|
||||
! write(0, '(A20, I5)') "frame number =", numframe
|
||||
|
||||
call init_genplot("essai.genplot")
|
||||
! call do_frame(7)
|
||||
call do_frame(7)
|
||||
|
||||
bar = (numframe * 20) - 160
|
||||
do foo=20, 620, 40
|
||||
call gplt_setcol(2)
|
||||
|
||||
bar = (numframe * 20) - 120
|
||||
do foo=20, 620, 50
|
||||
call gplt_line(foo, 20, bar, 460)
|
||||
call gplt_line(bar, 20, foo, 460)
|
||||
enddo
|
||||
|
||||
call end_genplot("done for today")
|
||||
|
||||
contains !------------------------------------------
|
||||
|
||||
subroutine do_frame(color)
|
||||
integer, intent(in) :: color
|
||||
integer :: savecol
|
||||
|
||||
call gplt_line( 0, 0, 640, 0)
|
||||
call gplt_line( 0, 480, 640, 480)
|
||||
call gplt_line( 0, 0, 0, 480)
|
||||
call gplt_line(640, 0, 640, 480)
|
||||
savecol = gplt_getcol()
|
||||
call gplt_setcol(color)
|
||||
call gplt_rect(0, 0, 640, 480)
|
||||
call gplt_setcol(savecol)
|
||||
|
||||
end subroutine
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
module usegenplot
|
||||
|
||||
implicit none
|
||||
|
||||
integer, private :: color = 4
|
||||
logical, private :: initialised = .FALSE.
|
||||
contains
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
@ -8,11 +11,29 @@ module usegenplot
|
||||
subroutine init_genplot(filename)
|
||||
|
||||
character(*), intent(in) :: filename
|
||||
|
||||
write(0, *) '--> init genplot "', filename, '"'
|
||||
initialised = .TRUE.
|
||||
color = 4
|
||||
|
||||
end subroutine
|
||||
|
||||
subroutine end_genplot(message)
|
||||
|
||||
character(*), intent(in) :: message
|
||||
write(0, *) '--> end genplot "', message, '"'
|
||||
initialised = .FALSE.
|
||||
|
||||
end subroutine
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
subroutine gplt_setcol(col)
|
||||
integer, intent(in) :: col
|
||||
color = col
|
||||
end subroutine
|
||||
function gplt_getcol()
|
||||
integer gplt_getcol
|
||||
gplt_getcol = color
|
||||
end function
|
||||
! -------------------------------------------------------------------
|
||||
|
||||
subroutine gplt_move(x, y)
|
||||
@ -24,7 +45,7 @@ end subroutine
|
||||
|
||||
subroutine gplt_draw(x, y)
|
||||
integer, intent(in) :: x, y
|
||||
print *, x, y, 2
|
||||
print *, x, y, color
|
||||
end subroutine
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
@ -36,11 +57,19 @@ subroutine gplt_line(x1, y1, x2, y2)
|
||||
end subroutine
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
|
||||
subroutine gplt_rect(x1, y1, x2, y2)
|
||||
integer, intent(in) :: x1, y1, x2, y2! -------------------------------------------------------------------
|
||||
integer, intent(in) :: x1, y1, x2, y2
|
||||
|
||||
call gplt_move(x1, y1)
|
||||
call gplt_draw(x2, y1)
|
||||
call gplt_draw(x2, y2)
|
||||
call gplt_draw(x1, y2)
|
||||
call gplt_draw(x1, y1)
|
||||
|
||||
end subroutine
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
! -------------------------------------------------------------------
|
||||
|
||||
end module
|
||||
|
Loading…
Reference in New Issue
Block a user