예제 #1
0
        static int Main(string[] args)
        {
            DynamicsSystem.SetGravity(0.0f, -9.81f, 0.0f);

            GraphicsWindow wnd = new GraphicsWindow("Test Window", 640, 480);

            /* Create an actor at the origin to contain the camera */
            Actor camera = new Actor();
            camera.Add(wnd.Camera);
            wnd.Camera.BackgroundColor = System.Drawing.Color.SkyBlue;
            wnd.Camera.Position.Z = 3.0;

            /* Create an actor to hold a box */
            Actor box = new Actor();
            box.Add(new BoxShape(1.0f, 1.0f, 1.0f));
            box.Add(new RigidBody());

            _scene.Add(camera);
            _scene.Add(box);

            /* Enable visualization of collision shapes */
            Visualization.Add("FlatFour.Collision.BoxVisualizer");

            /* Run the event loop */
            PlatformSystem.Tick += new TickHandler(OnTick);
            PlatformSystem.EventLoop();

            Framework.Disconnect();
            return 0;
        }
예제 #2
0
        public SceneView()
        {
            System.Type xplatui = System.Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
            if (xplatui != null)
            {
                System.IntPtr display = (System.IntPtr)xplatui.GetField("DisplayHandle", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
                _gfx = new FlatFour.Graphics.GraphicsWindow(display, this.Handle);
            }
            else
            {
                _gfx = new FlatFour.Graphics.GraphicsWindow(this.Handle);
            }
            _gfx.Camera.BackgroundColor = System.Drawing.Color.SkyBlue;

            this.Resize += new System.EventHandler(SceneView_Resize);
        }