nap-time commit

This commit is contained in:
Tonton Th
2026-05-05 14:23:20 +02:00
parent 6747f0e243
commit 95a8502d0f
6 changed files with 61 additions and 81 deletions

View File

@@ -1,24 +1,30 @@
!
! BUILD A STAR FIELD
! this crapware is released by tTh under the
! DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
!
program starfield
use genplotting
implicit none
write (0, '(A)') "----[ genplotting starfield ]----"
call genp_init (0, 'WS/starfield.scratch')
call do_starfield (451)
call do_starfield (200)
call genp_end (0)
contains
! ---------------------------------------------------------
subroutine plot_a_star(at_x, at_y, sz, color)
real, intent(in) :: at_x, at_y, sz
integer, intent(in) :: color
integer :: idx
real :: rad, xv, yv
write(0, '("plot a star ", 2F8.3)') at_x, at_y
call genp_set_offset(at_x, at_y)
do idx=0, 360, 36
rad = 0.042 + (real(idx) * (3.14159 / 180))
! convert index to radians
rad = real(idx) * (3.14159 / 180)
xv = sz * sin(rad) ; yv = sz * cos(rad)
call genp_move(0.0, 0.0)
call genp_draw(xv, yv, color)
@@ -27,12 +33,13 @@ end subroutine
! ---------------------------------------------------------
subroutine do_starfield (nbstar)
integer, intent(in) :: nbstar
integer idx, color
real px, py, sz
do idx=1, nbstar
px = (rand(0) * 10.00) - 5.00
py = (rand(0) * 10.00) - 5.00
sz = (rand(0) * 0.16) + 0.16
sz = (rand(0) * 0.30) + 0.12
color = 1 + mod(idx, 7)
call plot_a_star(px, py, sz, color)
end do