mirror of
https://github.com/glfw/glfw.git
synced 2024-11-25 03:25:10 +00:00
Remove window opacity test
It has been superceded by the window property test.
This commit is contained in:
parent
3207fc7120
commit
686e18fd72
@ -34,7 +34,6 @@ add_executable(gamma WIN32 MACOSX_BUNDLE gamma.c ${GLAD_GL})
|
||||
add_executable(icon WIN32 MACOSX_BUNDLE icon.c ${GLAD_GL})
|
||||
add_executable(inputlag WIN32 MACOSX_BUNDLE inputlag.c ${GETOPT} ${GLAD_GL})
|
||||
add_executable(joysticks WIN32 MACOSX_BUNDLE joysticks.c ${GLAD_GL})
|
||||
add_executable(opacity WIN32 MACOSX_BUNDLE opacity.c ${GLAD_GL})
|
||||
add_executable(tearing WIN32 MACOSX_BUNDLE tearing.c ${GLAD_GL})
|
||||
add_executable(threads WIN32 MACOSX_BUNDLE threads.c ${TINYCTHREAD} ${GLAD_GL})
|
||||
add_executable(timeout WIN32 MACOSX_BUNDLE timeout.c ${GLAD_GL})
|
||||
@ -50,8 +49,8 @@ if (RT_LIBRARY)
|
||||
target_link_libraries(threads "${RT_LIBRARY}")
|
||||
endif()
|
||||
|
||||
set(GUI_ONLY_BINARIES empty gamma icon inputlag joysticks opacity tearing
|
||||
threads timeout title triangle-vulkan window windows)
|
||||
set(GUI_ONLY_BINARIES empty gamma icon inputlag joysticks tearing threads
|
||||
timeout title triangle-vulkan window windows)
|
||||
set(CONSOLE_BINARIES clipboard events msaa glfwinfo iconify monitors reopen
|
||||
cursor)
|
||||
|
||||
@ -70,7 +69,6 @@ if (APPLE)
|
||||
set_target_properties(gamma PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Gamma")
|
||||
set_target_properties(inputlag PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Input Lag")
|
||||
set_target_properties(joysticks PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Joysticks")
|
||||
set_target_properties(opacity PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Opacity")
|
||||
set_target_properties(tearing PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Tearing")
|
||||
set_target_properties(threads PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Threads")
|
||||
set_target_properties(timeout PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME "Timeout")
|
||||
|
109
tests/opacity.c
109
tests/opacity.c
@ -1,109 +0,0 @@
|
||||
//========================================================================
|
||||
// Window opacity test program
|
||||
// Copyright (c) Camilla Löwy <elmindreda@glfw.org>
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied
|
||||
// warranty. In no event will the authors be held liable for any damages
|
||||
// arising from the use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented; you must not
|
||||
// claim that you wrote the original software. If you use this software
|
||||
// in a product, an acknowledgment in the product documentation would
|
||||
// be appreciated but is not required.
|
||||
//
|
||||
// 2. Altered source versions must be plainly marked as such, and must not
|
||||
// be misrepresented as being the original software.
|
||||
//
|
||||
// 3. This notice may not be removed or altered from any source
|
||||
// distribution.
|
||||
//
|
||||
//========================================================================
|
||||
|
||||
#include <glad/gl.h>
|
||||
#define GLFW_INCLUDE_NONE
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#define NK_IMPLEMENTATION
|
||||
#define NK_INCLUDE_FIXED_TYPES
|
||||
#define NK_INCLUDE_FONT_BAKING
|
||||
#define NK_INCLUDE_DEFAULT_FONT
|
||||
#define NK_INCLUDE_DEFAULT_ALLOCATOR
|
||||
#define NK_INCLUDE_VERTEX_BUFFER_OUTPUT
|
||||
#define NK_INCLUDE_STANDARD_VARARGS
|
||||
#include <nuklear.h>
|
||||
|
||||
#define NK_GLFW_GL2_IMPLEMENTATION
|
||||
#include <nuklear_glfw_gl2.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static void error_callback(int error, const char* description)
|
||||
{
|
||||
fprintf(stderr, "Error: %s\n", description);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
GLFWwindow* window;
|
||||
struct nk_context* nk;
|
||||
struct nk_font_atlas* atlas;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE);
|
||||
glfwWindowHint(GLFW_WIN32_KEYBOARD_MENU, GLFW_TRUE);
|
||||
|
||||
window = glfwCreateWindow(400, 400, "Opacity", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGL(glfwGetProcAddress);
|
||||
glfwSwapInterval(1);
|
||||
|
||||
nk = nk_glfw3_init(window, NK_GLFW3_INSTALL_CALLBACKS);
|
||||
nk_glfw3_font_stash_begin(&atlas);
|
||||
nk_glfw3_font_stash_end();
|
||||
|
||||
while (!glfwWindowShouldClose(window))
|
||||
{
|
||||
int width, height;
|
||||
struct nk_rect area;
|
||||
|
||||
glfwGetWindowSize(window, &width, &height);
|
||||
area = nk_rect(0.f, 0.f, (float) width, (float) height);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
nk_glfw3_new_frame();
|
||||
if (nk_begin(nk, "", area, 0))
|
||||
{
|
||||
float opacity = glfwGetWindowOpacity(window);
|
||||
nk_layout_row_dynamic(nk, 30, 2);
|
||||
if (nk_slider_float(nk, 0.f, &opacity, 1.f, 0.001f))
|
||||
glfwSetWindowOpacity(window, opacity);
|
||||
nk_labelf(nk, NK_TEXT_LEFT, "%0.3f", opacity);
|
||||
}
|
||||
|
||||
nk_end(nk);
|
||||
nk_glfw3_render(NK_ANTI_ALIASING_ON);
|
||||
|
||||
glfwSwapBuffers(window);
|
||||
glfwWaitEventsTimeout(1.0);
|
||||
}
|
||||
|
||||
nk_glfw3_shutdown();
|
||||
glfwTerminate();
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user