helloworld.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright 2011-2012 Branimir Karadzic. All rights reserved.
  3. * License: http://www.opensource.org/licenses/BSD-2-Clause
  4. */
  5. #include <bgfx.h>
  6. #include <bx/bx.h>
  7. #include "../common/dbg.h"
  8. int _main_(int _argc, char** _argv)
  9. {
  10. bgfx::init();
  11. bgfx::reset(1280, 720);
  12. // Enable debug text.
  13. bgfx::setDebug(BGFX_DEBUG_TEXT);
  14. // Set view 0 default viewport.
  15. bgfx::setViewRect(0, 0, 0, 1280, 720);
  16. // Set view 0 clear state.
  17. bgfx::setViewClear(0
  18. , BGFX_CLEAR_COLOR_BIT|BGFX_CLEAR_DEPTH_BIT
  19. , 0x303030ff
  20. , 1.0f
  21. , 0
  22. );
  23. while (true)
  24. {
  25. // This dummy draw call is here to make sure that view 0 is cleared
  26. // if no other draw calls are submitted to view 0.
  27. bgfx::submit(0);
  28. // Use debug font to print information about this example.
  29. bgfx::dbgTextClear();
  30. bgfx::dbgTextPrintf(0, 1, 0x4f, "bgfx/examples/00-helloworld");
  31. bgfx::dbgTextPrintf(0, 2, 0x6f, "Description: Initialization and debug text.");
  32. // Advance to next frame. Rendering thread will be kicked to
  33. // process submitted rendering primitives.
  34. bgfx::frame();
  35. }
  36. // Shutdown bgfx.
  37. bgfx::shutdown();
  38. return 0;
  39. }