00_just_a_window.cpp 616 B

123456789101112131415161718192021222324252627282930313233
  1. #include <cstdio>
  2. #include <cerrno>
  3. #include "simple/graphical/initializer.h"
  4. #include "simple/graphical/software_window.h"
  5. #include "simple/graphical/algorithm/fill.h"
  6. using namespace simple::graphical;
  7. using namespace color_literals;
  8. int main() try
  9. {
  10. initializer init;
  11. software_window win("Borderless window", int2(640, 480), window::flags::borderless);
  12. fill(win.surface(), win.surface().format().color(0x7700AA_rgb));
  13. win.update();
  14. SDL_Delay(1313);
  15. return 0;
  16. }
  17. catch(...)
  18. {
  19. if(errno)
  20. std::perror("ERROR");
  21. const char* sdl_error = SDL_GetError();
  22. if(*sdl_error)
  23. std::puts(sdl_error);
  24. throw;
  25. }