\8fÍ/3.2_\83\89\83\93\83_\83\80\83h\83b\83g4.cpp - RSS feed" href="/view?p=psychlops/cpp_document.git;a=rss;f=Psychlops.manual/sample_cpp_file/3%C2%8F%C3%8D/3.2_%C2%83%C2%89%C2%83%C2%93%C2%83_%C2%83%C2%80%C2%83h%C2%83b%C2%83g4.cpp" type="application/rss+xml" /> \8fÍ/3.2_\83\89\83\93\83_\83\80\83h\83b\83g4.cpp - RSS feed (no merges)" href="/view?p=psychlops/cpp_document.git;a=rss;f=Psychlops.manual/sample_cpp_file/3%C2%8F%C3%8D/3.2_%C2%83%C2%89%C2%83%C2%93%C2%83_%C2%83%C2%80%C2%83h%C2%83b%C2%83g4.cpp;opt=--no-merges" type="application/rss+xml" /> \8fÍ/3.2_\83\89\83\93\83_\83\80\83h\83b\83g4.cpp - Atom feed" href="/view?p=psychlops/cpp_document.git;a=atom;f=Psychlops.manual/sample_cpp_file/3%C2%8F%C3%8D/3.2_%C2%83%C2%89%C2%83%C2%93%C2%83_%C2%83%C2%80%C2%83h%C2%83b%C2%83g4.cpp" type="application/atom+xml" /> \8fÍ/3.2_\83\89\83\93\83_\83\80\83h\83b\83g4.cpp - Atom feed (no merges)" href="/view?p=psychlops/cpp_document.git;a=atom;f=Psychlops.manual/sample_cpp_file/3%C2%8F%C3%8D/3.2_%C2%83%C2%89%C2%83%C2%93%C2%83_%C2%83%C2%80%C2%83h%C2%83b%C2%83g4.cpp;opt=--no-merges" type="application/atom+xml" />

OSDN Git Service

hk
[psychlops/cpp_document.git] / Psychlops.manual / sample_cpp_file / 3\8fÍ / 3.2_\83\89\83\93\83_\83\80\83h\83b\83g4.cpp
1 #include <psychlops.h>
2 using namespace Psychlops;
3
4 const int dotsize=4;
5 const int width=100;
6 double height=50;
7 double temp1;
8 double speed=1;
9 double phase=0;
10 int frame=0;
11 Psychlops::Rectangle rect1[width];
12 Psychlops::Color col;
13 Psychlops::Image Noise1[width];
14
15 void psychlops_main() {
16
17         Canvas sampleA(Canvas::fullscreen);
18         
19         for(int x=0; x<width; x++){
20                 Noise1[x].set(dotsize,height*dotsize);
21                 rect1[x].set(dotsize, dotsize);
22                 for(int y=0; y<height; y++){
23                         temp1=Psychlops::random();
24                         col.set(temp1);
25                         Noise1[x].rect(rect1[x],col);
26                         rect1[x].shift(0, dotsize);
27                 }       
28         }
29         while(!Input::get(Keyboard::spc)){
30                 for(int x=0; x<width; x++){
31                         phase=(double)-1/2*(width*dotsize)+(int)(x*dotsize+frame*speed*dotsize)%(int)(width*dotsize);
32                         Noise1[x].centering().shift(phase,0);
33                         Noise1[x].draw();
34                 }
35                 sampleA.flip();
36                 frame++;
37         }
38 }