Beispiel #1
0
        public static bool Init()
        {
            graphics = new GraphicsContext();
            SampleDraw.Init(graphics);

            int rectW = SampleDraw.Width / 2;
            int rectH = 32;
            int rectX = (SampleDraw.Width - rectW) / 2;
            int rectY = (SampleDraw.Height - 24) / 2;

            button = new SampleButton(rectX, rectY, rectW, rectH);
            button.SetText("InputText", SampleButton.TextAlign.Left, SampleButton.VerticalAlign.Middle);

            dialog = null;

            return(true);
        }
Beispiel #2
0
        ///
        private static void drawPadState(int positionX, int positionY, string buttonName, bool isButtonDown)
        {
            uint   argb;
            string buttonState;

            if (isButtonDown)
            {
                argb        = 0xffff0000;
                buttonState = "ON";
            }
            else
            {
                argb        = 0xffffffff;
                buttonState = "OFF";
            }

            SampleDraw.DrawText("" + buttonName + " : " + buttonState, argb, positionX, positionY);
        }
Beispiel #3
0
        public static bool Render()
        {
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            SampleDraw.DrawText("Status : " + bgmPlayer.Status, 0xffffffff, 0, 64);
            SampleDraw.DrawText("Volume", 0xffffffff, volTextPosX, volTextPosY);

            playButton.Draw();
            stopButton.Draw();
            pauseButton.Draw();
            resumeButton.Draw();
            volumeSlider.Draw();

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

            return(true);
        }
        /// terminate
        public static void Term()
        {
            button0.Dispose();
            button1.Dispose();
            button2.Dispose();
            button3.Dispose();

            slider.Dispose();

            inputTextButton.Dispose();
            if (dialog != null)
            {
                dialog.Dispose();
                dialog = null;
            }

            SampleDraw.Term();
            graphics.Dispose();
        }
Beispiel #5
0
        static void Render()
        {
            float delta = (float)stopwatch.ElapsedMilliseconds / 1000.0f;

            stopwatch = Stopwatch.StartNew();

            model.RotateX(0.25f * delta);
            model.RotateY(-0.25f * delta);
            light.Update(delta);

            sceneList[id].Update(delta);
            sceneList[id].Render(graphics, camera, light, model, modelBg);

            graphics.Enable(EnableMode.CullFace, false);
            SampleDraw.DrawText("ShaderCatalog Sample", 0xffffffff, 0, 0);
            SampleDraw.DrawText(sceneList[id].Name, 0xffffffff, 0, 48);
            graphics.Enable(EnableMode.CullFace, true);
            graphics.SwapBuffers();
        }
Beispiel #6
0
        static void Init()
        {
            graphics  = new GraphicsContext();
            stopwatch = new Stopwatch();
            stopwatch.Start();

            SampleDraw.Init(graphics);

            // framebuffer

            frameBuffer   = new FrameBuffer();
            renderTexture = new Texture2D(offscreenWidth, offscreenHeight, false, PixelFormat.Rgba, PixelBufferOption.Renderable);
            depthBuffer   = new DepthBuffer(offscreenWidth, offscreenHeight, PixelFormat.Depth16);
            frameBuffer.SetColorTarget(renderTexture, 0);
            frameBuffer.SetDepthTarget(depthBuffer);

            // vcolor shader

            vcolorShader = new ShaderProgram("/Application/Sample/Graphics/PixelBufferSample/shaders/VertexColor.cgx");
            vcolorShader.SetUniformBinding(0, "WorldViewProj");
            vcolorShader.SetAttributeBinding(0, "a_Position");
            vcolorShader.SetAttributeBinding(1, "a_Color0");

            // texture shader

            textureShader = new ShaderProgram("/Application/Sample/Graphics/PixelBufferSample/shaders/Texture.cgx");
            textureShader.SetUniformBinding(0, "WorldViewProj");
            textureShader.SetAttributeBinding(0, "a_Position");
            textureShader.SetAttributeBinding(1, "a_TexCoord");

            // vertex buffer

            triangleVertices = CreateTriangleVertices();
            cubeVertices     = CreateCubeVertices();

            // renderstate

            graphics.Enable(EnableMode.DepthTest);
            graphics.Enable(EnableMode.CullFace);
            graphics.SetCullFace(CullFaceMode.Back, CullFaceDirection.Ccw);
            graphics.Enable(EnableMode.CullFace, false);
        }
        public static bool Render()
        {
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            int fontHeight = SampleDraw.CurrentFont.Metrics.Height;
            int positionX  = (graphics.Screen.Width / 2) - 192;
            int positionY  = (graphics.Screen.Height / 2) - (fontHeight * 3);

            positionY += fontHeight * 2;
            SampleDraw.DrawText("GamePadButtonMeaning : " + SystemParameters.GamePadButtonMeaning.ToString(), 0xffffffff, positionX, positionY);
            positionY += fontHeight;
            SampleDraw.DrawText("Language : " + SystemParameters.Language, 0xffffffff, positionX, positionY);
            positionY += fontHeight;
            SampleDraw.DrawText("YesNoLayout : " + SystemParameters.YesNoLayout.ToString(), 0xffffffff, positionX, positionY);

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

            return(true);
        }
Beispiel #8
0
        public static bool Init()
        {
            graphics = new GraphicsContext();
            SampleDraw.Init(graphics);


            inputTextButton = new SampleButton(32, 64, 480, 32);
            copyButton      = new SampleButton(544, 64, 96, 32);
            pasteButton     = new SampleButton(32, 240, 96, 32);
            copyTextButton  = new SampleButton(160, 240, 480, 32);

            copyTextButton.ButtonColor = 0xff7f7f7f;

            inputTextButton.SetText("InputText", SampleButton.TextAlign.Left, SampleButton.VerticalAlign.Middle);
            copyButton.SetText("Copy");
            pasteButton.SetText("Paste");
            copyTextButton.SetText("CopyText", SampleButton.TextAlign.Left, SampleButton.VerticalAlign.Middle);

            dialog = null;

            return(true);
        }
        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();
            button3.Draw();

            slider.Draw();

            inputTextButton.Draw();

            SampleDraw.DrawText("PersistentMemory Sample", 0xffffffff, 0, 0);
            SampleDraw.DrawText("Toggle Button", 0xffffffff, (((screenWidth - (BUTTON_NO * 128)) / 2) + 16), 96);
            SampleDraw.DrawText("TextDialog", 0xffffffff, ((screenWidth - 480) / 2), 224);
            SampleDraw.DrawText("Slider", 0xffffffff, ((screenWidth - 384) / 2), 330);
            graphics.SwapBuffers();

            return(true);
        }
Beispiel #10
0
        static bool Render()
        {
            int dspWidth  = graphics.Screen.Width;
            int dspHeight = graphics.Screen.Height;

            Matrix4 proj = Matrix4.Ortho(0, dspWidth, dspHeight, 0, 0.0f, 32768.0f);

            program.SetUniformValue(0, ref proj);

            graphics.SetViewport(0, 0, dspWidth, dspHeight);
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();

            graphics.SetShaderProgram(program);
            graphics.SetVertexBuffer(0, vertices);
            graphics.DrawArrays(modeInfo[modeIndex].drawMode, 0, vertices.VertexCount);


            SampleDraw.DrawText("Primitive Sample", 0xffffffff, 0, 0);
            SampleDraw.DrawText(modeInfo[modeIndex].desc, 0xffffffff, 0, 48);

            graphics.SwapBuffers();
            return(true);
        }
Beispiel #11
0
 static void Term()
 {
     SampleDraw.Term();
     frameBuffer.Dispose();
     graphics.Dispose();
 }
 /// Terminate
 public static void Term()
 {
     SampleDraw.Term();
     graphics.Dispose();
 }
Beispiel #13
0
        public static bool Render()
        {
            graphics.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            graphics.Clear();
            serverButton.SetText(tcpServer.buttonString);
            clientButton.SetText(tcpClient.buttonString);

            List <TouchData> touchDataList = Touch.GetData(0);

            // Modify status
            if (serverButton.TouchDown(touchDataList))
            {
                tcpServer.ChangeStatus();
            }
            if (clientButton.TouchDown(touchDataList))
            {
                tcpClient.ChangeStatus();
            }

            /*
             * uint[] colorTable = {0xffff0000,
             *                                       0xff00ff00,
             *                                       0xff0000ff,
             *                                       0xffffff00};
             */
            foreach (var touchData in touchDataList)
            {
                /*
                 *                      if (touchData.Status == TouchStatus.Down ||
                 *                              touchData.Status == TouchStatus.Move) {
                 *
                 *                              int pointX = (int)((touchData.X + 0.5f) * Graphics2D.Width);
                 *                              int pointY = (int)((touchData.Y + 0.5f) * Graphics2D.Height);
                 *                              int radius = (int)(touchData.Force * 32);
                 *                              int colorId = touchData.ID % colorTable.Length;
                 *
                 *                              Graphics2D.FillCircle(colorTable[colorId], pointX, pointY, radius);
                 *
                 *                      }
                 */
                if (touchData.Status == TouchStatus.Down)
                {
                    int pointX = (int)((touchData.X + 0.5f) * SampleDraw.Width);
                    int pointY = (int)((touchData.Y + 0.5f) * SampleDraw.Height);
                    if (pointX < (SampleDraw.Width / 2))
                    {
                        tcpServer.SetMyPosition(pointX, pointY);
                    }
                    else
                    {
                        tcpClient.SetMyPosition(pointX - (SampleDraw.Width / 2), pointY);
                    }
                }
            }

            // Display button and status
            serverButton.Draw();
            clientButton.Draw();
            drawStatus(tcpServer);
            drawStatus(tcpClient);

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

            return(true);
        }
Beispiel #14
0
        public override void Draw()
        {
            base.Draw();

            SampleDraw.FillRect(barColor, rectX, rectY, (int)(rectW * rate), rectH);
        }
Beispiel #15
0
 public void Render()
 {
     SampleDraw.DrawSprite(sprite);
 }
Beispiel #16
0
 public virtual void Draw()
 {
     SampleDraw.FillRect(buttonColor, rectX, rectY, rectW, rectH);
 }
Beispiel #17
0
        public override void Draw()
        {
            base.Draw();

            SampleDraw.DrawSprite(textSprite);
        }