OSDN Git Service

2121
authorHOSOKAWA Kenchi <hskwk@inter7.jp>
Fri, 27 Aug 2010 07:04:07 +0000 (16:04 +0900)
committerHOSOKAWA Kenchi <hskwk@inter7.jp>
Fri, 27 Aug 2010 07:04:07 +0000 (16:04 +0900)
test4/PsychlopsMain.cs
test4/PsychlopsSilverlight4test.csproj

index f5df20f..261c75d 100644 (file)
@@ -1,4 +1,107 @@
-\r
+///+ Prefix linkto BasicCode1\r
+//// Lines for set up Psychlops environment\r
+using Psychlops;\r
+\r
+namespace PsychlopsSilverlight4test\r
+{\r
+\r
+       public class PsychlopsMain\r
+       {///- Prefix linkto BasicCode1\r
+\r
+\r
+               ///+ Main Routine\r
+               //// Psychlops runs at the first line of this function psychlops_main().\r
+               public void psychlops_main() {\r
+    ///+ 0 linkto BasicCode3_1a\r
+    ////Prepare global parameters\r
+     const int maxrectnum = 200;\r
+     int rectnum = 100/*ID:rectnumber 25.0 200.0 25.0*/;\r
+     double rectsize = 5.0/*ID:dotsize 1.0 10.0 1.0*/;\r
+     Rectangle[] rect = new Rectangle[maxrectnum];\r
+        for (int i = 0; i < maxrectnum; i++) { rect[i] = new Rectangle(); }\r
+     double[] rectcolorR = new double[maxrectnum];\r
+     double[] rectcolorG = new double[maxrectnum];\r
+     double[] rectcolorB = new double[maxrectnum];\r
+    ///- 0 linkto BasicCode3_1a\r
+\r
+        Canvas window = new Canvas(Canvas.window);\r
+\r
+     ///+ 1 linkto BasicCode3_1a\r
+     ////Initialize\r
+     for(int i=0; i < rectnum; i++){\r
+         ///+ 1.1 set1\r
+         ////set positions and sizes\r
+         rect[i].set(rectsize, rectsize); //Set a size of rectangles.\r
+         rect[i].centering();\r
+         rect[i].shift((i - 0.5 * rectnum) * rectsize* 1.5/*ID:RectHGap 1.0 3.0 0.5*/,\r
+                                        (i - 0.5*rectnum) * rectsize * 1.5/*ID:RectVGap 1.0 3.0 0.5*/); //Move Rectangles to initial positions\r
+         ///- 1.1 set1\r
+         ///+ 1.2 set2\r
+         ////set colors\r
+         rectcolorR[i]=Math.random(1.0) * 0.5/*ID: RGain 0.0 1.0 0.5*/; //Set R values. Note that "i" is converted to double-type.\r
+         rectcolorG[i]=Math.random(1.0) * 0.5/*ID: GGain 0.0 1.0 0.5*/; //Set G values. Note that "i" is converted to double-type.\r
+         rectcolorB[i]=Math.random(1.0) * 0.5/*ID: BGain 0.0 1.0 0.5*/; //Set B values. Note that "i" is converted to double-type.\r
+         ///- 1.2 set2\r
+         }\r
+    ///- 1 linkto BasicCode3_1a\r
+\r
+    ///+ 2 drawing\r
+    ////drawing objects\r
+    ///+ 2.1 setlocal\r
+    ////Prepare variables for movie control;\r
+    int frame = 0;\r
+    int motion_dir = 1;\r
+    double Horizontal_shift, Vertical_shift;\r
+    ///- 2.1 setlocal\r
+\r
+    while(!Keyboard.esc.pushed()){\r
+        window.clear(Color.black);\r
+\r
+        if(frame % 30/*ID:Period_Position 30 240 30*/ ==0){ // motion direction will reverse at designated frames.\r
+               motion_dir *= -1;\r
+        }\r
+\r
+        for(int i=0; i < rectnum; i++){\r
+         ///+ 2.2 loopset1\r
+         ////set positions and sizes\r
+\r
+         Horizontal_shift=motion_dir * 1.0/*ID:HSpeed 0.0 5.0 1.0*/;\r
+         Vertical_shift=motion_dir * 0.0/*ID:VSpeed 0.0 5.0 1.0*/;\r
+\r
+         rect[i].resize(rectsize, rectsize); //Resize rectangles.\r
+         rect[i].shift(Horizontal_shift, Vertical_shift);\r
+         ///- 2.2 loopset1\r
+\r
+         ///+ 2.3 loopset2\r
+         ////set colors\r
+         rectcolorR[i]=Math.random(1.0)* 0.5/*ID:RGain 0.0 1.0 0.5*/; //Set R values. Note that "i" is converted to double-type.\r
+         rectcolorG[i]=Math.random(1.0)* 0.5/*ID:GGain 0.0 1.0 0.5*/; //Set G values. Note that "i" is converted to double-type.\r
+         rectcolorB[i]=Math.random(1.0)* 0.5/*ID:BGain 0.0 1.0 0.5*/; //Set B values. Note that "i" is converted to double-type.\r
+         ///- 2.3 loopset2\r
+\r
+         }\r
+               \r
+               ///+ 2.4 linkto BasicCode3_1a\r
+        for(int i=0; i < rectnum; i++){\r
+            rect[i].draw(new Color(rectcolorR[i], rectcolorG[i], rectcolorB[i])); //draw objects by designated colors.\r
+        }\r
+        window.flip();\r
+        ///- 2.4 linkto BasicCode3_1a\r
+        \r
+        frame++;\r
+    }\r
+    ///- 2 drawing\r
+\r
+}\r
+               ///- Main Routine\r
+\r
+\r
+       }\r
+\r
+}\r
+\r
+\r
+/*\r
 using Psychlops;\r
 \r
 namespace PsychlopsSilverlight4test\r
@@ -52,6 +155,7 @@ namespace PsychlopsSilverlight4test
        }\r
 \r
 }\r
+*/\r
 \r
 \r
 \r
index c6601b6..43c1e3b 100644 (file)
@@ -62,9 +62,7 @@
     <WarningLevel>4</WarningLevel>\r
   </PropertyGroup>\r
   <ItemGroup>\r
-    <Reference Include="PsychlopsSilverlight4">\r
-      <HintPath>..\dev4\Bin\Debug\PsychlopsSilverlight4.dll</HintPath>\r
-    </Reference>\r
+    <Reference Include="PsychlopsSilverlight4, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" />\r
     <Reference Include="System.Windows" />\r
     <Reference Include="mscorlib" />\r
     <Reference Include="system" />\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Resource Include="Resources\logo.png" />\r
+    <Content Include="Resources\PsychlopsSilverlight4.dll" />\r
     <Content Include="TestPage.html" />\r
   </ItemGroup>\r
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />\r