title.c 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. //========================================================================
  2. // UTF-8 window title test
  3. // Copyright (c) Camilla Löwy <[email protected]>
  4. //
  5. // This software is provided 'as-is', without any express or implied
  6. // warranty. In no event will the authors be held liable for any damages
  7. // arising from the use of this software.
  8. //
  9. // Permission is granted to anyone to use this software for any purpose,
  10. // including commercial applications, and to alter it and redistribute it
  11. // freely, subject to the following restrictions:
  12. //
  13. // 1. The origin of this software must not be misrepresented; you must not
  14. // claim that you wrote the original software. If you use this software
  15. // in a product, an acknowledgment in the product documentation would
  16. // be appreciated but is not required.
  17. //
  18. // 2. Altered source versions must be plainly marked as such, and must not
  19. // be misrepresented as being the original software.
  20. //
  21. // 3. This notice may not be removed or altered from any source
  22. // distribution.
  23. //
  24. //========================================================================
  25. //
  26. // This test sets a UTF-8 window title
  27. //
  28. //========================================================================
  29. #define GLAD_GL_IMPLEMENTATION
  30. #include <glad/gl.h>
  31. #define GLFW_INCLUDE_NONE
  32. #include <GLFW/glfw3.h>
  33. #include <stdio.h>
  34. #include <stdlib.h>
  35. static void error_callback(int error, const char* description)
  36. {
  37. fprintf(stderr, "Error: %s\n", description);
  38. }
  39. int main(void)
  40. {
  41. GLFWwindow* window;
  42. glfwSetErrorCallback(error_callback);
  43. if (!glfwInit())
  44. exit(EXIT_FAILURE);
  45. window = glfwCreateWindow(400, 400, "English 日本語 русский язык 官話", NULL, NULL);
  46. if (!window)
  47. {
  48. glfwTerminate();
  49. exit(EXIT_FAILURE);
  50. }
  51. glfwMakeContextCurrent(window);
  52. gladLoadGL(glfwGetProcAddress);
  53. glfwSwapInterval(1);
  54. while (!glfwWindowShouldClose(window))
  55. {
  56. glClear(GL_COLOR_BUFFER_BIT);
  57. glfwSwapBuffers(window);
  58. glfwWaitEvents();
  59. }
  60. glfwTerminate();
  61. exit(EXIT_SUCCESS);
  62. }