axiosengine 

axiosengine Commit Details


Date:2015-01-02 20:14:38 (9 years 9 months ago)
Author:Natalie Adams
Branch:master
Commit:01748bc5f8b78a55a8d8a0fdcbdff50d21b78322
Parents: b6e6744a88c2ad05cd4a4690f621bbaaed487497
Message:Fixing axios log flag detection Adding dispose methods to AxiosFile objects Adding extended log to AxiosLog Fixing issue in CommandConsole where the first line would not be displayed Adding commands to commandconsole

Changes:

File differences

axios/Axios_settings.cs
136136
137137
138138
139
140
141
142
139143
140144
141145
* - Adding XOR Shift random class
* - Adding extension for rectangleitem to get position in Farseer units ( getSimPosition )
* - Adding extension for vector2 to convert back and forth between sim and display units
* - Fixing axios log flag detection
* - Adding dispose methods to AxiosFile objects
* - Adding extended log to AxiosLog
* - Fixing issue in CommandConsole where the first line would not be displayed
*
*/
#endregion
axios/Engine/AxiosCommandConsole.cs
88
99
1010
11
1112
1213
1314
......
2324
2425
2526
26
27
2728
29
30
31
2832
2933
3034
......
6569
6670
6771
72
73
6874
6975
7076
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework;
using Axios.Engine.Log;
using Axios.Engine.Data;
/*
* The empty AxiosCommandConsole is so that when you use the comamnd console
{
public class AxiosCommandConsole : CommandConsoleBase
{
protected AxiosGameScreen GameScreen;
public AxiosGameScreen GameScreen;
protected List<string> RestrictedCommands = new List<string>();
public bool KeepRunning = false;
public AxiosCommandConsole(AxiosGameScreen gameScreen)
: base(gameScreen.ScreenManager.Game)
{
{
AddCommand(new CmdObject("axioslog", "Displays the current Axios Log", input => { ShowAxiosLog(); }));
AddCommand(new CmdObject("tcc", "Toggles user camera control", input => { ToggleCamera(); }));
AddCommand(new CmdObject("axiosloglevel", "Outputs axios log level", input => { AddOutputToLog(Settings.Loglevel.ToString()); }));
AddCommand(new CmdObject("saveaxiosextlog", "Saves Axios Engine extended log (any log events)", input => { AxiosLog.Instance.writeExtendedLog(); }));
base.InitializeCustomCommands();
}
axios/Engine/AxiosGameScreen.cs
6565
6666
6767
68
68
6969
7070
7171
72
73
7274
7375
7476
......
328330
329331
330332
333
334
335
336
337
338
339
340
341
342
331343
332344
333345
......
517529
518530
519531
520
532
521533
522534
523535
public AxiosCommandConsole Console
{
get { return _console; }
private set { _console = value; }
set { _console = value; }
}
#endif
protected bool screenHidden = false;
public AxiosGameScreen()
: base()
{
public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool coveredByOtherScreen)
{
if (otherScreenHasFocus)
{
screenHidden = true;
}
if (screenHidden && !otherScreenHasFocus)
{
this.ReActivate();
screenHidden = false;
}
base.Update(gameTime, otherScreenHasFocus, coveredByOtherScreen);
if (this._objectstoremove.Count > 0)
//f.WriteData(AxiosLog.Instance.GetLog(), FileMode.Append);
//CleanUp();
#if WINDOWS
if (_console != null)
if (_console != null && !_console.KeepRunning)
{
//System.Diagnostics.Debugger.Break();
ScreenManager.Game.Components.Remove(_console);
axios/Engine/Data/Cache.cs
99
1010
1111
12
1213
1314
1415
......
3435
3536
3637
37
38
39
40
41
42
43
44
45
46
47
3848
3949
4050
// A. This is not to cache textures loaded by content manager
// but other data/content that isn't. Use cases include:
// - Any graphics generated during runtime (such as dialogs)
// - Command console
// - Any data that is loaded in during run time (such as maps)
// Content manager performs it's own caching so anything loaded by it
// or the Gameservice - then attempted to load again will not be loaded
public object get(string key)
{
return _cache[key];
object val;
_cache.TryGetValue(key, out val);
return val;
}
public T get<T>(string key)
{
object val;
_cache.TryGetValue(key, out val);
return (T)val;
}
public void set(string key, object obj)
axios/Engine/Extensions/RectangleItemProperties.cs
1717
1818
1919
20
21
22
23
24
25
2026
2127
pos.Y += ConvertUnits.ToSimUnits(prop.Height / 2);
return pos;
}
public static Vector2 getCenter(this RectangleItemProperties prop)
{
return prop.getSimPosition() / ConvertUnits.ToSimUnits(2);
}
}
}
axios/Engine/Extensions/Vector2.cs
1919
2020
2121
22
2223
2324
{
return ConvertUnits.ToDisplayUnits(vec);
}
}
}
axios/Engine/File/AxiosFile.cs
99
1010
1111
12
13
1214
1315
1416
{
protected string _content;
protected bool disposed = false;
public String Content
{
get { return _content; }
axios/Engine/File/AxiosIsolatedFile.cs
11
22
33
4
45
56
67
78
89
9
10
1011
1112
1213
......
5859
5960
6061
61
62
63
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
6485
6586
6687
using System.IO;
using System.IO.IsolatedStorage;
using Axios.Engine.Interfaces;
using System;
namespace Axios.Engine.File
{
public class AxiosIsolatedFile : AxiosFile, IAxiosFile
{
protected IsolatedStorageFileStream _fs;
public AxiosIsolatedFile(string filename)
{
this._filename = filename;
#else
IsolatedStorageFile savegameStorage = IsolatedStorageFile.GetUserStoreForApplication();
#endif
IsolatedStorageFileStream fs = null;
fs = savegameStorage.OpenFile(_filename, mode);
return (Stream)fs;
_fs = null;
_fs = savegameStorage.OpenFile(_filename, mode);
return (Stream)_fs;
}
public void Dispose()
{
// http://msdn.microsoft.com/en-us/library/system.idisposable%28v=vs.110%29.aspx
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposed)
return;
if (disposing && _fs != null)
{
_fs.Close();
}
disposed = true;
}
}
axios/Engine/File/AxiosRegularFile.cs
11
2
23
34
45
56
67
7
8
89
10
911
1012
1113
......
3941
4042
4143
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
4467
4568
4669
using System.IO;
using System;
using Axios.Engine.Interfaces;
namespace Axios.Engine.File
{
public class AxiosRegularFile : AxiosFile, IAxiosFile
public class AxiosRegularFile : AxiosFile, IAxiosFile, IDisposable
{
protected FileStream _fs;
public AxiosRegularFile(string file)
{
_filename = file;
public override Stream GetStream(FileMode mode)
{
FileStream fs = new FileStream(_filename, mode);
return (Stream)fs;
_fs = new FileStream(_filename, mode);
return (Stream)_fs;
}
public void Dispose()
{
// http://msdn.microsoft.com/en-us/library/system.idisposable%28v=vs.110%29.aspx
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposed)
return;
if (disposing && _fs != null)
{
_fs.Close();
}
disposed = true;
}
}
}
axios/Engine/File/AxiosTitleFile.cs
55
66
77
8
8
99
10
1011
1112
1213
......
3031
3132
3233
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
3456
3557
3658
namespace Axios.Engine.File
{
public class AxiosTitleFile : AxiosFile, IAxiosFile
public class AxiosTitleFile : AxiosFile, IAxiosFile, IDisposable
{
protected Stream _fs;
public AxiosTitleFile(string filename)
{
//Title Files can only be opened for reading!
public override Stream GetStream(FileMode mode)
{
return (Stream)TitleContainer.OpenStream(_filename);;
_fs = (Stream)TitleContainer.OpenStream(_filename);
return _fs;
}
public void Dispose()
{
// http://msdn.microsoft.com/en-us/library/system.idisposable%28v=vs.110%29.aspx
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (disposed)
return;
if (disposing && _fs != null)
{
_fs.Close();
}
disposed = true;
}
}
}
axios/Engine/Log/AxiosLog.cs
11
22
3
4
35
46
57
......
1315
1416
1517
16
18
1719
1820
1921
2022
23
24
25
2126
2227
2328
2429
30
2531
2632
2733
2834
29
30
35
36
37
38
39
40
3141
42
43
44
3245
3346
3447
......
4558
4659
4760
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
4877
4978
using System;
using System.Collections.Generic;
using Axios.Engine.Data;
using Axios.Engine.File;
namespace Axios.Engine.Log
WARN = 4,
ERROR = 8,
FATAL = 16,
ALL = 32
ALL = ~0
}
public class AxiosLog : Singleton<AxiosLog>
{
private List<string> _log;
// Logs everything regardless of log level
// Used for debugging purposes
private List<string> _extendedlog;
public AxiosLog()
{
_log = new List<string>();
_extendedlog = new List<string>();
}
public void AddLine(string line, LoggingFlag flag)
{
if (flag <= Settings.Loglevel)
if (Settings.Loglevel.HasFlag(flag))
{
AxiosCommandConsole c = (AxiosCommandConsole)Cache.Instance.get("commandconsole");
if (c != null)
c.AddToLog(line);
_log.Add("[" + DateTime.Now.ToString("M/d/yyyy H:mm:ss") + " - " + flag.ToString() + "]" + line);
}
_extendedlog.Add("[" + DateTime.Now.ToString("M/d/yyyy H:mm:ss") + " - " + flag.ToString() + "]" + line);
}
public List<string> GetLogList()
{
return GetLog("\r\n");
}
public void writeLog()
{
using (AxiosRegularFile file = new AxiosRegularFile(System.IO.Directory.GetCurrentDirectory() + "/axioslog.log"))
{
file.WriteData(GetLog(), System.IO.FileMode.Create);
}
}
public void writeExtendedLog()
{
using (AxiosRegularFile file = new AxiosRegularFile(System.IO.Directory.GetCurrentDirectory() + "/axioslog.log"))
{
file.WriteData(String.Join("\r\n", _extendedlog.ToArray()), System.IO.FileMode.Create);
}
}
}
}
axios/ScreenSystem/GameScreen.cs
247247
248248
249249
250
251
250252
251253
252254
/// </summary>
public virtual void Unload() { }
public virtual void ReActivate() { }
/// <summary>
/// Allows the screen to run logic, such as updating the transition position.
axios/ScreenSystem/ScreenManager.cs
225225
226226
227227
228
229
228230
229231
230232
// give it a chance to handle input.
if (!otherScreenHasFocus)
{
// The default implementation of screens aren't aware that it's
// being woke up
input.ShowCursor = screen.HasCursor;
input.EnableVirtualStick = screen.HasVirtualStick;
screen.HandleInput(gameTime, input);
axios/XNACC/CommandConsoleBase.cs
894894
895895
896896
897
897
898898
899899
900900
{
m_linesBelow = true;
}
for( int i = endLine; i > 0; i-- )
for( int i = endLine; i >= 0; i-- )
{
if( linePos.Y <= m_consoleRect.Top )
{

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.10667s using 14 queries.