Hydrogen Framework  1.3.1
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events
hDebug Class Reference

An in-game debugging system to make every developer happy. More...

+ Inheritance diagram for hDebug:

Classes

class  WatchedItem
 

Public Types

enum  DisplayLocation { DisplayLocation.Top = 1, DisplayLocation.Bottom = 2 }
 
enum  DisplayMode { DisplayMode.Off = 0, DisplayMode.Stats = 1, DisplayMode.Console = 2 }
 

Public Member Functions

void ToggleMode ()
 
void PageUp ()
 
void PageDown ()
 
void ScrollLeft ()
 
void ScrollRight ()
 

Static Public Member Functions

static bool Exists ()
 Does the Console already exist? More...
 
static void Error (object obj)
 
static void Error (string text)
 
static void Error (string text, params object[] args)
 
static void Initialize ()
 
static void Log (object obj)
 
static void Log (string text)
 
static void Log (string text, params object[] args)
 
static void Print (int x, int y, object obj)
 
static void Print (int x, int y, string text)
 
static void Print (int x, int y, string text, params object[] args)
 
static void Print (int x, int y, Color color, object obj)
 
static void Print (int x, int y, Color color, string text)
 
static void Print (int x, int y, Color color, string text, params object[] args)
 
static void Warn (object obj)
 
static void Warn (string text)
 
static void Warn (string text, params object[] args)
 
static void Watch (string key, bool value)
 
static void Watch (string key, string value)
 
static void Watch (string key, int value)
 
static void Watch (string key, float value)
 
static void UnWatch (string key)
 

Public Attributes

const int GlyphHeight = 8
 Height of a character from our fontImage. More...
 
const int GlyphWidth = 8
 Width of a character from our fontImage. More...
 
bool CheckForInput = true
 Should we monitor for input? More...
 
DisplayLocation Location = DisplayLocation.Top
 Where should the console be displayed on the screen. More...
 
DisplayMode Mode = DisplayMode.Off
 What should be displayed? Stats or Console? More...
 
KeyCode ToggleKey = KeyCode.BackQuote
 What key should be used to toggle between modes. More...
 

Static Public Attributes

static Color Shadow = Color.black
 
static bool EchoToUnityLog = true
 

Properties

static hDebug Instance [get]
 Gets the console instance, creating one if none is found. More...
 
int ConsoleHeight [get, set]
 

Detailed Description

An in-game debugging system to make every developer happy.

This component does not follow our normal component/base model.

TODO: This is getting massively reworked.

Definition at line 38 of file hDebug.cs.

Member Enumeration Documentation

Enumerator
Top 
Bottom 

Definition at line 191 of file hDebug.cs.

192  {
193  Top = 1,
194  Bottom = 2,
195  }
Enumerator
Off 
Stats 
Console 

Definition at line 197 of file hDebug.cs.

198  {
199  Off = 0,
200  Stats = 1,
201  Console = 2
202  }

Member Function Documentation

static void hDebug.Error ( object  obj)
static

Definition at line 243 of file hDebug.cs.

244  {
245  hDebug.PushLog (obj.ToString (), LogType.Error);
246  }
static void hDebug.Error ( string  text)
static

Definition at line 248 of file hDebug.cs.

249  {
250  hDebug.PushLog (text, LogType.Error);
251  }
static void hDebug.Error ( string  text,
params object[]  args 
)
static

Definition at line 253 of file hDebug.cs.

254  {
255  hDebug.PushLog (string.Format (text, args), LogType.Error);
256  }
static bool hDebug.Exists ( )
static

Does the Console already exist?

Definition at line 238 of file hDebug.cs.

239  {
240  return _staticInstance != null;
241  }
static void hDebug.Initialize ( )
static

Definition at line 258 of file hDebug.cs.

259  {
260  var foundConsole = FindObjectOfType (typeof(hDebug)) as hDebug;
261  if (foundConsole == null) {
262  var go = GameObject.Find (Hydrogen.Components.DefaultSingletonName) ??
263  new GameObject (Hydrogen.Components.DefaultSingletonName);
264  go.AddComponent<hDebug> ();
265  _staticInstance = go.GetComponent<hDebug> ();
266  }
267  }
An in-game debugging system to make every developer happy.
Definition: hDebug.cs:38
static void hDebug.Log ( object  obj)
static

Definition at line 269 of file hDebug.cs.

270  {
271  hDebug.PushLog (obj.ToString (), LogType.Log);
272  }
static void hDebug.Log ( string  text)
static

Definition at line 274 of file hDebug.cs.

275  {
276  hDebug.PushLog (text, LogType.Log);
277  }
static void hDebug.Log ( string  text,
params object[]  args 
)
static

Definition at line 279 of file hDebug.cs.

280  {
281  hDebug.PushLog (string.Format (text, args), LogType.Log);
282  }
void hDebug.PageDown ( )

Definition at line 757 of file hDebug.cs.

758  {
759  _logOffsetV -= ConsoleMaxDisplayedLines;
760  if (_logOffsetV < 0) {
761  _logOffsetV = 0;
762  }
763  }
void hDebug.PageUp ( )

Definition at line 748 of file hDebug.cs.

749  {
750  _logOffsetV += ConsoleMaxDisplayedLines;
751  int num = hDebug._logMessages.Count - ConsoleMaxDisplayedLines;
752  if (_logOffsetV > num) {
753  _logOffsetV = num;
754  }
755  }
static void hDebug.Print ( int  x,
int  y,
object  obj 
)
static

Definition at line 284 of file hDebug.cs.

285  {
286  hDebug._printedText.Add (new hDebug.PrintedText (obj.ToString (), x, y, Color.white));
287  }
static void hDebug.Print ( int  x,
int  y,
string  text 
)
static

Definition at line 289 of file hDebug.cs.

290  {
291  hDebug._printedText.Add (new hDebug.PrintedText (text, x, y, Color.white));
292  }
static void hDebug.Print ( int  x,
int  y,
string  text,
params object[]  args 
)
static

Definition at line 294 of file hDebug.cs.

295  {
296  hDebug._printedText.Add (new hDebug.PrintedText (string.Format (text, args), x, y, Color.white));
297  }
static void hDebug.Print ( int  x,
int  y,
Color  color,
object  obj 
)
static

Definition at line 299 of file hDebug.cs.

300  {
301  hDebug._printedText.Add (new hDebug.PrintedText (obj.ToString (), x, y, color));
302  }
static void hDebug.Print ( int  x,
int  y,
Color  color,
string  text 
)
static

Definition at line 304 of file hDebug.cs.

305  {
306  hDebug._printedText.Add (new hDebug.PrintedText (text, x, y, color));
307  }
static void hDebug.Print ( int  x,
int  y,
Color  color,
string  text,
params object[]  args 
)
static

Definition at line 309 of file hDebug.cs.

310  {
311  hDebug._printedText.Add (new hDebug.PrintedText (string.Format (text, args), x, y, color));
312  }
void hDebug.ScrollLeft ( )

Definition at line 765 of file hDebug.cs.

766  {
767  _logOffsetH--;
768 
769  }
void hDebug.ScrollRight ( )

Definition at line 771 of file hDebug.cs.

772  {
773  _logOffsetH++;
774  if (_logOffsetH > 0)
775  _logOffsetH = 0;
776  }
void hDebug.ToggleMode ( )

Definition at line 733 of file hDebug.cs.

734  {
735  switch (Mode) {
736  case DisplayMode.Off:
737  Mode = DisplayMode.Stats;
738  break;
739  case DisplayMode.Stats:
740  Mode = DisplayMode.Console;
741  break;
742  case DisplayMode.Console:
743  Mode = DisplayMode.Off;
744  break;
745  }
746  }
DisplayMode Mode
What should be displayed? Stats or Console?
Definition: hDebug.cs:96
static void hDebug.UnWatch ( string  key)
static

Definition at line 366 of file hDebug.cs.

367  {
368  if (_watchedItems.ContainsKey (key))
369  _watchedItems.Remove (key);
370  }
static void hDebug.Warn ( object  obj)
static

Definition at line 314 of file hDebug.cs.

315  {
316  hDebug.PushLog (obj.ToString (), LogType.Warning);
317  }
static void hDebug.Warn ( string  text)
static

Definition at line 319 of file hDebug.cs.

320  {
321  hDebug.PushLog (text, LogType.Warning);
322  }
static void hDebug.Warn ( string  text,
params object[]  args 
)
static

Definition at line 324 of file hDebug.cs.

325  {
326  hDebug.PushLog (string.Format (text, args), LogType.Warning);
327  }
static void hDebug.Watch ( string  key,
bool  value 
)
static

Definition at line 329 of file hDebug.cs.

330  {
331  if (_watchedItems.ContainsKey (key) && _watchedItems [key].Type == WatchedItem.ItemType.Boolean) {
332  _watchedItems [key].Data = value.ToString ();
333 
334  } else {
335  _watchedItems [key] = new WatchedItem (WatchedItem.ItemType.Boolean, key, value.ToString ());
336  }
337  }
static void hDebug.Watch ( string  key,
string  value 
)
static

Definition at line 339 of file hDebug.cs.

340  {
341  if (_watchedItems.ContainsKey (key) && _watchedItems [key].Type == WatchedItem.ItemType.String) {
342  _watchedItems [key].Data = value;
343  } else {
344  _watchedItems [key] = new WatchedItem (WatchedItem.ItemType.String, key, value);
345  }
346  }
static void hDebug.Watch ( string  key,
int  value 
)
static

Definition at line 348 of file hDebug.cs.

349  {
350  if (_watchedItems.ContainsKey (key) && _watchedItems [key].Type == WatchedItem.ItemType.Integer) {
351  _watchedItems [key].Data = value.ToString ();
352  } else {
353  _watchedItems [key] = new WatchedItem (WatchedItem.ItemType.Integer, key, value.ToString ());
354  }
355  }
static void hDebug.Watch ( string  key,
float  value 
)
static

Definition at line 357 of file hDebug.cs.

358  {
359  if (_watchedItems.ContainsKey (key) && _watchedItems [key].Type == WatchedItem.ItemType.Float) {
360  _watchedItems [key].Data = value.ToString ();
361  } else {
362  _watchedItems [key] = new WatchedItem (WatchedItem.ItemType.Float, key, value.ToString ());
363  }
364  }

Member Data Documentation

bool hDebug.CheckForInput = true

Should we monitor for input?

Turn this off if your binding your own keys to the input methods.

Definition at line 87 of file hDebug.cs.

bool hDebug.EchoToUnityLog = true
static

Definition at line 117 of file hDebug.cs.

const int hDebug.GlyphHeight = 8

Height of a character from our fontImage.

Definition at line 43 of file hDebug.cs.

const int hDebug.GlyphWidth = 8

Width of a character from our fontImage.

Definition at line 47 of file hDebug.cs.

DisplayLocation hDebug.Location = DisplayLocation.Top

Where should the console be displayed on the screen.

Top or Bottom?

Definition at line 92 of file hDebug.cs.

DisplayMode hDebug.Mode = DisplayMode.Off

What should be displayed? Stats or Console?

Definition at line 96 of file hDebug.cs.

Color hDebug.Shadow = Color.black
static

Definition at line 116 of file hDebug.cs.

KeyCode hDebug.ToggleKey = KeyCode.BackQuote

What key should be used to toggle between modes.

Available where Keyboard input is received.

Definition at line 101 of file hDebug.cs.

Property Documentation

int hDebug.ConsoleHeight
getset

Definition at line 230 of file hDebug.cs.

hDebug hDebug.Instance
staticget

Gets the console instance, creating one if none is found.

The Object Pool.

Definition at line 210 of file hDebug.cs.