Particle fountain: Difference between revisions
Content added Content deleted
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
|||
Line 18: | Line 18: | ||
{{libheader|SDL}} |
{{libheader|SDL}} |
||
{{trans|Raku}} |
{{trans|Raku}} |
||
< |
<syntaxhighlight lang="cpp">#include <SDL2/SDL.h> |
||
#include <algorithm> |
#include <algorithm> |
||
Line 254: | Line 254: | ||
SDL_Quit(); |
SDL_Quit(); |
||
return EXIT_SUCCESS; |
return EXIT_SUCCESS; |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
{{trans|Raku}} |
{{trans|Raku}} |
||
< |
<syntaxhighlight lang="julia">using Dates, Colors, SimpleDirectMediaLayer.LibSDL2 |
||
mutable struct ParticleFountain |
mutable struct ParticleFountain |
||
Line 384: | Line 384: | ||
fountain() |
fountain() |
||
</syntaxhighlight> |
|||
</lang> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |
||
< |
<syntaxhighlight lang="perl">#!/usr/bin/perl |
||
use strict; # https://rosettacode.org/wiki/Particle_fountain |
use strict; # https://rosettacode.org/wiki/Particle_fountain |
||
Line 434: | Line 434: | ||
} |
} |
||
$mw->after(1 => \&step); |
$mw->after(1 => \&step); |
||
}</ |
}</syntaxhighlight> |
||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Line 441: | Line 441: | ||
{{libheader|Phix/online}} |
{{libheader|Phix/online}} |
||
You can run this online [http://phix.x10.mx/p2js/Particle_fountain.htm here]. |
You can run this online [http://phix.x10.mx/p2js/Particle_fountain.htm here]. |
||
<!--< |
<!--<syntaxhighlight lang="phix">(phixonline)--> |
||
<span style="color: #000080;font-style:italic;">-- |
<span style="color: #000080;font-style:italic;">-- |
||
-- demo\rosetta\Particle_fountain.exw |
-- demo\rosetta\Particle_fountain.exw |
||
Line 566: | Line 566: | ||
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span> |
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span> |
||
<!--</ |
<!--</syntaxhighlight>--> |
||
=={{header|Raku}}== |
=={{header|Raku}}== |
||
Has options to vary the direction at which the fountain sprays, the "spread" angle and the color of the emitted particles. |
Has options to vary the direction at which the fountain sprays, the "spread" angle and the color of the emitted particles. |
||
<syntaxhighlight lang="raku" line> |
|||
<lang perl6> |
|||
use NativeCall; |
use NativeCall; |
||
use SDL2::Raw; |
use SDL2::Raw; |
||
Line 750: | Line 750: | ||
} |
} |
||
} |
} |
||
</syntaxhighlight> |
|||
</lang> |
|||
[https://github.com/thundergnat/rc/blob/master/img/fountain-raku.mp4?raw=true Link to off-site .mp4 video] |
[https://github.com/thundergnat/rc/blob/master/img/fountain-raku.mp4?raw=true Link to off-site .mp4 video] |
||
Line 758: | Line 758: | ||
{{libheader|DOME}} |
{{libheader|DOME}} |
||
{{libheader|Wren-dynamic}} |
{{libheader|Wren-dynamic}} |
||
< |
<syntaxhighlight lang="ecmascript">import "dome" for Window, Platform, Process |
||
import "graphics" for Canvas, Color |
import "graphics" for Canvas, Color |
||
import "math" for Math, Point |
import "math" for Math, Point |
||
Line 896: | Line 896: | ||
""") |
""") |
||
var Game = ParticleDisplay.new(3000, 800, 800)</ |
var Game = ParticleDisplay.new(3000, 800, 800)</syntaxhighlight> |