Пример #1
0
        //Dead Screen
        public static void RenderDead()
        {
            /// Clear the screen
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            hud.Render();

            // Present the screen
            graphics.SwapBuffers();
        }
Пример #2
0
        protected override void Update(GraphicsContext gfx, float dt)
        {
            // Update Players
            foreach (var player in Players)
            {
                player.Update(dt);
            }

            var w = gfx.Surface.Width / 2;
            var h = gfx.Surface.Height;

            /*
             * _   _                _              _  _     _        _
             | \ |_)  /\ \    /   |_) |   /\ \_/ |_ |_)   / \ |\ | |_
             |_/ | \ /--\ \/\/    |   |_ /--\ |  |_ | \   \_/ | \| |_
             |
             */

            gfx.Viewport = (0, 0, w, h);

            // Set "camera" to follow Player 1
            gfx.SetCameraTransform(Players[0].SmoothPosition);
            gfx.Clear(Color.DarkGray * Players[0].Color);
            DrawWorld(gfx);

            // Draw Player 1 HUD
            gfx.GlobalTransform = Matrix.Identity;
            gfx.Color           = Players[0].Color;
            gfx.DrawText("<WASD> to control Red", (16, 16), Font.Default, 32);

            /*
             * _   _                _              _  _    ___        _
             | \ |_)  /\ \    /   |_) |   /\ \_/ |_ |_)    | \    / / \
             |_/ | \ /--\ \/\/    |   |_ /--\ |  |_ | \    |  \/\/  \_/
             |
             */

            gfx.Viewport = (w, 0, w, h);

            // Set "camera" to follow Player 2
            gfx.SetCameraTransform(Players[1].SmoothPosition);
            gfx.Clear(Color.DarkGray * Players[1].Color);
            DrawWorld(gfx);

            // Draw Player 2 HUD
            gfx.GlobalTransform = Matrix.Identity;
            gfx.Color           = Players[1].Color;
            gfx.DrawText("<ARROW> to control Green", (gfx.Viewport.Width - 16, 16), Font.Default, 32, TextAlign.Right);
        }
Пример #3
0
    public void Render( 
                       GraphicsContext graphics,
                       Camera camera,
                       LightModel light,
                       Model model,
                       BgModel bg
                      )
    {
        // setup a camera aligned with the  light source
        float aspect = offWidth / (float)offHeight;
        float fov = 45.0f * (float)(FMath.PI / 180.0f);
        Matrix4 proj = Matrix4.Perspective( fov,
                                            aspect,
                                            1.0f,
                                            10000.0f );
        Matrix4 view = Matrix4.LookAt( light.Position, model.Position, new Vector3( 0.0f, 1.0f, 0.0f ) );
 		Matrix4 world = model.Posture;
        Matrix4 lightVP = proj * view;

        // pass 1
        renderShadowMap( graphics, lightVP * world, model );

        // pass 2
		graphics.Clear();

        drawModel( graphics, camera, lightVP, model );
        light.Render( graphics, camera );

        // test
        texRenderer.Begin();
        int width = texShadow.Width / 2;
        int height = texShadow.Height / 2;
        texRenderer.Render( texShadow, ShaderCatalog.DspWidth - width, 0, 0, 0, width, height );
        texRenderer.End();
    }
Пример #4
0
        public static bool Render()
        {
            var gamePadData = GamePad.GetData(0);

            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            //SampleDraw.ClearSprite(); //FIXME:modified, for preventing memory overflow

            int fontHeight = SampleDraw.CurrentFont.Metrics.Height;
            int positionX  = (SampleDraw.Width / 5);
            int positionY  = ((SampleDraw.Height / 2) - (428 / 2)) + (fontHeight * 3);

            foreach (GamePadButtons item in Enum.GetValues(typeof(GamePadButtons)))
            {
                drawPadState(positionX, positionY, item.ToString(), (gamePadData.Buttons & item) != 0);
                positionY += fontHeight;
            }

            positionX = (SampleDraw.Width / 5) * 3;
            positionY = ((SampleDraw.Height / 2) - (428 / 2)) + (fontHeight * 3);

            SampleDraw.DrawText("AnalogLeftX : " + gamePadData.AnalogLeftX, 0xffffffff, positionX, positionY);
            positionY += fontHeight;
            SampleDraw.DrawText("AnalogLeftY : " + gamePadData.AnalogLeftY, 0xffffffff, positionX, positionY);
            positionY += fontHeight;
            SampleDraw.DrawText("AnalogRightX : " + gamePadData.AnalogRightX, 0xffffffff, positionX, positionY);
            positionY += fontHeight;
            SampleDraw.DrawText("AnalogRightY : " + gamePadData.AnalogRightY, 0xffffffff, positionX, positionY);

            SampleDraw.DrawText("GamePad Sample", 0xffffffff, 0, 0);
            graphics.SwapBuffers();

            return(true);
        }
Пример #5
0
        public void Render()
        {
            // Clear the screen
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            if (state != State.VIEW)
            {
                if (directories != null)
                {
                    DrawDirectories();
                }
                if (files != null)
                {
                    DrawFiles();
                }
            }
            else if (state == State.VIEW)
            {
                DrawImages();
                DrawPageNumber();
            }

            //SampleDraw.DrawText(pad.ButtonsPrev.ToString(),0xffffffff,10,100);

            // Present the screen
            graphics.SwapBuffers();
        }
Пример #6
0
        private static void OnDraw(GraphicsContext gfx, float dt)
        {
            gfx.Clear(Palette.Background);

            // Draw World
            gfx.PushState(true);
            {
                var camera = Player.Position - (0, 100);
                gfx.SetCameraTransform(camera);

                // Draw environment
                for (var i = -12; i < 12; i++)
                {
                    gfx.DrawImage(GroundTop, new Vector(i * 70, 0));
                    gfx.DrawImage(GroundBottom, new Vector(i * 70, 70));
                }

                gfx.DrawImage(Rock, new Vector(20, -70));
                gfx.DrawImage(Bush, new Vector(-20, -70));

                var paralax = camera / 3F;
                gfx.DrawImage(Clouds[0], new Vector(+220, -170) + paralax);
                gfx.DrawImage(Clouds[1], new Vector(-70, -270) + paralax);
                gfx.DrawImage(Clouds[2], new Vector(-220, -170) + paralax);

                // Draw player
                Player.Draw(gfx, dt);
            }
            gfx.PopState();

            // Draw chatbox
            Chatbox.Draw(gfx, dt);
        }
Пример #7
0
        public static bool Render()
        {
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            uint[] colorTable = { 0xffff0000,
                                  0xff00ff00,
                                  0xff0000ff,
                                  0xffffff00 };

            foreach (var touchData in Touch.GetData(0))
            {
                if (touchData.Status == TouchStatus.Down ||
                    touchData.Status == TouchStatus.Move)
                {
                    int pointX  = (int)((touchData.X + 0.5f) * SampleDraw.Width);
                    int pointY  = (int)((touchData.Y + 0.5f) * SampleDraw.Height);
                    int colorId = touchData.ID % colorTable.Length;

                    SampleDraw.FillCircle(colorTable[colorId], pointX, pointY, 96);
                }
            }

            SampleDraw.DrawText("Touch Sample", 0xffffffff, 0, 0);
            graphics.SwapBuffers();

            return(true);
        }
Пример #8
0
 public static void Render()
 {
     graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
     graphics.Clear();
     UISystem.Render();
     graphics.SwapBuffers();
 }
Пример #9
0
        static bool Render()
        {
            float seconds = (float)stopwatch.ElapsedMilliseconds / 1000.0f;
            float aspect  = graphics.Screen.AspectRatio;
            float fov     = FMath.Radians(45.0f);

            Matrix4 proj = Matrix4.Perspective(fov, aspect, 1.0f, 1000000.0f);
            Matrix4 view = Matrix4.LookAt(new Vector3(0.0f, 0.5f, 3.0f),
                                          new Vector3(0.0f, 0.5f, 0.0f),
                                          Vector3.UnitY);
            Matrix4 world = Matrix4.RotationY(1.0f * seconds);

            Matrix4 worldViewProj = proj * view * world;

            program.SetUniformValue(0, ref worldViewProj);


            graphics.SetViewport(0, 0, graphics.Screen.Width, graphics.Screen.Height);
            graphics.SetClearColor(0.0f, 0.5f, 1.0f, 0.0f);
            graphics.Clear();

            graphics.SetShaderProgram(program);
            graphics.SetVertexBuffer(0, vertices);
            graphics.DrawArrays(DrawMode.TriangleStrip, 0, 3);


            SampleDraw.DrawText("Triangle Sample", 0xffffffff, 0, 0);

            graphics.SwapBuffers();
            return(true);
        }
Пример #10
0
    private void renderShadowMap( 
                                 GraphicsContext graphics,
                                 Matrix4 lightWVP,
                                 Model model
                                  )
    {
        // setup to render the ShadowMap
        FrameBuffer oldBuffer = graphics.GetFrameBuffer();
        graphics.SetFrameBuffer( frameBuffer );
		graphics.SetViewport(0, 0, offWidth, offHeight);
		graphics.SetClearColor( 1.0f, 1.0f, 1.0f, 1.0f ) ;
        graphics.Enable( EnableMode.Blend, false );
		graphics.Clear() ;

        // render the model
        shaderShadowMap.SetUniformValue( shaderShadowMap.FindUniform( "WorldViewProj" ), ref lightWVP );

		graphics.SetShaderProgram( shaderShadowMap );

        Vector4 color = new Vector4( 0.0f, 0.0f, 0.0f, 0.5f );
        shaderShadowMap.SetUniformValue( shaderShadowMap.FindUniform( "MaterialColor" ), ref color );

		graphics.SetVertexBuffer( 0, vbTeapot );
        graphics.DrawArrays( model.Mesh.Prim, 0, model.Mesh.IndexCount );

        // restore the frame buffer
        graphics.SetFrameBuffer( oldBuffer );
        graphics.Enable( EnableMode.Blend, true );
		graphics.SetViewport(0, 0, ShaderCatalog.DspWidth, ShaderCatalog.DspHeight );
		graphics.SetClearColor( 0.0f, 0.5f, 1.0f, 1.0f ) ;
    }
Пример #11
0
        public static void Render()
        {
            // Clear the screen
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            //Pick State
            switch (currentState)
            {
            case GameState.Menu: RenderMenu(); break;

            case GameState.Credits: RenderCredits(); break;

            case GameState.Paused: RenderPaused(); break;

            case GameState.Playing: RenderPlay(); break;

            case GameState.GameOver: RenderGameOver(); break;

            case GameState.HighScore: RenderHighScore(); break;

            case GameState.Instructions: RenderInstructions(); break;
            }

            // Present the screen
            graphics.SwapBuffers();
        }
Пример #12
0
 public override void DrawScrollBar(GraphicsContext gfx, Hitbox up, Hitbox down, Hitbox nub)
 {
     gfx.Clear(Color.White);
     gfx.FillRectangle(up.Bounds, Color.Gray);
     gfx.FillRectangle(down.Bounds, Color.Gray);
     gfx.FillRectangle(nub.Bounds, Color.Gray);
 }
Пример #13
0
        /// <inheritdoc/>
        public override void DrawButton(GraphicsContext gfx, string text, Texture2D image, UIButtonState state, bool showImage, Rectangle imageRect, Rectangle textRect)
        {
            var bg = GetAccentColor().Darken(0.35F);
            var fg = _bStateTextIdle;

            switch (state)
            {
            case UIButtonState.Hover:
                bg = bg.Lighten(0.2F);
                fg = _bStateTextHover;
                break;

            case UIButtonState.Pressed:
                bg = bg.Darken(0.2F);
                fg = _bStateTextIdle;
                break;
            }

            gfx.Clear(bg);

            if (showImage)
            {
                gfx.DrawRectangle(imageRect.X, imageRect.Y, imageRect.Width, imageRect.Height, image, fg);
            }
            gfx.DrawString(text, textRect.X, textRect.Y, fg, _highlight, TextAlignment.Left, textRect.Width, Plex.Engine.TextRenderers.WrapMode.Words);
        }
Пример #14
0
        /// <summary>
        /// Fire a render event.
        /// </summary>
        /// <param name="time">The time since the last frame.</param>
        /// <param name="gfx">The graphics context to render the control to.</param>
        public void Draw(GameTime time, GraphicsContext gfx)
        {
            if (Visible == false || Width == 0 || Height == 0)
            {
                return;
            }
            if (Opacity <= 0)
            {
                return;
            }
            //If we're disabled, set the Grayout property.

            if (((Opacity < 1) || Enabled == false) && _userfacingtarget == null)
            {
                _userfacingtarget = gfx.CreateRenderTarget(Width, Height);
            }
            else if (Opacity == 1 || Enabled == true)
            {
                if (_userfacingtarget != null)
                {
                    _userfacingtarget.Dispose();
                    _userfacingtarget = null;
                }
            }
            gfx.ScissorRectangle = GetScissorRectangle();

            if (gfx.ScissorRectangle == Rectangle.Empty)
            {
                return;
            }

            var screenPos = ToScreen(0, 0);

            gfx.RenderOffsetX = -(gfx.X - (int)screenPos.X);
            gfx.RenderOffsetY = -(gfx.Y - (int)screenPos.Y);


            if (_userfacingtarget != null)
            {
                gfx.SetRenderTarget(BackBuffer);
                gfx.Clear(Color.Transparent);
            }

            OnPaint(time, gfx);

            foreach (var child in Children)
            {
                child.Draw(time, gfx);
                if (child._userfacingtarget != null)
                {
                    var s    = ToScreen(child.X, child.Y);
                    var tint = child.Enabled ? Color.White : Color.Gray;
                    gfx.FillRectangle(new RectangleF(s.X, s.Y, child.Width, child.Height), child._userfacingtarget, tint * child.Opacity);
                }
            }
            if (_userfacingtarget != null)
            {
                gfx.SetRenderTarget(Parent?.BackBuffer ?? GameLoop.GetInstance().GameRenderTarget);
            }
        }
Пример #15
0
        public static bool Render()
        {
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            //SampleDraw.ClearSprite(); //FIXME:modified, for preventing memory overflow

            var     motionData = Motion.GetData(0);
            Vector3 acc        = motionData.Acceleration;
            Vector3 vel        = motionData.AngularVelocity;

            int fontHeight = SampleDraw.CurrentFont.Metrics.Height;
            int positionX  = 256;
            int positionY  = fontHeight * 3;

            SampleDraw.DrawText("Acceleration X : " + acc.X, 0xffffffff, positionX, positionY);
            positionY += fontHeight;
            SampleDraw.DrawText("Acceleration Y : " + acc.Y, 0xffffffff, positionX, positionY);
            positionY += fontHeight;
            SampleDraw.DrawText("Acceleration Z : " + acc.Z, 0xffffffff, positionX, positionY);

            positionY += fontHeight * 2;

            SampleDraw.DrawText("AngularVelocity X : " + vel.X, 0xffffffff, positionX, positionY);
            positionY += fontHeight;
            SampleDraw.DrawText("AngularVelocity Y : " + vel.Y, 0xffffffff, positionX, positionY);
            positionY += fontHeight;
            SampleDraw.DrawText("AngularVelocity Z : " + vel.Z, 0xffffffff, positionX, positionY);

            SampleDraw.DrawText("Motion Sample", 0xffffffff, 0, 0);
            graphics.SwapBuffers();

            return(true);
        }
Пример #16
0
            void Update(GraphicsContext gfx, float dt)
            {
                //
                gfx.Clear(Color.DarkGray);

                //
                if (benchmarkIndex < benchmarks.Length)
                {
                    var benchmark = benchmarks[benchmarkIndex];

                    // Update and draw stage
                    benchmark.UpdateBenchmark(gfx, in bounds, dt);

                    // If the stage is complete, move to the next stage
                    if (benchmark.IsComplete)
                    {
                        Console.WriteLine($"{benchmark.Name}: {benchmark.Score}");

                        //
                        GotoNextBenchmark();
                    }

                    //
                    DrawInformation(gfx, $"\"{benchmark.Name}\" - {benchmark.Progress * 100F:N2}% - {gfx.CurrentFPS:N0} FPS");
                }
                else
                {
                    var results = GetResultsText(benchmarks);

                    // Draw Results Stage
                    DrawInformation(gfx, results);
                    Thread.Sleep(2); // force to render slower
                }
            }
Пример #17
0
        public static void Main(string[] args)
        {
            //Initialize ();

            GraphicsContext graphics = new GraphicsContext();
            UISystem.Initialize(graphics);

            window = new HighScoreApp.MainWindow();
            UISystem.SetScene(window);
            socket = new Sockets();

            while (true) {
                SystemEvents.CheckEvents();

                List<TouchData> touchData = Touch.GetData(0);
                UISystem.Update (touchData);

                Update ();

                graphics.SetViewport(0, 0, graphics.Screen.Width, graphics.Screen.Height);
                graphics.SetClearColor(new Vector4(0,0,0,1));
                graphics.SetClearDepth(1.0f);
                graphics.Clear();

                UISystem.Render ();
                graphics.SwapBuffers();
            }
        }
Пример #18
0
        private static void Update(GraphicsContext gfx, float dt)
        {
            Time += dt;

            // Clear the frame
            gfx.Clear(Color.DarkGray);

            // Here we update some shader uniforms.
            DistortionShader.Offset = new Vector(Time / 5, Time / 2);
            GrayscaleShader.Blend   = Calc.Osc(Time);
            InvertShader.Blend      = Calc.Osc(Time);

            // Its important to note that updating a uniform effectively interrupts the batching
            // mechanism (once the shader is actually used), causing an unreconcilable state and
            // forces a flush (see the documentation on github for further description). Thus it
            // is good practice to try to engineer your shaders in a way that you can avoid
            // updating your uniforms multiple times within a single frame. However, sometime
            // this is difficult to avoid.

            // Draws w/ grayscale shader
            gfx.Shader = DistortionShader;
            gfx.DrawImage(Images[0], Matrix.CreateTranslation(Padding + (Padding + Images[0].Width) * 3, Padding));

            // Draws w/ grayscale shader
            gfx.Shader = GrayscaleShader;
            gfx.DrawImage(Images[1], Matrix.CreateTranslation(Padding + (Padding + Images[0].Width) * 2, Padding));

            // Draws w/ inversion shader
            gfx.Shader = InvertShader;
            gfx.DrawImage(Images[2], Matrix.CreateTranslation(Padding + (Padding + Images[0].Width) * 1, Padding));

            // Draws w/ default shader
            gfx.Shader = Shader.Default;
            gfx.DrawImage(Images[3], Matrix.CreateTranslation(Padding + (Padding + Images[0].Width) * 0, Padding));
        }
Пример #19
0
        public static bool Render()
        {
            bool clearColor = (totalBlack > totalWhite);

            graphics.SetViewport(0, 0, graphics.GetFrameBuffer().Width, graphics.GetFrameBuffer().Height);
            if (clearColor)
            {
                graphics.SetClearColor(0.0f, 0.0f, 0.0f, 255.0f);
            }
            else
            {
                graphics.SetClearColor(255.0f, 255.0f, 255.0f, 255.0f);
            }
            graphics.Clear();

            SampleDraw.DrawText("Bad Apple!!! Mobile", clearColor ? 0xFFFFFFFF : 0xFF000000, 0, 0);
            SampleDraw.DrawText("Frame " + frameCount.ToString() + "/6572", clearColor ? 0xFFFFFFFF : 0xFF000000, 0, 510);
            SampleDraw.DrawSprite(spr);

            graphics.SwapBuffers();

            while (timer.ElapsedMilliseconds < (limit - lastTime))
            {
            }
            ;
            lastTime = timer.ElapsedMilliseconds - (limit - lastTime);

            return(true);
        }
Пример #20
0
        /// render
        public static bool Render()
        {
            graphics.SetViewport(0, 0, screenWidth, screenHeight);
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            button0.Draw();
            button1.Draw();
            button2.Draw();

            inputTextButton.Draw();

            SampleDraw.DrawText("Storage Sample", 0xffffffff, 0, 0);
            SampleDraw.DrawText("data", 0xffffffff, dialogXPos, 224);

            SampleDraw.DrawText(EVENT_LABEL, 0xffffffff, dialogXPos, 320);

            if (eventAction.Length > 0)
            {
                SampleDraw.DrawText(eventAction, 0xffffffff, dialogXPos, 360);
            }

            graphics.SwapBuffers();

            return(true);
        }
Пример #21
0
        internal override void Draw(GraphicsContext ctx, Rectangle contentBounds)
        {
            // == Draw curve to low res surface

            ctx.Surface = LowResSurface;
            ctx.Clear(Color.Transparent);

            var a = new Vector(0 / 3F, (Calc.Sin(Time * 1) + 1F) * 0.5F) * (Vector)LowResSurface.Size;
            var b = new Vector(1 / 3F, (Calc.Sin(Time * 2) + 1F) * 0.5F) * (Vector)LowResSurface.Size;
            var c = new Vector(2 / 3F, (Calc.Sin(Time * 3) + 1F) * 0.5F) * (Vector)LowResSurface.Size;
            var d = new Vector(3 / 3F, (Calc.Sin(Time * 4) + 1F) * 0.5F) * (Vector)LowResSurface.Size;

            // Draw the guide lines
            ctx.Color = Color.Gray;
            ctx.DrawLine(a, b);
            ctx.DrawLine(b, c);
            ctx.DrawLine(c, d);

            // Draw the main curve
            ctx.Color = Color.White;
            ctx.DrawCurve(a, b, c, d, 4);

            // == Draw surface centered within content bounds

            var newHeight = contentBounds.Height;
            var newWidth  = ctx.Surface.Width * (newHeight / ctx.Surface.Height);
            var offset    = (contentBounds.Width - newWidth) / 2F;

            var rect = new Rectangle(contentBounds.X + offset, contentBounds.Y, newWidth, newHeight);

            ctx.Surface = ctx.Screen.Surface;
            ctx.DrawImage(LowResSurface, rect);
        }
Пример #22
0
        public override void DrawPanel(GraphicsContext gfx, PanelStyles style)
        {
            switch (style)
            {
            case PanelStyles.Dark:
                gfx.Clear(_controlDark);
                break;

            case PanelStyles.Default:
                gfx.Clear(_controlRegular);
                break;

            case PanelStyles.Light:
                gfx.Clear(_controlLight);
                break;
            }
        }
Пример #23
0
        public override void Update()
        {
            if (Input.Down.Pushed)
            {
                _cursor = (_cursor + 1) % 5;
            }

            if (Input.Up.Pushed)
            {
                _cursor = (_cursor + 4) % 5;
            }

            if (Input.Sp1.Pushed)
            {
                switch (_cursor)
                {
                case 0:
                    Scene.Push(new GameScene());
                    break;

                case 1:
                    Scene.Push(new MasatoScene1());
                    break;

                case 2:
                    Scene.Push(new MasatoScene2());
                    break;

                case 3:
                    Scene.Push(new MasatoScene3());
                    break;

                case 4:
                    Application.Exit();
                    break;
                }
            }

            // 下に戻っちゃうのは入力を pushed と pressed に分ければ解決する。
            if (Input.Sp2.Pushed)
            {
                _cursor = 4;
            }

            foreach (var item in _menu)
            {
                item._selected = false;
            }
            _menu[_cursor]._selected = true;



            GraphicsContext.Clear(Color.White);
            foreach (var item in _menu)
            {
                item.Draw();
            }
        }
Пример #24
0
        public override bool AcceptInput(ConsoleKeyInfo keyPressed, GraphicsContext g)
        {
            if (_escPressedOnce)
            {
                if (keyPressed.Key == ConsoleKey.Escape)
                {
                    if (_app.Tasks.GetTasks().Count != 0)
                    {
                        _app.ShowHelpMessage("Tasks are still running, try again later", g, ConsoleColor.Red);
                        _escPressedOnce = false;
                        return(true);
                    }

                    g.Clear();
                    Environment.Exit(0);
                    return(true);
                }

                _app.ShowHelpMessage("Exit cancelled (press Escape twice to exit)", g);
                _escPressedOnce = false;
            }

            var b = base.AcceptInput(keyPressed, g);

            if (b)
            {
                return(true);
            }

            if (keyPressed.Key == ConsoleKey.Escape)
            {
                _app.ShowHelpMessage("Press Escape again to exit SCFE", g, ConsoleColor.Yellow);
                _escPressedOnce = true;
                return(true);
            }

            if (_app.CurrentMode.SearchEnabled && keyPressed.KeyChar != (char)0 &&
                !char.IsControl(keyPressed.KeyChar) &&
                keyPressed.Key != ConsoleKey.Enter &&
                (keyPressed.Modifiers & ConsoleModifiers.Control) == 0 &&
                (keyPressed.Modifiers & ConsoleModifiers.Alt) == 0)
            {
                SetFocused(false, g);
                _app.TextBox.Text          += keyPressed.KeyChar;
                _app.TextBox.CaretPosition += 1;
                _app.TextBox.Print(_app.TextBox.Width - 5, g);

                if (_app.TextBoxHandler == null)
                {
                    _app.SwitchToFolder(_app.CurrentDir, g);
                }
                _app.TextBox.SetFocused(true, g);
                return(true);
            }

            return(false);
        }
Пример #25
0
 public override void DrawCheckBox(GraphicsContext gfx, bool check, bool containsMouse)
 {
     gfx.Clear(Color.White);
     gfx.FillRectangle(2, 2, gfx.Width - 4, gfx.Height - 4, (containsMouse) ? _controlLight : _controlDark);
     if (check)
     {
         gfx.FillRectangle(0, 0, gfx.Width, gfx.Height, _check, Color.White);
     }
 }
Пример #26
0
        public void PlatformClear(ClearOptions options, Vector4 color, float depth, int stencil)
        {
            // TODO: We need to figure out how to detect if we have a
            // depth stencil buffer or not, and clear options relating
            // to them if not attached.

            _graphics.SetClearColor(color.ToPssVector4());
            _graphics.Clear();
        }
Пример #27
0
        private static void Draw(GraphicsContext graphics)
        {
            graphics.Clear(Color.Black);

            graphics.Begin();
            graphics.DrawSprite(texture, Vector2.Zero);
            graphics.DrawString(font, "goodbye World!", Vector2.Zero);
            graphics.End();
        }
Пример #28
0
        public override void Update()
        {
            if (Input.Sp2.Pushed)
            {
                Scene.Pop();
            }

            GraphicsContext.Clear(Color.White);
            GraphicsContext.DrawImage(_img, 0, 0);
        }
Пример #29
0
        public static void Render()
        {
            graphics.Clear();

            //プレイヤー描画
            player.Draw();

            //画面更新
            graphics.SwapBuffers();
        }
Пример #30
0
        public static bool Render()
        {
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            SampleDraw.DrawText("SystemEvents Sample", 0xffffffff, 0, 0);
            graphics.SwapBuffers();

            return(true);
        }
Пример #31
0
        public static void Render()
        {
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            if (start || directions || highscore || enterscore || end)
            {
                if (start)
                {
                    startScr.Render();
                }
                if (directions)
                {
                    directionsScr.Render();
                }
                if (highscore)
                {
                    highScr.Render();
                    UISystem.Render();
                }
                if (enterscore)
                {
                    enterScr.Render();
                    UISystem.Render();
                }
                if (end)
                {
                    endScr.Render();
                }
            }
            else
            {
                shine.Render();
                portal.Render();
                if (!gotLazer)
                {
                    lazer.Render();
                }
                if (!gotFlame)
                {
                    flamethrower.Render();
                }
                renderLists();
                player.Render();
                wpn.Render();
                //tester.Render (); //*x
                if (paused)
                {
                    pauseScr.Render();
                }
                UISystem.Render();
            }

            graphics.SwapBuffers();
        }
        static void Main(string[] args)
        {
            graphics = new GraphicsContext(960,544,PixelFormat.Rgba,PixelFormat.Depth16,MultiSampleMode.None);
            UISystem.Initialize(graphics);

            MainScene scene = new MainScene();
            SetupListNum(scene.RootWidget);
            scene.SetWidgetLayout(LayoutOrientation.Horizontal);
            UISystem.SetScene(scene);
            for (; ; )
            {
                SystemEvents.CheckEvents();

                // update
                {
                    List<TouchData> touchDataList = Touch.GetData(0);
                    var gamePad = GamePad.GetData (0);
                    UISystem.Update(touchDataList, ref gamePad);
                }

                // draw
                {
                    graphics.SetViewport(0, 0, graphics.Screen.Width, graphics.Screen.Height);
                    graphics.SetClearColor(
                        0xFF,
                        0xFF,
                        0xFF,
                        0xff);
                    graphics.Clear();

                    UISystem.Render();
                    graphics.SwapBuffers();
                }
            }
        }