コード例 #1
0
ファイル: Texture.cs プロジェクト: 628426/Strive.NET
        public void Draw(ITexture t, float x, float y, float rotation, float scale)
        {
            _render_surface.StartRender(false);
            Engine.Screen2DImmediate.ACTION_Begin2D();
            int white = Engine.Gl.RGBA(1, 1, 1, 1);

// T00 slow!
//			Engine.Screen2DImmediate.DRAW_TextureRotated( t.ID, x, y, t.Width*scale, t.Height*scale, rotation, 0, 0, 1, 1, white, white, white, white );
            Engine.Screen2DImmediate.DRAW_Texture(t.ID, x, y, x + Constants.terrainPieceTextureWidth, y + Constants.terrainPieceTextureWidth, white, white, white, white, 0, 0, 1, 1);
            Engine.Screen2DImmediate.ACTION_End2D();
            _render_surface.EndRender();
        }
コード例 #2
0
ファイル: GameEngine.cs プロジェクト: WarfareCode/WorldEngine
        private void Main_Loop()
        {
            // Okay, we start the main loop here. We are going to loop over
            // and over until the user click on the "Quit" button and by this,
            // change the value of DoLoop to false.

            // We loop all of this until the DoLoop isn't True.
            while (DoLoop == true)
            {
                // Let us the capacity to use buttons of the form.
                System.Windows.Forms.Application.DoEvents();

                // New : We moved the movement code in an other sub to make
                // the code clearer.
                Check_Input();

                if (InputEngine.IsKeyPressed(CONST_TV_KEY.TV_KEY_Z))
                {
                    Scene.SetRenderMode(CONST_TV_RENDERMODE.TV_LINE);
                }
                else
                {
                    Scene.SetRenderMode(CONST_TV_RENDERMODE.TV_SOLID);
                }

                // New : We moved the checking of maximum camera "look at" and
                // also the camera movement smoothing in an other sub too.
                Check_Movement();

                //render surfaces before tv3d.clear or you get funkey results
                RenderSurf1.StartRender(false);
                Atmos.Atmosphere_Render();
                //Land.Render();
                RenderSurf1.EndRender();
                RenderSurf2.StartRender(false);
                Atmos.Atmosphere_Render();
                //Land.Render();
                RenderSurf2.EndRender();

                // Clear the the last frame.
                TV.Clear(false);

                // New : if we are below the waterheight, this means the we are
                // underwater. To give a cool underwater effect, we will add fog.
                // If we are over the ground, then don't add the fog but render
                // the lens flare.

                /*
                 * if (sngPositionY < sngWaterHeight)
                 * {
                 *  //' Render a blue fog to simulate under water.
                 *  Atmos.Fog_Enable(true);
                 *  Atmos.Fog_SetColor(0f, 0.4f, 0.5f);
                 *  Atmos.Fog_SetParameters(0f, 0f, 0.01f);
                 *  Atmos.Fog_SetType(CONST_TV_FOG.TV_FOG_EXP, CONST_TV_FOGTYPE.TV_FOGTYPE_RANGE);
                 *  Atmos.LensFlare_Enable(false);
                 * }
                 * else
                 * {*/
                // New : we have to render the lens flare.
                Atmos.LensFlare_Enable(true);
                Atmos.Fog_Enable(false);

                /*Atmos.Fog_Enable(true);
                 * Atmos.Fog_SetColor(1, 1, 1);
                 * Atmos.Fog_SetParameters(50f, 100f, 0.01f);
                 * Atmos.Fog_SetType(CONST_TV_FOG.TV_FOG_LINEAR, CONST_TV_FOGTYPE.TV_FOGTYPE_VERTEX);*/
                //}

                // New have to render the sky, the sun and lens flares
                Atmos.Atmosphere_Render();

                // New : we have to render the landscape.
                //Land.Render();
                WMap.Render();
                //Scene.RenderAll(false);

                // We render all the 3D objects contained in the scene.
                //Scene.RenderAllMeshes(true);

                // We display everything that we have rendered
                TV.RenderToScreen();

                WorldPosition PlayerPos = WMap.GetPlayerPosition();
                GlobalVars.GameForm.Text = "Pos:" + sngPositionX + " (" + PlayerPos.TileX + ");" + sngPositionY + ";" + sngPositionZ + " (" + PlayerPos.TileZ + ") + (" + PlayerPos.TilePosX + ";" + PlayerPos.TilePosY + ";" + PlayerPos.TilePosZ + ")";
                //GlobalVars.GameForm.Text = Scene.GetTriangleNumber().ToString();
            }

            // We ask to quit.
            this.Quit();
        }