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