add Initialize() to IWindow & refactor uses of IWindow
GitOrigin-RevId: fa4c2f04d3182cd37f85cfd03e6a2025b4e4d4f7
This commit is contained in:
parent
bb5aab6495
commit
92f4558c18
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Jumpy {
|
namespace Jumpy {
|
||||||
public interface IWindow {
|
public interface IWindow {
|
||||||
void SetFullScreen(bool fullScreen, Game game, GraphicsDeviceManager graphics);
|
void Initialize(GameWindow window, GraphicsDeviceManager graphics);
|
||||||
|
void SetFullScreen(bool fullScreen);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ namespace Jumpy {
|
|||||||
SpriteFont font;
|
SpriteFont font;
|
||||||
KeyboardInput keyboardInput = new KeyboardInput();
|
KeyboardInput keyboardInput = new KeyboardInput();
|
||||||
bool fullScreen = false;
|
bool fullScreen = false;
|
||||||
IWindow window;
|
IWindow display;
|
||||||
|
|
||||||
public JumpyGame() {
|
public JumpyGame() {
|
||||||
graphics = new GraphicsDeviceManager(this);
|
graphics = new GraphicsDeviceManager(this);
|
||||||
@ -21,9 +21,9 @@ namespace Jumpy {
|
|||||||
|
|
||||||
// Performs initialization that's needed before starting to run.
|
// Performs initialization that's needed before starting to run.
|
||||||
protected override void Initialize() {
|
protected override void Initialize() {
|
||||||
window = (IWindow) Services.GetService(typeof(IWindow));
|
display = (IWindow) Services.GetService(typeof(IWindow));
|
||||||
window.SetFullScreen(fullScreen, this, graphics);
|
display.Initialize(Window, graphics);
|
||||||
|
display.SetFullScreen(fullScreen);
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ namespace Jumpy {
|
|||||||
|
|
||||||
if (keysDown.Contains(Keys.F12)) {
|
if (keysDown.Contains(Keys.F12)) {
|
||||||
fullScreen = !fullScreen;
|
fullScreen = !fullScreen;
|
||||||
window.SetFullScreen(fullScreen, this, graphics);
|
display.SetFullScreen(fullScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
||||||
|
Loading…
Reference in New Issue
Block a user