mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-12-01 11:56:58 -05:00
54 lines
1.2 KiB
C++
54 lines
1.2 KiB
C++
/*
|
|
* Copyright 2011-2012 Branimir Karadzic. All rights reserved.
|
|
* License: http://www.opensource.org/licenses/BSD-2-Clause
|
|
*/
|
|
|
|
#include <bgfx.h>
|
|
#include <bx/bx.h>
|
|
#include "../common/dbg.h"
|
|
|
|
void fatalCb(bgfx::Fatal::Enum _code, const char* _str)
|
|
{
|
|
DBG("%x: %s", _code, _str);
|
|
}
|
|
|
|
int _main_(int _argc, char** _argv)
|
|
{
|
|
bgfx::init(fatalCb);
|
|
bgfx::reset(1280, 720);
|
|
|
|
// Enable debug text.
|
|
bgfx::setDebug(BGFX_DEBUG_TEXT);
|
|
|
|
// Set view 0 default viewport.
|
|
bgfx::setViewRect(0, 0, 0, 1280, 720);
|
|
|
|
// Set view 0 clear state.
|
|
bgfx::setViewClear(0
|
|
, BGFX_CLEAR_COLOR_BIT|BGFX_CLEAR_DEPTH_BIT
|
|
, 0x303030ff
|
|
, 1.0f
|
|
, 0
|
|
);
|
|
|
|
while (true)
|
|
{
|
|
// This dummy draw call is here to make sure that view 0 is cleared
|
|
// if no other draw calls are submitted to view 0.
|
|
bgfx::submit(0);
|
|
|
|
// Use debug font to print information about this example.
|
|
bgfx::dbgTextClear();
|
|
bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/00-helloworld");
|
|
bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Initialization and debug text.");
|
|
|
|
// Advance to next frame. Rendering thread will be kicked to
|
|
// process submitted rendering primitives.
|
|
bgfx::frame();
|
|
}
|
|
|
|
// Shutdown bgfx.
|
|
bgfx::shutdown();
|
|
|
|
return 0;
|
|
}
|