Jump to content

Polyspiral: Difference between revisions

m
→‎SDL full animation: Made window resizeable, compensates for resized widows by centering the polyspiral in the window
(→‎SDL full animation: Add some more control options, make update speed not dependant on sleep. I'm just playing at this point.)
m (→‎SDL full animation: Made window resizeable, compensates for resized widows by centering the polyspiral in the window)
Line 1,479:
<lang perl6>use SDL2::Raw;
 
my $width = 1400800;
my $height = 1000800;
 
SDL_Init(VIDEO);
Line 1,489:
SDL_WINDOWPOS_CENTERED_MASK,
$width, $height,
OPENGLRESIZABLE
);
 
Line 1,515:
 
main: loop {
$angle = ($angle + $dir * $step) % τ;
($x1, $y1) = $width div 2, $height div 2;
 
while SDL_PollEvent($event) {
my $casted_event = SDL_CastEvent($event);
Line 1,526 ⟶ 1,523:
given $comm {
when 'K_LEFT' { $dir = -1 }
when 'K_RIGHT' { $dir = 1 }
when 'K_UP' { $step += $incr }
when 'K_DOWN' { if $step >-= 2*$incr {if $step -=> $incr } }
when 'K_PGUP' { $step += $incr*50 }
when 'K_PGDN' { $step -= $incr*50; $step = $step < $incr ?? $incr !! $step }
when 'K_SPACE' { $step = $step ?? 0 !! $incr }
}
}
}
when *.type == WINDOWEVENT {
if .event == 5 {
$width = .data1;
$height = .data2;
}
}
Line 1,538 ⟶ 1,541:
}
 
$angle = ($angle + $dir * $step) % τ;
($x1, $y1) = $width div 2, $height div 2;
for ^$lines {
my $length = 3 + 3 * $_;
10,333

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.