コード例 #1
0
ファイル: Game1.cs プロジェクト: ZachPeterson/Spectrum
        public Game1()
        {
            this.Window.Title = "Spectrum";
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.PreferredBackBufferHeight = 720;
            graphics.PreferredBackBufferWidth = 1280;
            aaDisplay = new Display(this);
            mManager = new StateManager();
            mGame = new State_GameState(this);
            mSplash = new State_SplashState(this);
            mMainMenu = new State_Menu_Main(this);
            mShipMenu = new State_Menu_Ship(this);
            mInstructionsMenu = new State_Menu_Instructions(this);
            mHighScoreMenu = new State_Menu_HighScore(this);
            aaHSManager = new GameIO();
            mGameSoundFX = new List<SoundEffectInstance>();
            mGameSoundFXRemove = new List<SoundEffectInstance>();

            this.IsMouseVisible = true;

            Int64 performanceFrequency = 0;
            PerformanceTimer.QueryPerformanceFrequency(out performanceFrequency);
            secondsPerCount = 1.0f / (float)performanceFrequency;
            PerformanceTimer.QueryPerformanceCounter(out currentTimeStamp);
            previousTimeStamp = currentTimeStamp;
        }
コード例 #2
0
ファイル: GameWorld.cs プロジェクト: ZachPeterson/Spectrum
        public GameWorld(Display pDisplay)
        {
            aaDisplay = pDisplay;

                mToSpawnEntityList = new List<Entity>();
                mEntityList = new List<Entity>();
                mEntityDeadList = new List<Entity>();
                mProjectileList = new List<Projectile>();
                mProjDeadList = new List<Projectile>();
                mRemovedProjectileList = new List<Projectile>();
                mPickups = new List<Pickup>();

                //Init CollisionLists
                CollisionShapes_Circle = new List<CircleCollision>();
                CollisionShapes_Points = new List<PointCollision>();
                CollisionShapes_Lines = new List<LineCollision>();

                CollisionShapes_Circle_ToRemove = new List<CircleCollision>();
                CollisionShapes_Points_ToRemove = new List<PointCollision>();
                CollisionShapes_Lines_ToRemove = new List<LineCollision>();

                mRand = new Random();

                mKit_Aimer = new AssetKit_UI_Aimer();
                mKit_Crosshair = new AssetKit_UI_Crosshair();
                mKit_HealthBorder = new AssetKit_UI_HealthBar_Border();
                mKit_HealthBar = new AssetKit_UI_HealthBar_Bar();
                mKit_HealthWhite = new AssetKit_UI_HealthBar_BarWhite();
                mKit_GameOver = new AssetKit_GameOver_Score();
                mKit_Paused = new AssetKit_Paused_Plaque();

                mEntityManager = new EntityManager(this);
        }
コード例 #3
0
 public DisplayObject_Animated(Display pDisplay, string pAssetFile, float pPosX, float pPosY, int pOriginX, int pOriginY, float pDepth, int pSrc_RectX = 0, int pSrc_RectY = 0, int pWidth = -1, int pHeight = -1, float pRotation=0, bool pIsExemptFromCamera = false, bool pIsRepeating=false)
     : base(pDisplay, pAssetFile, pPosX, pPosY, pOriginX, pOriginY, pDepth, pSrc_RectX, pSrc_RectY, pWidth, pHeight, pRotation, pIsExemptFromCamera)
 {
     mIsComplete = false;
     mCurrentFrame = 0;
     mCurrentAnimation = 0;
     mCurrentFrame = 0;
     mCurrentAnimation_Length = 0;
     mCurrentAnimation_Speed = 0;
     mCurrentAnimation_Speed_Counter = 0;
     mIsRepeating = pIsRepeating;
 }
コード例 #4
0
ファイル: UIElement.cs プロジェクト: ZachPeterson/Spectrum
        public UIElement(Display pDisplay, GameWorld pGameWorld, string pAssetFile, int pPosX, int pPosY, int pOriginX, int pOriginY, float pDepth, int pSrc_RectX = 0, int pSrc_RectY = 0, int pWidth = -1, int pHeight = -1, float pRotation = 0, float pScale = 1.0f)
        {
            aaDisplay = pDisplay;
            aaGameWorld = pGameWorld;
            mAssetFile = pAssetFile;
            posX = pPosX;
            posY = pPosY;
            mOrigin = new Vector2(pOriginX, pOriginY);
            src_RectX = pSrc_RectX;
            src_RectY = pSrc_RectY;
            src_RectWidth = pWidth;
            src_RectHeight = pHeight;
            mDepth = pDepth;
            mRotation = pRotation;
            mOpacity = 1.0f;
            mScale = pScale;

            Hide();
        }
コード例 #5
0
 public DisplayObject(Display pDisplay, string pAssetFile, float pPosX, float pPosY, int pOriginX, int pOriginY, float pDepth, int pSrc_RectX = 0, int pSrc_RectY = 0, int pWidth = -1, int pHeight = -1, float pRotation=0, bool pIsExemptFromCamera = false)
 {
     aaDisplay = pDisplay;
     mAssetFile = pAssetFile;
     posX = pPosX;
     posY = pPosY;
     mOrigin = new Vector2(pOriginX, pOriginY);
     src_RectX = pSrc_RectX;
     src_RectY = pSrc_RectY;
     src_RectWidth = pWidth;
     src_RectHeight = pHeight;
     mDepth = pDepth;
     mHorizontalFlip = false;
     mVerticalFlip = false;
     mRotation = pRotation;
     mOpacity = 1.0f;
     mZoom = 1.0f;
     isExemptFromCamera = pIsExemptFromCamera;
     mBlendColor = Color.White;
     aaDisplay.AddToDisplayList(this);
     mIsShowing = false;
     Show();
 }
コード例 #6
0
ファイル: UIElement.cs プロジェクト: ZachPeterson/Spectrum
        public UIElement_WaveDisplay(Display pDisplay, GameWorld pGameWorld, SpriteFont pFont, int pPosX, int pPosY, Color pTextColor)
            : base(pDisplay, pGameWorld, "", pPosX, pPosY, 0, 0, 0, 0, 0, 0, 0, 0)
        {
            mFont = pFont;
            mColor = pTextColor;

            mElapsedTime = 0.0f;

            Hide();
        }
コード例 #7
0
ファイル: UIElement.cs プロジェクト: ZachPeterson/Spectrum
 public UIElement_Text(Display pDisplay, GameWorld pGameWorld, SpriteFont pFont, int pPosX, int pPosY, Color pTextColor, string pText)
     : base(pDisplay, pGameWorld, "", pPosX, pPosY, 0, 0, 0, 0, 0, 0, 0, 0)
 {
     mFont = pFont;
     mColor = pTextColor;
     mText = pText;
     mPos = new Vector2(pPosX, pPosY);
 }
コード例 #8
0
ファイル: UIElement.cs プロジェクト: ZachPeterson/Spectrum
 public UIElement_StaticMenuElement(Display pDisplay, GameWorld pGameWorld, string pAssetFile, int pPosX, int pPosY, int pOriginX, int pOriginY, float pDepth, int pSrc_RectX = 0, int pSrc_RectY = 0, int pWidth = -1, int pHeight = 01, float pRotation = 0)
     : base(pDisplay, pGameWorld, pAssetFile, pPosX, pPosY, pOriginX, pOriginY, pDepth, pSrc_RectX, pSrc_RectY, pWidth, pHeight, pRotation)
 {
 }
コード例 #9
0
ファイル: UIElement.cs プロジェクト: ZachPeterson/Spectrum
 public UIElement_ShipAimer(Display pDisplay, GameWorld pGameWorld, Ship pTrackedShip, string pAssetFile, int pPosX, int pPosY, int pOriginX, int pOriginY, float pDepth, int pSrc_RectX = 0, int pSrc_RectY = 0, int pWidth = -1, int pHeight = 01, float pRotation = 0)
     : base(pDisplay, pGameWorld, pAssetFile, pPosX, pPosY, pOriginX, pOriginY, pDepth, pSrc_RectX, pSrc_RectY, pWidth, pHeight, pRotation)
 {
     mShip = pTrackedShip;
     Show();
 }
コード例 #10
0
ファイル: UIElement.cs プロジェクト: ZachPeterson/Spectrum
        public UIElement_ScoreTextBox(Display pDisplay, GameWorld pGameWorld, int pPosX, int pPosY)
            : base(pDisplay, pGameWorld, "", pPosX, pPosY, 0, 0, 0, 0, 0, 0, 0, 0)
        {
            mAcceptPressed = false;
            mCancelPressed = false;
            mFont = pDisplay.aaGame.mTextboxFont;
            mColor = Color.White;
            mTextBox = new UIElement_StaticMenuElement(pDisplay, pGameWorld, "Menu_MASTER", pPosX + mTextBoxXOffset, pPosY + mTextBoxYOffset, 0, 0, Constants.LAYER_UI_FRONT, 0, 197, 301, 39, 0);
            mNameLabel = new UIElement_StaticMenuElement(pDisplay, pGameWorld, "Menu_MASTER", pPosX + mNameLabelXOffset, pPosY + mNameLabelYOffset, 0, 0, Constants.LAYER_UI_FRONT, 302, 197, 150, 39, 0);
            mAcceptButton = new UIElement_MenuButton(pDisplay, pGameWorld, "Menu_MASTER", pPosX + mAcceptButtonXOffset, pPosY + mAcceptButtonYOffset, 0, 0, Constants.LAYER_UI_FRONT, 0, 157, 100, 39, 0);
            mCancelButton = new UIElement_MenuButton(pDisplay, pGameWorld, "Menu_MASTER", pPosX + mCancelButtonXOffset, pPosY + mCancelButtonYOffset, 0, 0, Constants.LAYER_UI_FRONT, 201, 157, 100, 39, 0);

            // Initialize the key dictionary
            characterByKey = new Dictionary<Keys, char>()
            {
                {Keys.A, 'a'},
                {Keys.B, 'b'},
                {Keys.C, 'c'},
                {Keys.D, 'd'},
                {Keys.E, 'e'},
                {Keys.F, 'f'},
                {Keys.G, 'g'},
                {Keys.H, 'h'},
                {Keys.I, 'i'},
                {Keys.J, 'j'},
                {Keys.K, 'k'},
                {Keys.L, 'l'},
                {Keys.M, 'm'},
                {Keys.N, 'n'},
                {Keys.O, 'o'},
                {Keys.P, 'p'},
                {Keys.Q, 'q'},
                {Keys.R, 'r'},
                {Keys.S, 's'},
                {Keys.T, 't'},
                {Keys.U, 'u'},
                {Keys.V, 'v'},
                {Keys.W, 'w'},
                {Keys.X, 'x'},
                {Keys.Y, 'y'},
                {Keys.Z, 'z'},
                {Keys.D0, '0'},
                {Keys.D1, '1'},
                {Keys.D2, '2'},
                {Keys.D3, '3'},
                {Keys.D4, '4'},
                {Keys.D5, '5'},
                {Keys.D6, '6'},
                {Keys.D7, '7'},
                {Keys.D8, '8'},
                {Keys.D9, '9'},
                {Keys.NumPad0, '0'},
                {Keys.NumPad1, '1'},
                {Keys.NumPad2, '2'},
                {Keys.NumPad3, '3'},
                {Keys.NumPad4, '4'},
                {Keys.NumPad5, '5'},
                {Keys.NumPad6, '6'},
                {Keys.NumPad7, '7'},
                {Keys.NumPad8, '8'},
                {Keys.NumPad9, '9'},
                {Keys.OemPeriod, '.'},
                {Keys.OemMinus, '-'},
                {Keys.Space, ' '}
            };
            mTextBoxText = new StringBuilder();
            mPreviousKeyState = Keyboard.GetState();
        }
コード例 #11
0
ファイル: UIElement.cs プロジェクト: ZachPeterson/Spectrum
        public UIElement_PlayerScore(Display pDisplay, GameWorld pGameWorld, SpriteFont pFont, int pPosX, int pPosY, Color pTextColor)
            : base(pDisplay, pGameWorld, "", pPosX, pPosY, 0, 0, 0, 0, 0, 0, 0, 0)
        {
            mFont = pFont;
            mColor = pTextColor;

            Show();
        }
コード例 #12
0
ファイル: UIElement.cs プロジェクト: ZachPeterson/Spectrum
 public UIElement_MenuButton(Display pDisplay, GameWorld pGameWorld, string pAssetFile, int pPosX, int pPosY, int pOriginX, int pOriginY, float pDepth, int pSrc_RectX = 0, int pSrc_RectY = 0, int pWidth = -1, int pHeight = 01, float pRotation = 0)
     : base(pDisplay, pGameWorld, pAssetFile, pPosX, pPosY, pOriginX, pOriginY, pDepth, pSrc_RectX, pSrc_RectY, pWidth, pHeight, pRotation)
 {
     baseSourceX = pSrc_RectX;
     baseSourceY = pSrc_RectY;
     currentButtonState = Mouse.GetState().LeftButton;
 }
コード例 #13
0
ファイル: UIElement.cs プロジェクト: ZachPeterson/Spectrum
 public UIElement_HealthBar_BarWhite(Display pDisplay, GameWorld pGameWorld, string pAssetFile, int pPosX, int pPosY, int pOriginX, int pOriginY, float pDepth, Ship pPlayer, int pSrc_RectX = 0, int pSrc_RectY = 0, int pWidth = -1, int pHeight = 01, float pRotation = 0)
     : base(pDisplay, pGameWorld, pAssetFile, pPosX, pPosY, pOriginX, pOriginY, pDepth, pSrc_RectX, pSrc_RectY, pWidth, pHeight, pRotation)
 {
     Show();
     mPlayer = pPlayer;
     mOrigRectWidth = pWidth;
 }
コード例 #14
0
ファイル: UIElement.cs プロジェクト: ZachPeterson/Spectrum
 public UIElement_AbilityIndicator(Display pDisplay, GameWorld pGameWorld, Ability pTrackedAbility, AssetKit pAssetKit, int pPosX, int pPosY, float pDepth, float pRotation = 0)
     : base(pDisplay, pGameWorld, pAssetKit.ASSET_NAME, pPosX, pPosY, (int)pAssetKit.ORIGIN.X, (int)pAssetKit.ORIGIN.Y, pDepth, pAssetKit.SRC_RECTX, pAssetKit.SRC_RECTY, pAssetKit.SRC_RECTWIDTH, pAssetKit.SRC_RECTHEIGHT, pRotation, 2.0f)
 {
     mTrackedAbility = pTrackedAbility;
     Show();
 }
コード例 #15
0
ファイル: Pickup.cs プロジェクト: ZachPeterson/Spectrum
        public Pickup(Display pDisplay, GameWorld pGameWorld, string pAssetFile, Vector2 pPosition, Vector2 pOrigin, float pDepth, Rectangle pSrcRect, float pRotation = 0)
        {
            mDisplay = pDisplay;
            mGameWorld = pGameWorld;
            mPickupDisplay = new DisplayObject(pDisplay, pAssetFile, pPosition.X, pPosition.Y, (int)pOrigin.X, (int)pOrigin.Y, pDepth, pSrcRect.X, pSrcRect.Y, pSrcRect.Width, pSrcRect.Height, pRotation, false);

            mCollisionCircle = new CircleCollision(pPosition.X, pPosition.Y, mPickupRadius);
            mCollisionCircle.mIsPickup = true;
            mCollisionCircle.mPickupOwner = this;
            mGameWorld.CollisionShapes_Circle.Add(mCollisionCircle);
        }
コード例 #16
0
ファイル: Pickup.cs プロジェクト: ZachPeterson/Spectrum
 public HealthPickup(Display pDisplay, GameWorld pGameWorld, string pAssetFile, Vector2 pPosition, Vector2 pOrigin, float pDepth, Rectangle pSrcRect, float pRotation = 0)
     : base(pDisplay, pGameWorld, pAssetFile, pPosition, pOrigin, pDepth, pSrcRect, pRotation)
 {
 }