Exemple #1
0
        public MainMenu()
            : base(1920, 1080)
        {
            AddGraphic(background);
            background.Scroll = 0;
            AddGraphic(corners);

            credits.X = 250;
            credits.Y = 960;
            credits.CenterOrigin();
            AddGraphic(credits);

            lights.Clear();

            background.Shader = new Shader(ShaderType.Fragment, "assets/shaders/water_wave.frag");

            ambientLighting = new Surface(1920, 1080);
            lightSurface = new Surface(1920, 1080);

            Add(new Logo(421, 542, "assets/gfx/logo.png"));

            // Play/How To/Quit buttons
            playButton = Add(new Logo(1486, 440, "assets/gfx/play.png", 14.0f));
            howToButton = Add(new Logo(1544, 540, "assets/gfx/howto.png", 14.0f));
            quitButton = Add(new Logo(1480, 640, "assets/gfx/quit.png", 14.0f));

            menuLight = new Light(0, 0.1f);
            menuLight.entity = playButton;
            menuLight.SetAlpha(1.0f, 0.7f);
            menuLight.SetAlphaSpan(1.1f);
            menuLight.SetOffset(175, 100);
            lights.Add(menuLight);
        }
Exemple #2
0
        public HowTo()
            : base(1920, 1080)
        {
            AddGraphic(background);
            background.Scroll = 0;
            AddGraphic(corners);

            controls.SetPosition(1536, 209);
            controls.CenterOrigin();
            AddGraphic(controls);

            wasd.SetPosition(1540, 580);
            wasd.CenterOrigin();
            AddGraphic(wasd);

            fullscreen.SetPosition(1540, 900);
            fullscreen.CenterOrigin();
            AddGraphic(fullscreen);

            background.Shader = new Shader(ShaderType.Fragment, "assets/shaders/water_wave.frag");

            ambientLighting = new Surface(1920, 1080);
            lightSurface = new Surface(1920, 1080);

            Add(new Logo(421, 542, "assets/gfx/logo.png"));
        }
		public void Initialize( Game game )
		{
			// Initialize the ground surface render target
			GroundSurface = new Surface( 1920, 1080 );
			GroundSurface.AutoClear = false;
			AddGraphic( GroundSurface );

			// Initialize the ground graphic (Added in ClearGround)
			Ground = new Otter.Image( "../../resources/ground.png" );

			// Set the reference to LeapController within the GameWands class & add to game update
			GameWands.LeapController = LeapController;
			GameWands.OnCast = OnCast;
			Add( GameWands );

			// Initialize the two wizard players
			float wizardoffset = 256;

			// Create new wizard list
			Wizards = new List<WizardClass>();
			{
				Wizards.Add( new WizardClass(
					game.Session( "LightWizard" ),
					GameWands,
					WizardTypeStruct.WIZARD_LIGHT,
					0,
					90
				) );

				// Dark wizard on the left
				Wizards.Add( new WizardClass(
					game.Session( "DarkWizard" ),
					GameWands,
					WizardTypeStruct.WIZARD_DARK,
					1,
					-90
				) );
			}

			// Add the wizards to the scene.
			foreach ( WizardClass wiz in Wizards )
			{
				wiz.CurrentScene = this;
				Add( wiz );
			}

			// Add a reference of this scene to the HUDHandler
			HUDHandler = new HUDHandlerClass( this );
			Add( HUDHandler );

			// Setup state manager last
			TragicStateManager.CurrentScene = this;
			Add( TragicStateManager );
		}
Exemple #4
0
 /// <summary>
 /// Change the Surface that is being rendered to.
 /// </summary>
 /// <param name="target">The new target Surface.</param>
 public static void SetTarget(Surface target)
 {
     if (Target != target) {
         SpriteBatch.End();
     }
     Target = target;
 }
Exemple #5
0
 /// <summary>
 /// Reset the Surface that is being rendered to back to the default for the current Game.
 /// </summary>
 public static void ResetTarget()
 {
     if (Target != GameTarget) {
         SpriteBatch.End();
     }
     Target = GameTarget;
 }
        internal void UpdateSurface()
        {
            renderSurface = new Surface((int)game.WindowWidth, (int)game.WindowHeight);
            renderSurface.CenterOrigin();
            renderSurface.X = game.Surface.X;
            renderSurface.Y = game.Surface.Y;
            renderSurface.Smooth = false;

            cameraMoveRate = (int)((renderSurface.Width + renderSurface.Height) * 0.5f * 0.1f);

            imgOverlay = Image.CreateRectangle(renderSurface.Width, renderSurface.Height, Color.Black);
            imgOverlay.Scroll = 0;

            imgError = Image.CreateRectangle(renderSurface.Width, renderSurface.Height, Color.Red);
            imgError.Scroll = 0;
            imgError.Alpha = 0;

            float fontScale = Util.ScaleClamp(renderSurface.Height, 400, 800, 0.67f, 1);
            padding = (int)Util.Clamp(paddingMax * fontScale, paddingMax * 0.25f, paddingMax);

            textInput.FontSize = (int)(textSizeLarge * fontScale);
            textPastCommands.FontSize = (int)(textSizeMedium * fontScale);
            textCommandsBuffered.FontSize = (int)(textSizeSmall * fontScale);
            textCountdown.FontSize = (int)(textSizeHuge * fontScale);
            textFramesLeft.FontSize = (int)(textSizeMedium * fontScale);
            textPerformance.FontSize = (int)(textSizeMedium * fontScale);
            textCamera.FontSize = (int)(textSizeLarge * fontScale);

            imgOtter.Scale = fontScale;

            textFramesLeft.Y = renderSurface.Height - textFramesLeft.LineSpacing;
            textPerformance.Y = 0;

            textInput.Y = renderSurface.Height - textInput.LineSpacing - padding;
            textInput.X = padding;

            textCommandsBuffered.X = textInput.X;
            textCommandsBuffered.Y = textInput.Y + textInput.LineSpacing + 3;

            textAreaHeight = renderSurface.Height - padding * 3 - textInput.LineSpacing;

            maxLines = textAreaHeight / textPastCommands.LineSpacing;
            maxChars = (int)((renderSurface.Width - padding * 2) / (textInput.FontSize * 0.6));

            textPastCommands.Y = padding;
            textPastCommands.X = padding;

            textCountdown.X = renderSurface.HalfWidth;
            textCountdown.Y = renderSurface.HalfHeight;

            imgScrollBarBg = Image.CreateRectangle(scrollBarWidth, textAreaHeight, Color.Black);
            imgScrollBar = Image.CreateRectangle(scrollBarWidth, textAreaHeight, Color.White);

            imgScrollBarBg.X = renderSurface.Width - padding - imgScrollBarBg.Width;
            imgScrollBarBg.Y = padding;

            imgScrollBar.X = imgScrollBarBg.X;
            imgScrollBar.Y = imgScrollBarBg.Y;

            imgOtter.X = renderSurface.HalfWidth;
            imgOtter.Y = renderSurface.HalfHeight;

            imgScrollBar.Scroll = 0;
            imgScrollBarBg.Scroll = 0;

            textCamera.CenterOrigin();
            textCamera.X = renderSurface.HalfWidth;
            textCamera.Y = renderSurface.Height - padding - textCamera.LineSpacing;
        }
        internal void UpdateSurface()
        {
            renderSurface = new Surface((int)game.WindowWidth, (int)game.WindowHeight);
            renderSurface.CenterOrigin();
            renderSurface.X      = game.Surface.X;
            renderSurface.Y      = game.Surface.Y;
            renderSurface.Smooth = false;

            cameraMoveRate = (int)((renderSurface.Width + renderSurface.Height) * 0.5f * 0.1f);

            imgOverlay        = Image.CreateRectangle(renderSurface.Width, renderSurface.Height, Color.Black);
            imgOverlay.Scroll = 0;

            imgError        = Image.CreateRectangle(renderSurface.Width, renderSurface.Height, Color.Red);
            imgError.Scroll = 0;
            imgError.Alpha  = 0;

            float fontScale = Util.ScaleClamp(renderSurface.Height, 400, 800, 0.67f, 1);

            padding = (int)Util.Clamp(paddingMax * fontScale, paddingMax * 0.25f, paddingMax);

            textInput.FontSize            = (int)(textSizeLarge * fontScale);
            textInputHelp.FontSize        = (int)(textSizeLarge * fontScale);
            textPastCommands.FontSize     = (int)(textSizeMedium * fontScale);
            textPastCommandsLive.FontSize = (int)(textSizeMedium * fontScale);
            textCommandsBuffered.FontSize = (int)(textSizeSmall * fontScale);
            textCountdown.FontSize        = (int)(textSizeHuge * fontScale);
            textFramesLeft.FontSize       = (int)(textSizeMedium * fontScale);
            textPerformance.FontSize      = (int)(textSizeMedium * fontScale);
            textCamera.FontSize           = (int)(textSizeLarge * fontScale);

            imgOtter.Scale = fontScale;

            textFramesLeft.Y = renderSurface.Height - textFramesLeft.LineSpacing;

            textInput.Y = renderSurface.Height - textInput.LineSpacing - padding;
            textInput.X = padding;

            textInputHelp.SetPosition(textInput, 0, -24);

            textCommandsBuffered.X = textInput.X;
            textCommandsBuffered.Y = textInput.Y + textInput.LineSpacing + 3;

            textAreaHeight = (int)(renderSurface.Height - padding * 3 - textInput.LineSpacing);

            maxLines = (int)(textAreaHeight / textPastCommands.LineSpacing);
            maxChars = (int)((renderSurface.Width - padding * 2) / (textInput.FontSize * 0.6));

            textPastCommands.Y = padding;
            textPastCommands.X = padding;

            textPastCommandsLive.Y = padding / 2;
            textPastCommandsLive.X = padding / 2;

            textCountdown.X = renderSurface.HalfWidth;
            textCountdown.Y = renderSurface.HalfHeight;

            imgScrollBarBg = Image.CreateRectangle(scrollBarWidth, textAreaHeight, Color.Black);
            imgScrollBar   = Image.CreateRectangle(scrollBarWidth, textAreaHeight, Color.White);

            imgScrollBarBg.X = renderSurface.Width - padding - imgScrollBarBg.Width;
            imgScrollBarBg.Y = padding;

            imgScrollBar.X = imgScrollBarBg.X;
            imgScrollBar.Y = imgScrollBarBg.Y;

            imgOtter.X = renderSurface.HalfWidth;
            imgOtter.Y = renderSurface.HalfHeight;

            imgScrollBar.Scroll   = 0;
            imgScrollBarBg.Scroll = 0;

            textCamera.CenterTextOrigin();
            textCamera.X = renderSurface.HalfWidth;
            textCamera.Y = renderSurface.Height - padding - textCamera.LineSpacing;
        }