public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; //Bildschirmeinstellungen festlegen this.graphics.PreferredBackBufferWidth = 800; this.graphics.PreferredBackBufferHeight = 600; this.graphics.IsFullScreen = false; gameStatics.GameDimensions = new int[] { this.graphics.PreferredBackBufferWidth, this.graphics.PreferredBackBufferHeight }; //Grafik: gameStatics.GameGraphicObject = new GraphicObject(); //Schrift gameStatics.FontObject = new FontObject(1000); //Spielfenster: ActualGame = new actualGame(); ActualGame.setDraw(true); //Hauptmenü MainScreen = new mainScreen(); //Intro introPlayer = new VideoPlayer(); }
protected override void Update(GameTime gameTime) { //Notausstieg für Debug if (Keyboard.GetState().IsKeyDown(Keys.I)) this.Exit(); //gamestatics die aktuellen Stati zuweisen gameStatics.GameGameTime = gameTime; gameStatics.GameGraphicObject.update(); gameStatics.kState = Keyboard.GetState(); gameStatics.mState = Mouse.GetState(); //Spiel updaten: ActualGame.update(gameTime); MainScreen.update(); base.Update(gameTime); if (gameStatics.gamestateAkt == gameStatics.gameStateGame) { ActualGame.resume(); MainScreen.setActive(false); //Test für die Grafikengine: int id = 0; if (Mouse.GetState().LeftButton == ButtonState.Pressed) { if (test) { id = gameStatics.GameGraphicObject.newGraphicObject(); gameStatics.GameGraphicObject.load(id, Content.Load<Texture2D>("AKaeferY")); gameStatics.GameGraphicObject.setSize(id, new int[] { 50, 50 }); gameStatics.GameGraphicObject.setPosition(id, new int[] { Mouse.GetState().X, Mouse.GetState().Y }, false); gameStatics.GameGraphicObject.setAnimationInformation(id, 4, 1, 150, 150, 10); gameStatics.GameGraphicObject.setRotation(id, 2); gameStatics.GameGraphicObject.setRank(id, 1); gameStatics.GameGraphicObject.setMoveIntoDirection(id, 0.5f, 10, 100); test = false; } } //Ende test //---------------------------------------------------------------------- } else { ActualGame.pause(); if (gameStatics.gamestateAkt == gameStatics.gameStateIntro) { gameStatics.gamestateAkt = gameStatics.gameStateMainScreen; MainScreen.setActive(false); } if (gameStatics.gamestateAkt == gameStatics.gameStateMainScreen) { //Wenn mainscreen noch nicht erzeugt wurde if (MainScreen == null) { MainScreen = new mainScreen(); MainScreen.setActive(true); MainScreen.load(); } else MainScreen.setActive(true); } } }