mirror of
https://github.com/glfw/glfw.git
synced 2024-11-22 04:54:35 +00:00
Add decoration option to multi-window test
This commit is contained in:
parent
3b2e96e0b1
commit
9f890bb6fa
@ -34,7 +34,7 @@ add_executable(sharing WIN32 MACOSX_BUNDLE sharing.c ${GLAD})
|
|||||||
add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GETOPT} ${GLAD})
|
add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GETOPT} ${GLAD})
|
||||||
add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD})
|
add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD})
|
||||||
add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD})
|
add_executable(title WIN32 MACOSX_BUNDLE title.c ${GLAD})
|
||||||
add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GLAD})
|
add_executable(windows WIN32 MACOSX_BUNDLE windows.c ${GETOPT} ${GLAD})
|
||||||
|
|
||||||
target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}")
|
target_link_libraries(empty "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}")
|
||||||
target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}")
|
target_link_libraries(threads "${CMAKE_THREAD_LIBS_INIT}" "${RT_LIBRARY}")
|
||||||
|
@ -33,6 +33,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "getopt.h"
|
||||||
|
|
||||||
static const char* titles[] =
|
static const char* titles[] =
|
||||||
{
|
{
|
||||||
"Red",
|
"Red",
|
||||||
@ -52,6 +54,14 @@ static const struct
|
|||||||
{ 0.98f, 0.74f, 0.04f }
|
{ 0.98f, 0.74f, 0.04f }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void usage(void)
|
||||||
|
{
|
||||||
|
printf("Usage: windows [-h] [-b]\n");
|
||||||
|
printf("Options:\n");
|
||||||
|
printf(" -b create decorated windows\n");
|
||||||
|
printf(" -h show this help\n");
|
||||||
|
}
|
||||||
|
|
||||||
static void error_callback(int error, const char* description)
|
static void error_callback(int error, const char* description)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: %s\n", description);
|
fprintf(stderr, "Error: %s\n", description);
|
||||||
@ -80,16 +90,33 @@ static void key_callback(GLFWwindow* window, int key, int scancode, int action,
|
|||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i, ch;
|
||||||
|
int decorated = GLFW_FALSE;
|
||||||
int running = GLFW_TRUE;
|
int running = GLFW_TRUE;
|
||||||
GLFWwindow* windows[4];
|
GLFWwindow* windows[4];
|
||||||
|
|
||||||
|
while ((ch = getopt(argc, argv, "bh")) != -1)
|
||||||
|
{
|
||||||
|
switch (ch)
|
||||||
|
{
|
||||||
|
case 'b':
|
||||||
|
decorated = GLFW_TRUE;
|
||||||
|
break;
|
||||||
|
case 'h':
|
||||||
|
usage();
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
default:
|
||||||
|
usage();
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glfwSetErrorCallback(error_callback);
|
glfwSetErrorCallback(error_callback);
|
||||||
|
|
||||||
if (!glfwInit())
|
if (!glfwInit())
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
||||||
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
|
glfwWindowHint(GLFW_DECORATED, decorated);
|
||||||
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
glfwWindowHint(GLFW_VISIBLE, GLFW_FALSE);
|
||||||
|
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
|
Loading…
Reference in New Issue
Block a user