Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / A Tier 2 class for outputting debug info to consoles

Author
Message
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 4th Jun 2013 20:04 Edited at: 6th Jun 2013 05:08
EDIT: Code and example updated!

Because trying to work with a log file became annoying, I created a class that can be used to output directly to the debug console.

It is a standalone class. And I've tested in Mac, iOS, Android and Windows.

Proper usage is to call the init_console method in app::Begin and the close_console in app::End. The send_to_console method can be called anywhere.

Header file (btw, I am Triassic Associates, Inc.):


Code file:


Usage example, header file:


Usage example, code file:


Note that the functions mentioned in the sample code are fictitious unless they appear in the sample code displayed. The names are meant to suggest what they do.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 5th Jun 2013 06:40
Here's one that overrides stdout/stderr/stdin and sends it to a console that you control:

console.h


console.cpp


OgreSingleton.h(with some parts removed that aren't relevant to the singleton implementation)


This code allows you to use the traditional C++ std::cout and std::cin classes. It goes without saying that this code only works in Windows and Tier 2.

WTLD has been put on indefinite hold.
A new project is under initial development now.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Jun 2013 16:55
Dar13, if permissible, I may adopt your Windows console into my class. It would be very useful.

Quote: "class Console : public Ogre::Singleton<Console>"

What/where is the Ogre class?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
AgentSam
12
Years of Service
User Offline
Joined: 14th Mar 2012
Location: Virtual Space
Posted: 5th Jun 2013 17:35
It's over here:

http://www.ogre3d.org/

Cheers,
AgentSam
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Jun 2013 19:37
Yup, I found it.

But, not wanting to include a whole other sdk, I have been experimenting with the clues shown in your example and now have my class creating a simple console window that gets the output. I am putting the finishing touches on it and then I'll repost the code.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 5th Jun 2013 20:30
I just updated the initial post to show the new code.

This code now handles creating a seperate console for output for the Windows version.

When the app is in 'error' mode because it is ending, pressing with the mouse pointer in the main screen will force it to actually exit. Until then, you can view any messages displayed in the debug console.

In my actual project, because I clear out all images, sprites and sounds before the call to closeThisApp() when the player presses Exit, I end up with a white screen in the main display.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Dar13
15
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 6th Jun 2013 00:40
Ogre::Singleton<T> is defined within the OgreSingleton.h code snippet I originally posted(the third one). And you're more than welcome to include my code into yours or vice versa.

WTLD has been put on indefinite hold.
A new project is under initial development now.

Login to post a reply

Server time is: 2024-05-03 00:15:34
Your offset time is: 2024-05-03 00:15:34