public GameStateManager(Game pmGame)
 {
     game=	pmGame;
     game.window.viewport.Resize+=	onResize;
     states=	new Dictionary<string, GameState>();
     currState=	-1;
 }
Beispiel #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();
        }
Beispiel #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);
 }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #7
0
 // Pre-initializes the mod
 public virtual void preInit(Game game)
 {
 }
Beispiel #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)
 {
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
            }
        }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #15
0
 // Initializes the mod
 public virtual void init(Game game)
 {
 }
Beispiel #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);
 }
Beispiel #17
0
 // Post-Initializes the mod
 public virtual void postInit(Game game)
 {
 }
Beispiel #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);
        }
Beispiel #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)
            {

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