title.c
Go to the documentation of this file.
1 //========================================================================
2 // UTF-8 window title test
3 // Copyright (c) Camilla Löwy <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 
30 #include <glad/glad.h>
31 #include <GLFW/glfw3.h>
32 
33 #include <stdio.h>
34 #include <stdlib.h>
35 
36 static void error_callback(int error, const char* description)
37 {
38  fprintf(stderr, "Error: %s\n", description);
39 }
40 
41 int main(void)
42 {
44 
46 
47  if (!glfwInit())
48  exit(EXIT_FAILURE);
49 
50  window = glfwCreateWindow(400, 400, "English 日本語 русский язык 官話", NULL, NULL);
51  if (!window)
52  {
53  glfwTerminate();
54  exit(EXIT_FAILURE);
55  }
56 
57  glfwMakeContextCurrent(window);
60 
61  while (!glfwWindowShouldClose(window))
62  {
64  glfwSwapBuffers(window);
66  }
67 
68  glfwTerminate();
69  exit(EXIT_SUCCESS);
70 }
71 
The header of the GLFW 3 API.
GLFWAPI GLFWglproc glfwGetProcAddress(const char *procname)
Returns the address of the specified function for the current context.
Definition: context.c:741
void *(* GLADloadproc)(const char *name)
static GLFWwindow * window
Definition: joysticks.c:55
GLFWAPI GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun cbfun)
Sets the error callback.
Definition: init.c:309
GLFWAPI int glfwInit(void)
Initializes the GLFW library.
Definition: init.c:198
#define GL_COLOR_BUFFER_BIT
GLFWAPI void glfwSwapInterval(int interval)
Sets the swap interval for the current context.
Definition: context.c:658
#define glClear
GLFWAPI void glfwSwapBuffers(GLFWwindow *window)
Swaps the front and back buffers of the specified window.
Definition: context.c:641
GLFWAPI void glfwMakeContextCurrent(GLFWwindow *window)
Makes the context of the specified window current for the calling thread.
Definition: context.c:611
static void error_callback(int error, const char *description)
Definition: title.c:36
GLAPI int gladLoadGLLoader(GLADloadproc)
Definition: glad/glad.c:1697
static const textual_icon exit
Definition: model-views.h:254
GLFWAPI void glfwWaitEvents(void)
Waits until events are queued and processes them.
Definition: window.c:1078
GLFWAPI GLFWwindow * glfwCreateWindow(int width, int height, const char *title, GLFWmonitor *monitor, GLFWwindow *share)
Creates a window and its associated context.
Definition: window.c:151
int main(void)
Definition: title.c:41
GLFWAPI void glfwTerminate(void)
Terminates the GLFW library.
Definition: init.c:243
#define NULL
Definition: tinycthread.c:47
struct GLFWwindow GLFWwindow
GLFWAPI int glfwWindowShouldClose(GLFWwindow *window)
Checks the close flag of the specified window.
Definition: window.c:477


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:50:12