GL: debug fix

This commit is contained in:
Erik Persson 2013-11-26 11:32:00 +01:00
parent d87e643777
commit 97e92f8516
3 changed files with 38 additions and 1 deletions

View File

@ -1,9 +1,13 @@
#include "DynamicObject.h" #include "DynamicObject.h"
using namespace GameLogic; using namespace GameLogic;
using namespace Oyster::Physics;
using namespace Utility::DynamicMemory;
DynamicObject::DynamicObject(void) DynamicObject::DynamicObject(void)
{ {
rigidBody = API::Instance().CreateSimpleRigidBody();
API::Instance().AddObject(rigidBody);
} }

View File

@ -6,6 +6,7 @@
namespace GameLogic namespace GameLogic
{ {
class DynamicObject : public Object class DynamicObject : public Object
{ {

View File

@ -10,6 +10,10 @@
#include "Core/Core.h" #include "Core/Core.h"
#include "Render\Preparations\Preparations.h" #include "Render\Preparations\Preparations.h"
#include "IGame.h" #include "IGame.h"
#include <stdio.h>
#include <fcntl.h>
#include <io.h>
//#include "InputController.h" //#include "InputController.h"
@ -40,6 +44,34 @@ HRESULT CleanUp();
// Entry point to the program. Initializes everything and goes into a message processing // Entry point to the program. Initializes everything and goes into a message processing
// loop. Idle time is used to render the scene. // loop. Idle time is used to render the scene.
//-------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------
void SetStdOutToNewConsole()
{
// allocate a console for this app
AllocConsole();
// redirect unbuffered STDOUT to the console
HANDLE consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
int fileDescriptor = _open_osfhandle((intptr_t)consoleHandle, _O_TEXT);
FILE *fp = _fdopen( fileDescriptor, "w" );
*stdout = *fp;
setvbuf( stdout, NULL, _IONBF, 0 );
// give the console window a nicer title
SetConsoleTitle(L"Debug Output");
// give the console window a bigger buffer size
CONSOLE_SCREEN_BUFFER_INFO csbi;
if ( GetConsoleScreenBufferInfo(consoleHandle, &csbi) )
{
COORD bufferSize;
bufferSize.X = csbi.dwSize.X;
bufferSize.Y = 50;
SetConsoleScreenBufferSize(consoleHandle, bufferSize);
}
}
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
{ {
if( FAILED( InitWindow( hInstance, nCmdShow ) ) ) if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
@ -57,7 +89,7 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdL
__int64 prevTimeStamp = 0; __int64 prevTimeStamp = 0;
QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp); QueryPerformanceCounter((LARGE_INTEGER*)&prevTimeStamp);
SetStdOutToNewConsole();
// Main message loop // Main message loop
MSG msg = {0}; MSG msg = {0};
while(WM_QUIT != msg.message) while(WM_QUIT != msg.message)