OSDN Git Service

12313
authorunknown <hskwk@.(none)>
Sat, 21 Aug 2010 13:42:20 +0000 (22:42 +0900)
committerunknown <hskwk@.(none)>
Sat, 21 Aug 2010 13:42:20 +0000 (22:42 +0900)
dev4/PsychlopsSilverlight4.csproj
dev4/psychlops/core/graphic/canvas.cs
dev4/psychlops/core/graphic/shape.cs
dev4/psychlops/core/math/interval.cs
test4/PsychlopsMain.cs

index 63125e6..62b4e86 100644 (file)
@@ -81,6 +81,7 @@
     <Compile Include="psychlops\core\math\interval.cs" />\r
     <Compile Include="psychlops\core\math\matrix.cs" />\r
     <Compile Include="psychlops\core\math\util.cs" />\r
+    <Compile Include="psychlops\extention\compatibility\compatibility.cs" />\r
     <Compile Include="psychlops\extention\experiments\experiments.cs" />\r
     <Compile Include="psychlops\extention\math\BigFloat.cs" />\r
     <Compile Include="psychlops\extention\math\BigInt.cs" />\r
index 536bf48..c129d82 100644 (file)
@@ -637,6 +637,37 @@ namespace Psychlops
                #endregion\r
 \r
 \r
+               #region compatibitily trick\r
+\r
+               public enum Mode { window, fullscreen }\r
+               public static readonly Mode window = Mode.window, fullscreen = Mode.fullscreen;\r
+\r
+               public Canvas(int wid, int hei, Mode mod)\r
+               {\r
+                       panel = default_panel;\r
+                       api_canvas = default_api_canvas;\r
+                       initialize(500, 500);\r
+               }\r
+               public Canvas(Mode mod)\r
+               {\r
+                       panel = default_panel;\r
+                       api_canvas = default_api_canvas;\r
+                       initialize(500, 500);\r
+               }\r
+\r
+\r
+               public void showFPS(bool sw = true) { }\r
+               public void watchFPS(bool sw = true) { }\r
+\r
+\r
+               public void clear(double lum)\r
+               {\r
+                       clear(new Color(lum));\r
+               }\r
+\r
+               #endregion\r
+\r
+\r
        }\r
 \r
 \r
index 9cebe91..23cbeca 100644 (file)
@@ -19,6 +19,10 @@ namespace Psychlops{
        }\r
        public static class ShapeExtention\r
        {\r
+               public static void draw(this Shape drawee, double c)\r
+               {\r
+                       drawee.draw( new Color(c) );\r
+               }\r
                public static void draw(this Shape drawee, Color c)\r
                {\r
                        Color tmp_col = drawee.fill;\r
index 6426046..0b9a22d 100644 (file)
@@ -11,6 +11,11 @@ namespace Psychlops
                public struct VAL {\r
                        public double val;\r
                        public OPERATOR op;\r
+                       /*public VAL()\r
+                       {\r
+                               val = Double.NaN;\r
+                               op = OPERATOR.CLOSE;\r
+                       }*/\r
                        public VAL(double v, OPERATOR o)\r
                        {\r
                                val = v;\r
@@ -23,13 +28,12 @@ namespace Psychlops
                }\r
                public VAL begin, end;\r
 \r
-               /*\r
-               public Interval()\r
+               \r
+               /*public Interval()\r
                {\r
                        begin = new VAL { val = Double.PositiveInfinity, op = OPERATOR.CLOSE };\r
                        end = new VAL { val = Double.NegativeInfinity, op = OPERATOR.CLOSE };\r
-               }\r
-               */\r
+               }*/\r
                public Interval(double floor_val, double ceil_val)\r
                {\r
                        begin.val = floor_val;\r
index 5e19dfb..f5df20f 100644 (file)
@@ -1,4 +1,70 @@
-using Psychlops;\r
+\r
+using Psychlops;\r
+\r
+namespace PsychlopsSilverlight4test\r
+{\r
+\r
+       public class PsychlopsMain\r
+       {\r
+\r
+               Psychlops.Widgets.Slider rect_size;\r
+               Psychlops.Widgets.Slider rect_lum;\r
+               Psychlops.Widgets.Slider bg_lum;\r
+\r
+\r
+               void RectLuminance()\r
+               {\r
+                       Canvas display = new Canvas(Canvas.window);\r
+                       Interval rng = new Interval();\r
+                       rect_size = new Psychlops.Widgets.Slider("Rect Size", 1 < rng < 500, 10.0);\r
+                       rect_lum = new Psychlops.Widgets.Slider("Rect Luminance", 0.0 <= rng <= 1.0, 0.1);\r
+                       bg_lum = new Psychlops.Widgets.Slider("BG Luminance", 0.0 <= rng <= 1.0, 0.1);\r
+                       Ellipse drawee = new Ellipse(100, 100);\r
+                       display.showFPS();\r
+                       display.watchFPS();\r
+\r
+                       Rectangle rect = new Rectangle(rect_size, rect_size);\r
+                       rect.centering();\r
+\r
+\r
+                       Clock before = new Clock(), after = new Clock();\r
+                       while (!Keyboard.esc.pushed())\r
+                       {\r
+                               Display.clear(bg_lum);\r
+                               rect.resize(rect_size, rect_size).draw(rect_lum);\r
+                               after.update();\r
+                               display.var((after - before).at_msec(), 100, 100, Color.green);\r
+                               display.var((after - before).at_msec(), 100, 200, Color.green);\r
+                               drawee.centering().shift(Math.random(100), 0);\r
+                               drawee.draw(Color.black);\r
+                               Display.flip();\r
+                       }\r
+\r
+               }\r
+\r
+\r
+               public void psychlops_main()\r
+               {\r
+                       RectLuminance();\r
+               }\r
+\r
+\r
+       }\r
+\r
+}\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+/*\r
+ using Psychlops;\r
 \r
 namespace PsychlopsSilverlight4test\r
 {\r
@@ -126,7 +192,7 @@ namespace PsychlopsSilverlight4test
        }\r
 \r
 }\r
-\r
+*/\r
 \r
 \r
 /*using Psychlops;\r