Esempio n. 1
0
 public GameStateManager(Game pmGame)
 {
     game=	pmGame;
     game.window.viewport.Resize+=	onResize;
     states=	new Dictionary<string, GameState>();
     currState=	-1;
 }
Esempio n. 2
0
        public GameFrame(Game pmGame)
        {
            game=	pmGame;
            frame=	new PCGameWindow();
            viewport=	new PCViewport();
            resizeComponents=	defaultResizeComponents;

            ((PCGameWindow)frame).setDoubleBuffered(true);
            viewport.clearColor=	new Color("#f0ffff");
            frame.title=	"Game";
            frame.size=	new Size2(800, 640);
            frame.onResize+=	frameResize;

            frame.addControl(viewport);
            resizeComponents();
        }
Esempio n. 3
0
 // Renders the border given the game to render it on, state 0 is normal, state 1 is disabled, state 2 is hovered, and state 3 is pressed
 public void render(Game game, Rectangle prevClipRegion, byte state)
 {
     game.graphics.endClip();
     switch((int)(style))
     {
         case 0:	return;
         case 1:	renderSolid(ref game, state);	break;
         case 2:	renderDashed(ref game, state);	break;
         case 3:	renderDotted(ref game, state);	break;
         case 4:	renderDouble(ref game, state);	break;
         case 5:	renderGroove(ref game, state);	break;
         case 6:	renderRidge(ref game, state);	break;
         case 7:	renderInset(ref game, state);	break;
         case 8:	renderOutset(ref game, state);	break;
     }
     game.graphics.beginClip(prevClipRegion);
 }
Esempio n. 4
0
        // Renders the border as a solid border
        protected virtual void renderSolid(ref Game game, byte state)
        {
            // Variables
            Color	colorUsed=	colors.normal;

            if(state== 1)
                colorUsed=	colors.disabled;
            if(state== 2)
                colorUsed=	colors.hovered;
            if(state== 3)
                colorUsed=	colors.pressed;

            game.graphics.outlineRect(new Rectangle(x-borderSize, y-borderSize, width+borderSize*2f, height+borderSize*2f), colorUsed, borderSize);
            game.graphics.renderRectEndpoints(new Rectangle(x-borderSize, y-borderSize, width+borderSize*2f, height+borderSize*2f), colorUsed, borderSize);
        }
Esempio n. 5
0
        // Renders the border as a ridge border
        protected virtual void renderRidge(ref Game game, byte state)
        {
            // Variables
            Color	colorUsed=	colors.normal;
            Color	colorBUsed=	secondSetColors.normal;

            if(state== 1)
            {
                colorUsed=	colors.disabled;
                colorBUsed=	secondSetColors.disabled;
            }
            if(state== 2)
            {
                colorUsed=	colors.hovered;
                colorBUsed=	secondSetColors.hovered;
            }
            if(state== 3)
            {
                colorUsed=	colors.pressed;
                colorBUsed=	secondSetColors.pressed;
            }

            game.graphics.outlineRect(new Rectangle(x-borderSize, y-borderSize, width+borderSize*2f, height+borderSize*2f), colorBUsed, borderSize);
            game.graphics.renderRectEndpoints(new Rectangle(x-borderSize, y-borderSize, width+borderSize*2f, height+borderSize*2f), colorBUsed, borderSize);
            game.graphics.outlineRect(bounds, colorUsed, 1f);
            game.graphics.renderRectEndpoints(bounds, colorUsed, 1f);
        }
Esempio n. 6
0
        // Renders the border as a outset border
        protected virtual void renderOutset(ref Game game, byte state)
        {
            // Variables
            Color	colorUsed=	colors.normal;
            Color	colorBUsed=	secondSetColors.normal;

            if(state== 1)
            {
                colorUsed=	colors.disabled;
                colorBUsed=	secondSetColors.disabled;
            }
            if(state== 2)
            {
                colorUsed=	colors.hovered;
                colorBUsed=	secondSetColors.hovered;
            }
            if(state== 3)
            {
                colorUsed=	colors.pressed;
                colorBUsed=	secondSetColors.pressed;
            }

            game.graphics.renderLine(new Point2(x, y), new Point2(x, y+height), colorBUsed, borderSize);
            game.graphics.renderLine(new Point2(x, y), new Point2(x+width, y), colorBUsed, borderSize);

            game.graphics.renderLine(new Point2(x+width, y+height), new Point2(x, y+height), colorUsed, borderSize);
            game.graphics.renderLine(new Point2(x+width, y+height), new Point2(x+width, y), colorUsed, borderSize);
        }
Esempio n. 7
0
 // Pre-initializes the mod
 public virtual void preInit(Game game)
 {
 }
Esempio n. 8
0
 // Used to safely override and render without having to destroy the main render stuff
 protected override void innerRender(ref Game game, ref GameTime time)
 {
 }
Esempio n. 9
0
 // Renders the gui control normally
 protected override void renderNormal(ref Game game, ref GameTime time)
 {
     game.graphics.renderString(pText, pFont, location, pFGColors.normal);
 }
Esempio n. 10
0
 // Renders the gui control normally
 protected override void renderNormal(ref Game game, ref GameTime time)
 {
     game.graphics.renderRect(pBounds, pBGColors.normal);
     game.graphics.renderString(pText, pFont, location, pFGColors.normal);
     pBorder.render(game, pBounds, 0);
 }
Esempio n. 11
0
 // Renders the gui control when it is being pressed down on
 protected override void renderPressed(ref Game game, ref GameTime time)
 {
     game.graphics.renderRect(pBounds, pBGColors.pressed);
     game.graphics.renderString(pText, pFont, location, pFGColors.pressed);
     pBorder.render(game, pBounds, 3);
 }
Esempio n. 12
0
        // Renders the progress bar
        private void renderProgressBar(ref Game game, ref GameTime time, Color baseColor, Color textColor, Color progColor, Color progLeftColor)
        {
            // Variables
            float	p;

            if(pHorizontal)
            {
                p=	width*pProgress;
                game.graphics.renderRect(pBounds, baseColor);
                if(p> 0)
                    game.graphics.renderRect(new Rectangle(new Point2(x+1f, y+1f), new Size2(p-2f, height-2f)), progColor);
                else
                    p=	1f;
                game.graphics.renderRect(new Rectangle(new Point2(x+p, y+1f), new Size2((width-p)-1f, height-2f)), progLeftColor);
            }
            else
            { // TODO: Change for vertical progress bar
                p=	height*pProgress;
                game.graphics.renderRect(pBounds, baseColor);
                if(p> 0)
                    game.graphics.renderRect(new Rectangle(new Point2(x+1f, y+1f), new Size2(width-2f, p-2f)), progColor);
                else
                    p=	1f;
                game.graphics.renderRect(new Rectangle(new Point2(x+p, y+1f), new Size2(width-2f, (p-height)-1f)), progLeftColor);
            }

            if(pAutoLabel)
            {
                game.graphics.renderString(pText, pFont, location, textColor);
            }
        }
Esempio n. 13
0
 // Renders the gui control when it is pressed down on
 protected override void renderPressed(ref Game game, ref GameTime time)
 {
     renderProgressBar(ref game, ref time, pBGColors.pressed, pFGColors.pressed, pProgressColors.pressed, pProgressLeftColors.pressed);
 }
Esempio n. 14
0
 // Renders the gui control normally
 protected override void renderNormal(ref Game game, ref GameTime time)
 {
     renderProgressBar(ref game, ref time, pBGColors.normal, pFGColors.normal, pProgressColors.normal, pProgressLeftColors.disabled);
 }
Esempio n. 15
0
 // Initializes the mod
 public virtual void init(Game game)
 {
 }
Esempio n. 16
0
 // Renders the gui control when it is pressed down on
 protected override void renderPressed(ref Game game, ref GameTime time)
 {
     game.graphics.renderString(pText, pFont, location, pFGColors.pressed);
 }
Esempio n. 17
0
 // Post-Initializes the mod
 public virtual void postInit(Game game)
 {
 }
Esempio n. 18
0
        // Renders the border as a dashed border
        protected virtual void renderDashed(ref Game game, byte state)
        {
            // Variables
            Color	colorUsed=	colors.normal;

            if(state== 1)
                colorUsed=	colors.disabled;
            if(state== 2)
                colorUsed=	colors.hovered;
            if(state== 3)
                colorUsed=	colors.pressed;

            GL.LineStipple(1, ushort.MaxValue-255);
            GL.Enable(EnableCap.LineStipple);
            game.graphics.outlineRect(new Rectangle(x-borderSize, y-borderSize, width+borderSize*2f, height+borderSize*2f), colorUsed, borderSize);
            GL.Disable(EnableCap.LineStipple);
            game.graphics.renderRectEndpoints(new Rectangle(x-borderSize, y-borderSize, width+borderSize*2f, height+borderSize*2f), colorUsed, borderSize);
        }
Esempio n. 19
0
        // Renders the gui control normally
        protected override void renderNormal(ref Game game, ref GameTime time)
        {
            game.graphics.renderRect(pBounds, pBGColors.normal);
            base.renderNormal(ref game, ref time);
            if(bHasSelection)
            {

            }
        }
Esempio n. 20
0
 public GUIManager(Game pmGame)
 {
     game=	pmGame;
     csets=	new Dictionary<string, GUISet>();
     actives=	new List<int>();
 }