Platformer in OpenGL
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

78 wiersze
2.2 KiB

5 lat temu
  1. //========================================================================
  2. // UTF-8 window title test
  3. // Copyright (c) Camilla Berglund <elmindreda@glfw.org>
  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. #include <glad/glad.h>
  30. #include <GLFW/glfw3.h>
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33. static void error_callback(int error, const char* description)
  34. {
  35. fprintf(stderr, "Error: %s\n", description);
  36. }
  37. static void framebuffer_size_callback(GLFWwindow* window, int width, int height)
  38. {
  39. glViewport(0, 0, width, height);
  40. }
  41. int main(void)
  42. {
  43. GLFWwindow* window;
  44. glfwSetErrorCallback(error_callback);
  45. if (!glfwInit())
  46. exit(EXIT_FAILURE);
  47. window = glfwCreateWindow(400, 400, "English 日本語 русский язык 官話", NULL, NULL);
  48. if (!window)
  49. {
  50. glfwTerminate();
  51. exit(EXIT_FAILURE);
  52. }
  53. glfwMakeContextCurrent(window);
  54. gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
  55. glfwSwapInterval(1);
  56. glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
  57. while (!glfwWindowShouldClose(window))
  58. {
  59. glClear(GL_COLOR_BUFFER_BIT);
  60. glfwSwapBuffers(window);
  61. glfwWaitEvents();
  62. }
  63. glfwTerminate();
  64. exit(EXIT_SUCCESS);
  65. }