helloworld.cpp 1.2 KB

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