Beispiel #1
0
        public override void Render( SpriteShader shader )
        {
            double secs = ( CurrentMilliseconds() - myStartTime + myStopTime ) / 1000.0;
            int frame = StartFrame + (int) ( (long) ( secs * FrameRate ) % (long) FrameCount );

            if ( frame != myLastFrame )
                SubrectOffset = myFrameLocations[ frame ];

            base.Render( shader );
        }
Beispiel #2
0
        public override void Render(SpriteShader shader)
        {
            double secs  = (CurrentMilliseconds() - myStartTime + myStopTime) / 1000.0;
            int    frame = StartFrame + (int)((long)(secs * FrameRate) % (long)FrameCount);

            if (frame != myLastFrame)
            {
                SubrectOffset = myFrameLocations[frame];
            }

            base.Render(shader);
        }
Beispiel #3
0
        public virtual void Render(SpriteShader shader)
        {
            if (VertsChanged)
            {
                myVertices   = FindVerts();
                VertsChanged = false;
            }

            if (!Texture.Ready || shader.Texture.ID != Texture.ID)
            {
                shader.Texture = Texture;
            }

            shader.Render(myVertices);
        }
Beispiel #4
0
        protected override void OnLoad( System.EventArgs e )
        {
            Plugin.Register( "MarsMiner.Shared.CorePlugin", true, true );
            Plugin.Register( "MarsMiner.Shared.MarsMinerPlugin", true, true );

            ServerBuilder sb = new ServerBuilder
            {
                Name = "Local Server",
                Password = null,
                SlotCount = 1
            };

            myLocalServer = new GameServer( sb );
            myServerThread = new Thread( myLocalServer.Run );
            myServerThread.Start();

            myLocalClient = new GameClient();
            myLocalClient.ConnectLocal();
            myClientThread = new Thread( myLocalClient.Run );
            myClientThread.Start();

            mySpriteShader = new SpriteShader( Width, Height );
            myUIRoot = new UIObject( new Vector2( Width, Height ) );

            myFPSText = new UILabel( Font.Large, new Vector2( 4.0f, 4.0f ) );
            myFPSText.Text = "FT: ??ms FPS: ?? MEM: ??";
            myUIRoot.AddChild( myFPSText );

            Mouse.Move += OnMouseMove;
            Mouse.ButtonUp += OnMouseButtonEvent;
            Mouse.ButtonDown += OnMouseButtonEvent;

            /*
            myTestWorld = new World();

            myGeoShader = new GeometryShader( Width, Height );
            myGeoShader.UpdateTileMap( 16 );

            myGeoRenderers = new List<ChunkRenderer>();

            myTestWorld.ChunkLoaded += OnChunkEvent;
            myTestWorld.ChunkUnloaded += OnChunkEvent;
            myTestWorld.ChunkChanged += OnChunkEvent;

            myTestWorld.Generate( 1024, 1024, 4 );

            myGeoShader.CameraPosition = new Vector3( 0.0f, 1024.0f, 0.0f );
            */

            GL.ClearColor( new Color4( 223, 186, 168, 255 ) );

            myFrameTimer.Start();
        }
Beispiel #5
0
        public virtual void Render( SpriteShader shader )
        {
            if ( VertsChanged )
            {
                myVertices = FindVerts();
                VertsChanged = false;
            }

            if ( !Texture.Ready || shader.Texture.ID != Texture.ID )
                shader.Texture = Texture;

            shader.Render( myVertices );
        }
Beispiel #6
0
        protected override void OnRender( SpriteShader shader, Vector2 renderPosition = new Vector2() )
        {
            mySprite.Position = renderPosition;

            mySprite.Render( shader );
        }
Beispiel #7
0
 protected override void OnRender( SpriteShader shader, Vector2 renderPosition = new Vector2() )
 {
     myButtonSprite.Position = renderPosition;
     myButtonSprite.Colour = ( IsEnabled ? Colour : DisabledColour );
     myButtonSprite.Render( shader );
 }
Beispiel #8
0
 protected override void OnRender( SpriteShader shader, Vector2 renderPosition = new Vector2() )
 {
     myFrameSprite.Position = renderPosition;
     myFrameSprite.Colour = ( IsEnabled ? OpenTK.Graphics.Color4.White : DisabledColour );
     myFrameSprite.Render( shader );
 }
Beispiel #9
0
 public RenderEventArgs( SpriteShader shader, Vector2 drawPosition )
 {
     ShaderProgram = shader;
     DrawPosition = drawPosition;
 }
Beispiel #10
0
 protected virtual void OnRender( SpriteShader shader, Vector2 renderPosition = new Vector2() )
 {
 }
Beispiel #11
0
        public void Render( SpriteShader shader, Vector2 parentPosition = new Vector2() )
        {
            if ( IsVisible )
            {
                parentPosition += Position;

                OnRender( shader, parentPosition );
                if ( RenderObject != null )
                    RenderObject( this, new RenderEventArgs( shader, parentPosition ) );

                try
                {
                    foreach ( UIObject child in myChildren )
                        child.Render( shader, parentPosition + myPaddingTopLeft );
                }
                catch ( Exception )
                {

                }
            }
        }