bgfx/examples/helloworld/helloworld.cpp

41 lines
841 B
C++
Raw Normal View History

/*
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
* License: http://www.opensource.org/licenses/BSD-2-Clause
*/
#include <bgfx.h>
2012-05-06 19:45:30 -04:00
#include <bx/bx.h>
#include "../common/dbg.h"
2012-05-06 19:45:30 -04:00
void fatalCb(bgfx::Fatal::Enum _code, const char* _str)
{
2012-05-06 19:45:30 -04:00
DBG("%x: %s", _code, _str);
}
int _main_(int _argc, char** _argv)
{
bgfx::init(BX_PLATFORM_WINDOWS, fatalCb);
bgfx::reset(1280, 720);
bgfx::setDebug(BGFX_DEBUG_TEXT);
2012-05-06 19:45:30 -04:00
bgfx::setViewRect(0, 0, 0, 1280, 720);
bgfx::setViewClear(0, BGFX_CLEAR_COLOR_BIT|BGFX_CLEAR_DEPTH_BIT, 0x000000ff, 0.0f, 0);
while (true)
{
2012-05-06 19:45:30 -04:00
bgfx::submit(0);
bgfx::dbgTextClear();
2012-05-06 19:45:30 -04:00
bgfx::dbgTextPrintf(0, 1, 0x4f, "BGFX: Hello, World!");
2012-05-06 19:45:30 -04:00
bgfx::dbgTextPrintf(0, 2, 0x6f, "Initialization and debug text.");
bgfx::frame();
}
bgfx::shutdown();
return 0;
}