public LevelSelect(GameEngine engine) : base(engine) { eng = engine; savedGameStates = new Stack<XmlNodeList>(); savedGameChoices = new Stack<string>(); mouse = eng.Mouse; // Load all the textures eng.StateTextureManager.RenderSetup(); Assembly assembly = Assembly.GetExecutingAssembly(); eng.StateTextureManager.LoadTexture("menu", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.menu.png")); menu = eng.StateTextureManager.GetTexture("menu"); eng.StateTextureManager.LoadTexture("arrow", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.arrow.png")); arrow = eng.StateTextureManager.GetTexture("arrow"); eng.StateTextureManager.LoadTexture("load", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_loadlevel.png")); load_nopress = eng.StateTextureManager.GetTexture("load"); eng.StateTextureManager.LoadTexture("loadpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_loadlevel_hover.png")); load_press = eng.StateTextureManager.GetTexture("loadpress"); eng.StateTextureManager.LoadTexture("quit", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_exit.png")); quit_nopress = eng.StateTextureManager.GetTexture("quit"); eng.StateTextureManager.LoadTexture("quitpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_exit_hover.png")); quit_press = eng.StateTextureManager.GetTexture("quitpress"); eng.StateTextureManager.LoadTexture("play", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_play.png")); play_nopress = eng.StateTextureManager.GetTexture("play"); eng.StateTextureManager.LoadTexture("playpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_play_hover.png")); play_press = eng.StateTextureManager.GetTexture("playpress"); eng.StateTextureManager.LoadTexture("ld", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_leveldesign.png")); ld_nopress = eng.StateTextureManager.GetTexture("ld"); eng.StateTextureManager.LoadTexture("ldpress", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.btn_leveldesign_hover.png")); ld_press = eng.StateTextureManager.GetTexture("ldpress"); musicFile = new AudioFile(assembly.GetManifestResourceStream("U5Designs.Resources.Sound.Retribution.ogg")); musicFile.Play(); // Setup saved game data SavedGameDataSetup(); // Display available saved game states DisplayAvailableSaves(); // Clear the color to work with the SplashScreen so it doesn't white out GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); lookat = new Vector3(0, 0, 2); eye = new Vector3(0, 0, 5); _old_state = OpenTK.Input.Keyboard.GetState(); // Get the current state of the keyboard arX = -150.0f; b1Y = 0.0f; b2Y = -100.0f; b3Y = -200.0f; b4Y = -250.0f; // TEST // enterdown = false; LoadSavedState(1); }
public LoadGameState(GameEngine engine, MainMenuState ms) { eng = engine; mouse = eng.Mouse; savedGameStates = new Stack<XmlNodeList>(); savedGameChoices = new Stack<string>(); _ms = ms; Assembly assembly = Assembly.GetExecutingAssembly(); musicFile = new AudioFile(assembly.GetManifestResourceStream("U5Designs.Resources.Music.Menu.ogg")); musicFile.Play(); // Clear the color to work with the SplashScreen so it doesn't white out //GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); lookat = new Vector3(0, 0, 2); eye = new Vector3(0, 0, 5); _old_state = OpenTK.Input.Keyboard.GetState(); // Get the current state of the keyboard eng.StateTextureManager.LoadTexture("menu", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.menu.png")); menu = eng.StateTextureManager.GetTexture("menu"); saveFont = QFont.FromQFontFile("Fonts/myHappySans.qfont", new QFontLoaderConfiguration(true)); saveFont.Options.DropShadowActive = true; //title = QFont.FromQFontFile("myHappySans.qfont", new QFontLoaderConfiguration(true)); title = QFont.FromQFontFile("Fonts/myRock.qfont", new QFontLoaderConfiguration(true)); title.Options.DropShadowActive = true; saveFontHighlighted = QFont.FromQFontFile("Fonts/myHappySans2.qfont", new QFontLoaderConfiguration(true)); saveFont.Options.DropShadowActive = true; //QFont.CreateTextureFontFiles("Fonts/HappySans.ttf", 48, "myHappySans2"); // Load available saved games // Setup saved game data SavedGameDataSetup(); numOfButtons = savedGameChoices.Count - 1; }
public Player(SpriteSheet sprite, SpriteSheet arms, List<ProjectileProperties> projectiles, PlayState ps) : base(Int32.MaxValue) //player always has largest ID for rendering purposes { p_state = new PlayerState("TEST player"); //p_state.setSpeed(130); this.playstate = ps; _speed = runSpeed; _location = new Vector3(25, 12.5f, 50); _scale = new Vector3(25f, 25f, 25f); _pbox = new Vector3(5f, 11.0f, 5f); _cbox = new Vector3(4f, 10.0f, 4f); spinSize = 12; //?? experiment with this, TODO: change it to match the sprites size velocity = new Vector3(0, 0, 0); accel = new Vector3(0, 0, 0); kbspeed = new Vector3(70, 100, 70); jumpspeed = 250.0f; _cycleNum = 0; _frameNum = 0; _sprite = sprite; _hascbox = true; _type = 0; //type 0 is the player and only the player _existsIn2d = true; _existsIn3d = true; onGround = true; //arms this.arms = new Decoration(_location + new Vector3(0.005f, 0.0f, 0.005f), _scale, true, true, Billboarding.Yes, arms); ps.renderList.Add(this.arms); //combat things _damage = 1; spinDamage = 2; maxHealth = _health = 7; stamina = 5.0; maxStamina = 5.0; spaceDown = false; eDown = false; pDown = false; isMobile = true; Invincible = false; HasControl = true; Invincibletimer = 0.0; NoControlTimer = 0.0; fallTimer = 0.0; viewSwitchJumpTimer = 0.0; projectileTimer = 0.0; spinTimer = 0.0; lookDownTimer = -1.0; squishTimer = -1.0; lastPosOnGround = new Vector3(_location); _animDirection = 1; this.projectiles = projectiles; curProjectile = projectiles[0]; curProjectile.damage = _damage; markerList = new List<Decoration>(); Assembly assembly = Assembly.GetExecutingAssembly(); jumpSound = new AudioFile(assembly.GetManifestResourceStream("U5Designs.Resources.Sound.jump_sound.ogg")); bananaSound = new AudioFile(assembly.GetManifestResourceStream("U5Designs.Resources.Sound.banana2.ogg")); HurtSound = new AudioFile(assembly.GetManifestResourceStream("U5Designs.Resources.Sound.hurt.ogg")); HitSound = new AudioFile(assembly.GetManifestResourceStream("U5Designs.Resources.Sound.hit.ogg")); SpinSound = new AudioFile(assembly.GetManifestResourceStream("U5Designs.Resources.Sound.spin.ogg")); }
public MainMenuState(GameEngine engine) { eng = engine; savedGameStates = new Stack<XmlNodeList>(); savedGameChoices = new Stack<string>(); mouse = eng.Mouse; // Load all the textures eng.StateTextureManager.RenderSetup(); Assembly assembly = Assembly.GetExecutingAssembly(); eng.StateTextureManager.LoadTexture("menu", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.menu.png")); menu = eng.StateTextureManager.GetTexture("menu"); // QFont _buttons = new List<String>(); _buttons.Add("Play Game"); _buttons.Add("Load Saved Game"); _buttons.Add("Level Designer"); _buttons.Add("Quit"); button = QFont.FromQFontFile("Fonts/myHappySans.qfont", new QFontLoaderConfiguration(true)); button.Options.DropShadowActive = true; //title = QFont.FromQFontFile("myHappySans.qfont", new QFontLoaderConfiguration(true)); title = QFont.FromQFontFile("Fonts/myRock.qfont", new QFontLoaderConfiguration(true)); title.Options.DropShadowActive = false; buttonHighlight = QFont.FromQFontFile("Fonts/myHappySans2.qfont", new QFontLoaderConfiguration(true)); buttonHighlight.Options.DropShadowActive = true; // QFont.CreateTextureFontFiles("Fonts/HappySans.TTF", 32, "myStoryBright"); // Use this to create new Fonts that you will texture // QFont.CreateTextureFontFiles("Fonts/Comfortaa-Regular.ttf", 32, "myComfort"); // Use this to create new Fonts that you will texture // End QFonts musicFile = new AudioFile(assembly.GetManifestResourceStream("U5Designs.Resources.Music.Menu.ogg")); musicFile.Play(); // Setup saved game data SavedGameDataSetup(); // Display available saved game states DisplayAvailableSaves(); // Clear the color to work with the SplashScreen so it doesn't white out GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); lookat = new Vector3(0, 0, 2); eye = new Vector3(0, 0, 5); _old_state = OpenTK.Input.Keyboard.GetState(); // Get the current state of the keyboard arX = -200.0f; b1Y = 0.0f; b2Y = -50.0f; b3Y = -100.0f; b4Y = -150.0f; enterdown = false; // TEST // //LoadSavedState(1); }
/// <summary>Load resources here. This gets called ONCE at the start of the entire process(not once a state)</summary> /// <param name="e">Not used.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); GL.ClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL.Enable(EnableCap.DepthTest); GL.Enable(EnableCap.Normalize); GL.Enable(EnableCap.Texture2D); StateTextureManager = new TextureManager(); // Load up the 4 images that will be displayed in sequence giving the illusion of animation StateTextureManager.RenderSetup(); assembly = Assembly.GetExecutingAssembly(); // Splash Screen StateTextureManager.LoadTexture("logo", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.u5_logo.jpg")); // Game over State StateTextureManager.LoadTexture("game_over", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.game_over_text.png")); //StateTextureManager.LoadTexture("restart", "../../Resources/Textures/restart_button.png"); //StateTextureManager.LoadTexture("quit_button", "../../Resources/Textures/go_quit_button.png"); // Pause State StateTextureManager.LoadTexture("p1", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.PauseTextures.p1.png")); StateTextureManager.LoadTexture("p2", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.PauseTextures.p2.png")); StateTextureManager.LoadTexture("p3", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.PauseTextures.p3.png")); StateTextureManager.LoadTexture("p4", assembly.GetManifestResourceStream("U5Designs.Resources.Textures.PauseTextures.p4.png")); // Load State for(int i = 1; i <= 8; i++) { StateTextureManager.LoadTexture("load" + i, assembly.GetManifestResourceStream("U5Designs.Resources.Textures.LoadingScreenTextures.load" + i + ".png")); } ThisMouse = new GameMouse(this); states = new Stack<GameState>(); //this.ChangeState(ms); //MainMenuState ms = new MainMenuState(this); //this.ChangeState(ms); SplashScreenState ss = new SplashScreenState(this); this.ChangeState(ss); selectSound = new AudioFile(assembly.GetManifestResourceStream("U5Designs.Resources.Sound.select.ogg")); // Set the title bar of the window etc //Initialize Shader //Thanks to OpenTK samples for part of this shader code int shaderProgram = GL.CreateProgram(); int frag = GL.CreateShader(ShaderType.FragmentShader); // GLSL for fragment shader. String fragSource = @" uniform sampler2D tex; void main( void ) { vec4 col = texture2D(tex,gl_TexCoord[0].st); if( col.a < 0.5) { discard; } gl_FragColor = col; } "; GL.ShaderSource(frag, fragSource); GL.CompileShader(frag); GL.AttachShader(shaderProgram, frag); GL.LinkProgram(shaderProgram); GL.UseProgram(shaderProgram); }