public Sprite() { this.name = Sprite.Name.Uninitialized; this.pImage = ImageManager.Find(Image.Name.Uninitialized); Debug.Assert(this.pImage != null); this.poScreenRect = new Azul.Rect(); Debug.Assert(this.poScreenRect != null); this.poScreenRect.Clear(); this.poColor = new Azul.Color(1, 1, 1); Debug.Assert(this.poColor != null); this.poSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), poScreenRect, poColor); Debug.Assert(this.poSprite != null); this.x = poSprite.x; this.y = poSprite.y; this.sx = poSprite.sx; this.sy = poSprite.sy; this.angle = poSprite.angle; this.speedX = 0; this.speedY = 0; }
// Constructors/Destructors: ------------------------------------------- public GameSprite() { //SPRITE COLOR! //set the default color to white this.poColor = new Azul.Color(defaultSpriteColor_White); Debug.Assert(this.poColor != null); //default field values this.name = Name.Blank; //create a NullObject image by default to avoid breaking find; this.pImage = ImageManager.Find(Image.Name.NullObject); Debug.Assert(this.pImage != null); Debug.Assert(pPrivScreenRect != null); Debug.Assert(defaultSpriteColor_White != null); this.poScreenRect = new Azul.Rect(pPrivScreenRect); Debug.Assert(poScreenRect != null); this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), pPrivScreenRect, this.poColor); Debug.Assert(this.poAzulSprite != null); this.x = poAzulSprite.x; this.y = poAzulSprite.y; this.sx = poAzulSprite.sx; this.sy = poAzulSprite.sy; this.angle = poAzulSprite.angle; }
//----------------------------------------------------------------------------- // Game::LoadContent() // Allows you to load all content needed for your engine, // such as objects, graphics, etc. //----------------------------------------------------------------------------- public override void LoadContent() { //--------------------------------------------------------------------------------------------------------- // Audio //--------------------------------------------------------------------------------------------------------- /* * // Create the Audio Engine * AudioEngine = new IrrKlang.ISoundEngine(); * * // Play a sound file * music = AudioEngine.Play2D("theme.wav", true); * music.Volume = 0.2f; * * // Resident loads * srcShoot = AudioEngine.AddSoundSourceFromFile("shoot.wav"); * sndShoot = AudioEngine.Play2D(srcShoot, false, false, false); * sndShoot.Stop(); */ soundEngine.themeSong(); soundEngine.init(); //--------------------------------------------------------------------------------------------------------- // Setup Font //--------------------------------------------------------------------------------------------------------- // Font - texture pFont = new Azul.Texture("consolas20pt.tga"); Debug.Assert(pFont != null); GlyphMan.AddXml("Consolas20pt.xml", pFont); //--------------------------------------------------------------------------------------------------------- // Load the Textures //--------------------------------------------------------------------------------------------------------- // Red bird texture pText = new Azul.Texture("unsorted.tga"); Debug.Assert(pText != null); //--------------------------------------------------------------------------------------------------------- // Create Sprites //--------------------------------------------------------------------------------------------------------- pRedBird = new Azul.Sprite(pText, new Azul.Rect(903.0f, 797.0f, 46.0f, 46.0f), new Azul.Rect(300.0f, 100.0f, 30.0f, 30.0f)); Debug.Assert(pRedBird != null); //--------------------------------------------------------------------------------------------------------- // Demo variables //--------------------------------------------------------------------------------------------------------- stats = new GameStats(); if (startgame) { active_piece = generateRandomShape(); active_piece.setToPlay(); future_piece = generateRandomShape(); } }
//--------------------------------------------------------------------------------------------------------- // Constructor //--------------------------------------------------------------------------------------------------------- public GameSprite() : base() { this.name = GameSprite.Name.Uninitialized; // Use the default - it will be replaced in the Set this.pImage = ImageManager.Find(Image.Name.Default); Debug.Assert(this.pImage != null); this.poScreenRect = new Azul.Rect(); Debug.Assert(this.poScreenRect != null); this.poScreenRect.Clear(); // here is the actual new this.poAzulColor = new Azul.Color(1, 1, 1); Debug.Assert(this.poAzulColor != null); // here is the actual new this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, psTmpColor); Debug.Assert(this.poAzulSprite != null); this.x = poAzulSprite.x; this.y = poAzulSprite.y; this.sx = poAzulSprite.sx; this.sy = poAzulSprite.sy; this.angle = poAzulSprite.angle; }
//static Azul.Rect poRect = new Azul.Rect(); public GameSprite() : base() { this.name = GameSprite.Name.Unitialized; //use the default for now and replace later in the Set this.pImage = ImageMan.Find(Image.Name.Default); Debug.Assert(this.pImage != null); this.poScreenRect = new Azul.Rect(); Debug.Assert(this.pImage != null); //make sure nothing is there already? this.poScreenRect.Clear(); Debug.Assert(GameSprite.psTempColor != null); GameSprite.psTempColor.Set(1, 1, 1); this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, psTempColor); Debug.Assert(this.poAzulSprite != null); this.poAzulColor = new Azul.Color(1, 1, 1); Debug.Assert(this.poAzulColor != null); this.x = poAzulSprite.x; this.y = poAzulSprite.y; this.sx = poAzulSprite.sx; this.sy = poAzulSprite.sy; this.angle = poAzulSprite.angle; }
public void Draw() { String pMsg = this.msg; float x = this.xStart; float y = this.yStart; for (int i = 0; i < pMsg.Length; i++) { int key = Convert.ToByte(pMsg[i]); Glyph pGlyph = GlyphMan.Find(key); Debug.Assert(pGlyph != null); Azul.Sprite pAzulSprite = new Azul.Sprite(pGlyph.pFont, new Azul.Rect(pGlyph.x, pGlyph.y, pGlyph.width, pGlyph.height), new Azul.Rect(x, y, pGlyph.width, pGlyph.height), new Azul.Color(1.0f, 1.0f, 1.0f)); pAzulSprite.Update(); pAzulSprite.Render(); x += pGlyph.width; } }
public void Draw() { String pMsg = this.msg; float xTmp = this.xStart; float yTmp = this.yStart; float xEnd = this.xStart; for (int i = 0; i < pMsg.Length; i++) { int key = Convert.ToByte(pMsg[i]); Glyph pGlyph = GlyphMan.Find(key); Debug.Assert(pGlyph != null); xTmp = xEnd + pGlyph.width / 2; Azul.Sprite pAzulSprite = new Azul.Sprite(pGlyph.pFont, new Azul.Rect(pGlyph.x, pGlyph.y, pGlyph.width, pGlyph.height), new Azul.Rect(xTmp, yTmp, pGlyph.width, pGlyph.height), new Azul.Color(1.0f, 1.0f, 1.0f)); pAzulSprite.Update(); pAzulSprite.Render(); // move the starting to the next character xEnd = pGlyph.width / 2 + xTmp; } }
public GameSprite() : base() { // resets to default parameters this.Wash(); // Use Default Values this.pImage = ImageManager.Find(Image.Name.Default); Debug.Assert(pImage != null); // Prep Rect this.poScreenRect = new Azul.Rect(); Debug.Assert(this.poScreenRect != null); this.poScreenRect.Clear(); // Prep Color this.poAzulColor = new Azul.Color(1, 1, 1); Debug.Assert(this.poAzulColor != null); // Prep Sprite this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, this.poAzulColor); Debug.Assert(this.poAzulSprite != null); //grab data from the Azul Sprite this.x = poAzulSprite.x; this.y = poAzulSprite.y; this.sx = poAzulSprite.sx; this.sy = poAzulSprite.sy; this.angle = poAzulSprite.angle; }
public Mine(Azul.Rect destRect, int owner, Azul.Color color) : base(GAMEOBJECT_TYPE.MINE, new Azul.Rect(0, 0, 12, 12), destRect, GameObject.mineTexture, color) { PhysicBody_Data data = new PhysicBody_Data(); data.position = new Vec2(destRect.x, destRect.y); data.size = new Vec2(destRect.width, destRect.height); //data.radius = 25f; data.isSensor = true; data.angle = 0; data.shape_type = PHYSICBODY_SHAPE_TYPE.DYNAMIC_BOX; ownerID = owner; lifeTime = 5.0f; armDelay = 2.0f; mine1 = pSprite; mine2 = new Azul.Sprite(GameObject.mineTexture2, new Azul.Rect(0, 0, 12, 12), destRect, new Azul.Color(1, 0, 0)); drawMine2 = false; CreatePhysicBody(data); lifeTimer = new Stopwatch(); animTimer = new Stopwatch(); animTimer.Start(); armedTimer = new Stopwatch(); armedTimer.Start(); state = MINE_STATE.LAYED; }
public Sprite() : base() { this.pAzulSprite = new Azul.Sprite(); this.pScreenRect = new Azul.Rect(); this.pColor = new Azul.Color(1.0f, 1.0f, 1.0f); this.pImage = new Image(); }
public GameObject(GAMEOBJECT_TYPE _type, Azul.Rect textureRect, Azul.Rect screenRect, Azul.Texture text, Azul.Color c) { type = _type; color = c; pSprite = new Azul.Sprite(text, textureRect, screenRect, color); pScreenRect = screenRect; id = IDNUM++; alive = true; }
public void init(CharacterEnum alienType = CharacterEnum.crab) { int xCordinate = GameSpecs.ScreenWidth / 2; int yCordinate = GameSpecs.ScreenHeight / 2; states = RectFactory.GetRects(alienType); sprite = SpriteFactory.GetSprite(states[0], xCordinate, yCordinate); Debug.Assert(sprite != null); }
public FontSprite() : base() { this.azulSprite = new Azul.Sprite(); this.screenRect = new Azul.Rect(); this.fontColor = new Azul.Color(1, 0, 0); this.text = null; this.glyphName = Glyph.Name.Uninitialized; this.x = 0.0f; this.y = 0.0f; }
//---------------------------------------------------------------------------------- // Constructor //---------------------------------------------------------------------------------- public FontSprite() : base() { // Make a dummy sprite. Will be finished by Set() Method later. this.x = 0.0f; this.y = 0.0f; this.glyphName = Glyph.Name.Uninitialized; this.pMessage = null; this.pAzulSprite = new Azul.Sprite(); this.pScreenRect = new Azul.Rect(); this.pColor = new Azul.Color(1.0f, 1.0f, 1.0f); }
public FontSprite() { this.pAzulSprite = new Azul.Sprite(); this.pScreenRect = new Azul.Rect(); this.pColor = new Azul.Color(1.0f, 1.0f, 1.0f); this.pMessage = null; this.glyphName = Glyph.Name.Uninitialized; this.x = 0.0f; this.y = 0.0f; }
public FontSprite() : base() { // Create a dummy sprite, it will get correctly linked in Set() this.pAzulSprite = new Azul.Sprite(); this.pScreenRect = new Azul.Rect(); this.pColor = new Azul.Color(1.0f, 1.0f, 1.0f); this.pMessage = null; this.glyphName = Glyph.Name.Uninitialized; }
public GameSprite(Name name, float ag, float sx, float sy, float x, float y, Image img , float posx, float posy, float w, float h) { this.name = name; this.pImage = img; this.poRect = new Azul.Rect(posx, posy, w, h); this.poAzulSprite = new Azul.Sprite(pImage.pAzulTexture, pImage.poRect, this.poRect); this.poAzulSprite.angle = ag; this.poAzulSprite.sx = sx; this.poAzulSprite.sy = sy; this.poAzulSprite.x = x; this.poAzulSprite.y = y; }
public virtual void Destroy() { pSprite = null; if (pBody != null) { Body b = pBody.GetBody(); if (b != null) { PhysicWorld.GetWorld().DestroyBody(pBody.GetBody()); } } pBody = null; }
public FontSprite() : base() { // Create a dummy sprite, it will get correctly linked in Set() this.pAzulSprite = new Azul.Sprite(); this.pScreenRect = new Azul.Rect(); this.pColor = new Azul.Color(1.0f, 1.0f, 1.0f); this.pMessage = null; this.x = 0.0f; this.y = 0.0f; }
public static void DrawString(String pString, float x, float y, ColorName color = ColorName.White) { Azul.Sprite pAzulSprite = new Azul.Sprite(); for (int i = 0; i < pString.Length; i++) { int key = Convert.ToByte(pString[i]); Font pFont = FontManager.Find(FontName.Consolas36pt, key); Debug.Assert(pFont != null); pAzulSprite.Swap(pFont.GetAzulTexture(), pFont.GetAzulRect(), new Azul.Rect(x, y, pFont.GetAzulRect().width, pFont.GetAzulRect().height), ColorFactory.Create(color).pAzulColor); pAzulSprite.Update(); pAzulSprite.Render(); x += pFont.GetAzulRect().width; } }
private GameManager() { destroyList = new List <GameObject>(); gameObjList = new List <GameObject>(); mainMenuSprite = new Azul.Sprite(loadScreenText, new Azul.Rect(0, 0, 800, 480), new Azul.Rect(400, 250, 800, 500)); state = GAME_STATE.LOADSCREEN; //fontText20 = new Azul.Texture("Consolas20pt.tga"); //GlyphMan.AddXml("Consolas20pt.xml", fontText20); fontText20 = new Azul.Texture("Arial20pt.tga"); GlyphMan.AddXml("Arial20pt.xml", fontText20); GameOverText = new SpriteFont("", 0, 0); pLobby = new Lobby(); }
void SpawnFenceParticle(Fence obj) { Vec2 pos = obj.GetPixelPosition(); Azul.Rect source = new Azul.Rect(0, 0, 6, 209); Azul.Color color = new Azul.Color(1, 1, 1); Azul.Rect dest = new Azul.Rect(pos.X, pos.Y, 1, 1); Azul.Rect objDimensions = obj.getDestRect(); objDimensions = new Azul.Rect(objDimensions.x, objDimensions.y, objDimensions.width, objDimensions.height); Azul.Sprite s1 = new Azul.Sprite(fenceText1, source, objDimensions, color); Azul.Sprite s2 = new Azul.Sprite(fenceText2, source, objDimensions, color); Azul.Sprite s3 = new Azul.Sprite(fenceText3, source, objDimensions, color); Azul.Sprite s4 = new Azul.Sprite(fenceText4, source, objDimensions, color); Azul.Sprite s5 = new Azul.Sprite(fenceText5, source, objDimensions, color); Azul.Sprite s6 = new Azul.Sprite(fenceText6, source, objDimensions, color); Azul.Sprite s7 = new Azul.Sprite(fenceText7, source, objDimensions, color); s1.angle = obj.GetAngle_Rad(); s2.angle = obj.GetAngle_Rad(); s3.angle = obj.GetAngle_Rad(); s4.angle = obj.GetAngle_Rad(); s5.angle = obj.GetAngle_Rad(); s6.angle = obj.GetAngle_Rad(); s7.angle = obj.GetAngle_Rad(); List <Azul.Sprite> anim = new List <Azul.Sprite>(); anim.Add(s1); anim.Add(s2); anim.Add(s3); anim.Add(s4); anim.Add(s5); anim.Add(s6); anim.Add(s7); AnimationParticle part = new AnimationParticle(source, dest, fenceText1, color); part.setAnimation(anim); GameManager.AddGameObject(part); }
//---------------------------------------------------------------------------------- // Constructors //---------------------------------------------------------------------------------- public GameSprite(GameSprite.Name myName, Image pImage, Azul.Rect pScreenRect) : base() { Debug.Assert(pImage != null); Debug.Assert(pScreenRect != null); this.name = myName; this.pImage = pImage; this.poAzulColor = new Azul.Color(1, 1, 1); this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), pScreenRect); Debug.Assert(poAzulSprite != null); //grab data from the Azul Sprite this.x = poAzulSprite.x; this.y = poAzulSprite.y; this.sx = poAzulSprite.sx; this.sy = poAzulSprite.sy; this.angle = poAzulSprite.angle; }
// Author: Brandon Wegner public override void LoadContent() { AudioEngine = new IrrKlang.ISoundEngine(); music = AudioEngine.Play2D("theme.wav", true); music.Volume = 0.2f; srcShoot = AudioEngine.AddSoundSourceFromFile("shoot.wav"); sndShoot = AudioEngine.Play2D(srcShoot, false, false, false); sndShoot.Stop(); pFont = new Azul.Texture("consolas20pt.tga"); GlyphMan.AddXml("Consolas20pt.xml", pFont); pText = new Azul.Texture("unsorted.tga"); pRedBird = new Azul.Sprite(pText, new Azul.Rect(903.0f, 797.0f, 46.0f, 46.0f), new Azul.Rect(300.0f, 100.0f, 30.0f, 30.0f)); }
public GameSprite() : base() // <--- Delegate (kick the can) { this.name = GameSprite.Name.Uninitialized; // Use the default - it will be replaced in the Set this.pImage = ImageMan.Find(Image.Name.Default); Debug.Assert(this.pImage != null); Debug.Assert(this.psTmpRect != null); this.psTmpRect.Clear(); Debug.Assert(GameSprite.psTmpColor != null); this.ClearTmpColor(); // here is the actual new this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.psTmpRect, psTmpColor); Debug.Assert(this.poAzulSprite != null); this.BaseSet(poAzulSprite.x, poAzulSprite.y, poAzulSprite.sx, poAzulSprite.sy, poAzulSprite.angle); }
//default constructor public Sprite() : base() { this.spriteName = Sprite.SpriteName.Uninitilized; this.spriteImage = ImageManager.find(Image.ImageName.NullObject); Debug.Assert(this.spriteImage != null); this.spriteColor = new Azul.Color(); Debug.Assert(this.spriteColor != null); this.screenRect = new Azul.Rect(cDefScreenRect); Debug.Assert(screenRect != null); this.azulSprite = new Azul.Sprite(spriteImage.getAzulTexture(), spriteImage.imageRect, cDefScreenRect, this.spriteColor); Debug.Assert(this.azulSprite != null); this.x = azulSprite.x; this.y = azulSprite.y; this.sx = azulSprite.sx; this.sy = azulSprite.sy; this.angle = azulSprite.angle; }
// Azul.Sprite is created from the input rectangle public void setAzulSprite(Azul.Sprite azulSprite) { this.azulSprite = azulSprite; }
// generic method to create a Azul Sprite private Azul.Sprite createAzulSprite(Image spriteImage, Azul.Rect screenRect) { Azul.Sprite azulSprite = new Azul.Sprite(spriteImage.imageTexture.azulTexture, spriteImage.imageRect, screenRect); return(azulSprite); }
public virtual void Init(CharacterEnum alienType = CharacterEnum.crab, int xCordinate = 100, int yCordinate = 50) { states = RectFactory.GetRects(alienType); sprite = SpriteFactory.GetSprite(states[0], xCordinate, yCordinate); Debug.Assert(sprite != null); }
void LoadLevel() { p1LifeDisplay = new Azul.Sprite(GameObject.shipTexture, new Azul.Rect(0, 0, 32, 32), new Azul.Rect(0, 0, 30, 30), new Azul.Color(0, 1, 0)); p1LifeDisplay.angle = 90 * PhysicWorld.MATH_PI_180; p2LifeDisplay = new Azul.Sprite(GameObject.shipTexture, new Azul.Rect(0, 0, 32, 32), new Azul.Rect(0, 0, 30, 30), new Azul.Color(0, 0.5f, 1)); p2LifeDisplay.angle = 90 * PhysicWorld.MATH_PI_180; p1MineDisplay = new Azul.Sprite(GameObject.mineTexture, new Azul.Rect(0, 0, 12, 12), new Azul.Rect(0, 0, 20, 20), new Azul.Color(0, 1, 0)); p2MineDisplay = new Azul.Sprite(GameObject.mineTexture, new Azul.Rect(0, 0, 12, 12), new Azul.Rect(0, 0, 20, 20), new Azul.Color(0, 0.5f, 1.0f)); player1 = new Ship(new Azul.Rect(400, 100, 30, 30), new Azul.Color(0, 1, 0)); player2 = new Ship(new Azul.Rect(400, 400, 30, 30), new Azul.Color(0, 0.5f, 1)); gameObjList.Add(player1); gameObjList.Add(player2); // OutsideBox gameObjList.Add(new FencePost(new Azul.Rect(5, 5, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(200, 5, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(400, 5, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(600, 5, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(800 - 5, 5, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(0 + 5, 495, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(200, 495, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(400, 495, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(600, 495, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(800 - 5, 495, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(5, 250, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(795, 250, 10, 10))); // InsideBox gameObjList.Add(new FencePost(new Azul.Rect(200, 170, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(400, 170, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(600, 170, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(200, 330, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(400, 330, 10, 10))); gameObjList.Add(new FencePost(new Azul.Rect(600, 330, 10, 10))); // Fence OutsideBox gameObjList.Add(new Fence(new Azul.Rect(100, 5, 8, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(300, 5, 8, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(500, 5, 8, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(700, 5, 8, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(100, 495, 8, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(300, 495, 8, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(500, 495, 8, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(700, 495, 8, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(5, 125, 8, 250), 0)); gameObjList.Add(new Fence(new Azul.Rect(5, 375, 8, 250), 0)); gameObjList.Add(new Fence(new Azul.Rect(795, 125, 8, 250), 0)); gameObjList.Add(new Fence(new Azul.Rect(795, 375, 8, 250), 0)); // Fence InsideBox gameObjList.Add(new Fence(new Azul.Rect(300, 170, 10, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(500, 170, 10, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(300, 330, 10, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(500, 330, 10, 200), 90)); gameObjList.Add(new Fence(new Azul.Rect(200, 250, 10, 160), 0)); gameObjList.Add(new Fence(new Azul.Rect(600, 250, 10, 160), 0)); }