示例#1
0
        public void Update()
        {
            drawScreen.Update();

            Raylib.BeginDrawing();
            Raylib.BeginTextureMode(renderTexture);
            Raylib.ClearBackground(Color.BLACK);

            Raylib.BeginMode3D(camera);

            ModelRenderer.RenderQueue();

            Raylib.EndMode3D();
            Raylib.EndTextureMode();

            Raylib.ClearBackground(Color.BLACK);


            Raylib.DrawTexturePro(
                renderTexture.texture,
                new Rectangle(0, 0, renderTexture.texture.width, -renderTexture.texture.height),
                new Rectangle(0, 0, 640, 480),
                Vector2.Zero,
                0,
                Color.RAYWHITE
                );

            drawScreen.Render();
            Raylib.EndDrawing();

            Debug.Label("swap window");
        }
示例#2
0
        public void Draw(RenderTexture2D target)
        {
            Raylib.BeginDrawing();
            {
                Raylib.BeginTextureMode(target);

                Raylib.ClearBackground(new Color(36, 36, 36, 255));

                Raylib.DrawTextEx(
                    font, MoonVars.Name,
                    new Vector2(
                        Text.Center(MoonVars.RenderWidth, (int)textMeasure.X),
                        MoonVars.RenderHeight / 4
                        ),
                    fontSize, 1, new Color(196, 196, 196, 255)
                    );

                Raylib.DrawTextEx(
                    instructFont, "Press Enter to Start",
                    new Vector2(
                        Text.Center(MoonVars.RenderWidth, (int)instructMeasure.X),
                        MoonVars.RenderHeight / 4 * 3
                        ),
                    instructFontSize, 1, Color.DARKBLUE
                    );

                stars.Draw();

                Raylib.EndTextureMode();
            }
            Raylib.EndDrawing();
        }
示例#3
0
        public void Draw(RenderTexture2D target)
        {
            Raylib.BeginDrawing();
            {
                Raylib.BeginTextureMode(target);

                Raylib.ClearBackground(new Color(36, 36, 36, 255));

                Raylib.BeginMode2D(_camera);

                DrawGlobal();

                switch (GameState.CurrentPhase)
                {
                case EGamePhase.InitialPlacement:
                    DrawInitialPlacementCamera();
                    break;

                case EGamePhase.Expanding:
                    DrawConnections();
                    DrawExpandingCamera();
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                Raylib.EndMode2D();

                DrawGlobalUi();

                switch (GameState.CurrentPhase)
                {
                case EGamePhase.InitialPlacement:
                    DrawInitialPlacementUi();
                    break;

                case EGamePhase.Expanding:
                    DrawExpandingUi();
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }

                Raylib.EndTextureMode();
            }

            Raylib.EndDrawing();
        }
        private void _render()
        {
            Raylib.BeginDrawing();
            Raylib.BeginTextureMode(texture);
            //Raylib.ClearBackground(Color.BLACK);

            Raylib.DrawRectangle(50, 50, 1, 1, Color.WHITE);
            Raylib.DrawTexture(starTex90, 100, 100, Color.WHITE);
            Raylib.DrawTexture(starTex, MoonVars.RenderWidth / 2, MoonVars.RenderHeight / 2, Color.WHITE);
            Raylib.DrawRectangle(48, 50, 1, 1, new Color(255, 255, 255, 255));
            Raylib.DrawRectangle(51, 50, 1, 1, new Color(255, 255, 255, 255));
            Raylib.DrawRectangle(50, 51, 1, 1, new Color(255, 255, 255, 255));
            Raylib.DrawRectangle(50, 48, 1, 1, new Color(255, 255, 255, 255));

            Raylib.EndTextureMode();
            Raylib.EndDrawing();
        }
示例#5
0
        public void Update()
        {
            drawScreen.Update();

            Raylib.BeginDrawing();

            Raylib.BeginTextureMode(renderTexture);
            Raylib.ClearBackground(Color.BLACK);
            Raylib.BeginMode3D(camera);
            ModelRenderer.RenderQueue();
            Raylib.EndMode3D();
            Raylib.EndTextureMode();

            Raylib.ClearBackground(Color.BLACK);
            //Console.WriteLine(renderTexture.depth.id);

            Raylib.BeginShaderMode(postProcessShader);
            Raylib.SetShaderValueTexture(postProcessShader, Raylib.GetShaderLocation(postProcessShader, "depthTexture"), renderTexture.depth);
            unsafe
            {
                Vector4 screenDims = new Vector4(screenWidth, screenHeight, windowWidth, windowHeight);
                IntPtr  pointer    = new IntPtr(&screenDims);
                Raylib.SetShaderValue(
                    postProcessShader,
                    Raylib.GetShaderLocation(postProcessShader, "screenSize"),
                    pointer,
                    ShaderUniformDataType.SHADER_UNIFORM_VEC4
                    );
            }

            Raylib.DrawTexturePro(
                renderTexture.texture,
                new Rectangle(0, 0, renderTexture.texture.width, -renderTexture.texture.height),
                new Rectangle(0, 0, windowWidth, windowHeight),
                Vector2.Zero,
                0,
                Color.WHITE
                );
            Raylib.EndShaderMode();
            drawScreen.Render();
            Rlgl.rlDrawRenderBatchActive();

            Raylib.EndDrawing();

            Debug.Label("swap window");
        }
示例#6
0
        public void Draw(RenderTexture2D target)
        {
            Raylib.BeginDrawing();
            {
                Raylib.BeginTextureMode(target);

                Raylib.ClearBackground(bgColor);

                stars.Draw();

                Raylib.DrawTextEx(font, "nehpe",
                                  new Vector2(
                                      Text.Center(MoonVars.RenderWidth, (int)textMeasure.X),
                                      Text.Center(MoonVars.RenderHeight, (int)textMeasure.Y)
                                      ),
                                  fontSize, 1, fgColor);

                Raylib.EndTextureMode();
            }
            Raylib.EndDrawing();
        }