AxiosEngine-old 

AxiosEngine-old Commit Details


Date:2012-05-26 22:53:00 (12 years 6 months ago)
Author:Natalie Adams
Branch:xnacc-integration
Commit:2f35487eb9ec
Parents: 3190762571e2
Message:Adding default Font if one is not provided

Adding a flag to AxiosGameScreen to allow a developer to disable
input across everything if the console is visible/active.
Changing Deactivate to Unload because Unload is what is gets called
when a screen is told to go away
Changes:
Maxios/Axios_settings.cs (1 diff)
Maxios/Engine/AxiosCommandConsole.cs (2 diffs)
Maxios/Engine/AxiosGameScreen.cs (5 diffs)

File differences

axios/Axios_settings.cs
9292
9393
9494
95
9596
9697
9798
* - Changing AxiosTitleFile.GetStream() to return Stream instead of FileStream
* - Changing IAxiosFile.GetStream() to return Stream instead of FileStream
* - Adding support for XNACC
* - Fixed a bug where cleanup actions were being performed in Deactivate instead of Unload in AxiosGameScreen
*
*/
#endregion
axios/Engine/AxiosCommandConsole.cs
2020
2121
2222
23
23
2424
25
2526
2627
2728
29
2830
2931
3032
3133
3234
3335
36
3437
3538
3639
37
40
3841
3942
4043
4144
4245
46
4347
48
49
50
51
52
53
54
55
56
4457
4558
4659
......
5366
5467
5568
56
69
5770
71
5872
5973
6074
namespace Axios.Engine
{
class AxiosCommandConsole : CommandConsoleBase
public class AxiosCommandConsole : CommandConsoleBase
{
//private AxiosGameScreen _gameScreen;
public AxiosCommandConsole(AxiosGameScreen gameScreen)
: base(gameScreen.ScreenManager.Game)
{
//_gameScreen = gameScreen;
Keyboard = gameScreen.ScreenManager.InputState;
}
public AxiosCommandConsole(AxiosGameScreen gameScreen, SpriteFont font)
: base(gameScreen.ScreenManager.Game, font)
{
//_gameScreen = gameScreen;
Keyboard = gameScreen.ScreenManager.InputState;
}
protected override void LoadContent()
protected void LoadDefault()
{
FadeColor = Color.White * 0.5f;
Texture2D tmp = new Texture2D(GraphicsDevice, 1, 1);
tmp.SetData<Color>(new Color[] { Color.Black });
FadeImage = tmp;
}
public override void LoadContent(ContentManager content)
{
base.LoadContent(content);
}
protected override void LoadContent()
{
if (Font == null)
Font = Game.Content.Load<SpriteFont>("Console");
base.LoadContent();
}
}
using Microsoft.Xna.Framework.Graphics;
namespace Axios.Engine
{
class AxiosCommandConsole
public class AxiosCommandConsole
{
public bool Active = false;
public AxiosCommandConsole(AxiosGameScreen gameScreen)
{
axios/Engine/AxiosGameScreen.cs
4343
4444
4545
46
47
48
49
50
51
52
53
4654
4755
4856
......
110118
111119
112120
121
113122
114123
115124
......
230239
231240
232241
233
242
234243
235244
236245
......
379388
380389
381390
382
391
392
393
383394
384
385
395
396
386397
387
388
398
399
400
389401
390402
391
403
392404
405
393406
394407
395408
......
409422
410423
411424
425
426
427
428
429
430
431
412432
413433
414434
AxiosCommandConsole _console = null;
protected bool AllowKeyboardWhileConsoleIsActive = false;
public AxiosCommandConsole Console
{
get { return _console; }
private set { _console = value; }
}
public AxiosGameScreen()
: base()
{
_console = (AxiosCommandConsole)obj;
#if WINDOWS
ScreenManager.Game.Components.Add(_console);
_console.LoadContent(ScreenManager.Game.Content);
#endif
}
if (obj is AxiosGameObject || obj is AxiosUIObject || obj is AxiosTimer)
public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
{
base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
if (this._objectstoremove.Count > 0)
{
List<AxiosGameObject> list = this._objectstoremove.ToList<AxiosGameObject>();
public override void HandleInput(GameTime gameTime, InputState input)
{
base.HandleInput(gameTime, input);
if ((AllowKeyboardWhileConsoleIsActive && _console.Active) || !_console.Active)
{
base.HandleInput(gameTime, input);
foreach (AxiosGameObject g in _gameObjects.ToList())
g.HandleInput(this, input, gameTime);
foreach (AxiosGameObject g in _gameObjects.ToList())
g.HandleInput(this, input, gameTime);
foreach (AxiosUIObject g in _uiobjects.ToList())
g.HandleInput(this, input, gameTime);
foreach (AxiosUIObject g in _uiobjects.ToList())
g.HandleInput(this, input, gameTime);
}
}
public override void Deactivate()
public override void Unload()
{
//System.Diagnostics.Debugger.Break();
base.Deactivate();
AxiosLog.Instance.AddLine("Memory usage before cleanup: " + GC.GetTotalMemory(true).ToString(), LoggingFlag.DEBUG);
foreach (AxiosGameObject g in _gameObjects)
//AxiosIsolatedFile f = new AxiosIsolatedFile("log.log");
//f.WriteData(AxiosLog.Instance.GetLog(), FileMode.Append);
//CleanUp();
#if WINDOWS
if (_console != null)
{
ScreenManager.Game.Components.Remove(_console);
_console.Dispose();
}
#endif
}

Archive Download the corresponding diff file

Page rendered in 0.52040s using 14 queries.