mirror of
https://github.com/glfw/glfw.git
synced 2024-11-21 20:44:35 +00:00
Remove trailing whitespace
This commit is contained in:
parent
ce4672d74b
commit
c3cba58a71
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -1 +1 @@
|
||||
*.m linguist-language=Objective-C
|
||||
*.m linguist-language=Objective-C
|
||||
|
@ -6,7 +6,7 @@ SET(CMAKE_CXX_COMPILER "amd64-mingw32msvc-g++")
|
||||
SET(CMAKE_RC_COMPILER "amd64-mingw32msvc-windres")
|
||||
SET(CMAKE_RANLIB "amd64-mingw32msvc-ranlib")
|
||||
|
||||
# Configure the behaviour of the find commands
|
||||
# Configure the behaviour of the find commands
|
||||
SET(CMAKE_FIND_ROOT_PATH "/usr/amd64-mingw32msvc")
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
|
@ -6,7 +6,7 @@ SET(CMAKE_CXX_COMPILER "i586-mingw32msvc-g++")
|
||||
SET(CMAKE_RC_COMPILER "i586-mingw32msvc-windres")
|
||||
SET(CMAKE_RANLIB "i586-mingw32msvc-ranlib")
|
||||
|
||||
# Configure the behaviour of the find commands
|
||||
# Configure the behaviour of the find commands
|
||||
SET(CMAKE_FIND_ROOT_PATH "/usr/i586-mingw32msvc")
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
|
@ -6,7 +6,7 @@ SET(CMAKE_CXX_COMPILER "i686-pc-mingw32-g++")
|
||||
SET(CMAKE_RC_COMPILER "i686-pc-mingw32-windres")
|
||||
SET(CMAKE_RANLIB "i686-pc-mingw32-ranlib")
|
||||
|
||||
#Configure the behaviour of the find commands
|
||||
#Configure the behaviour of the find commands
|
||||
SET(CMAKE_FIND_ROOT_PATH "/opt/mingw/usr/i686-pc-mingw32")
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
|
@ -6,7 +6,7 @@ SET(CMAKE_CXX_COMPILER "i686-w64-mingw32-g++")
|
||||
SET(CMAKE_RC_COMPILER "i686-w64-mingw32-windres")
|
||||
SET(CMAKE_RANLIB "i686-w64-mingw32-ranlib")
|
||||
|
||||
# Configure the behaviour of the find commands
|
||||
# Configure the behaviour of the find commands
|
||||
SET(CMAKE_FIND_ROOT_PATH "/usr/i686-w64-mingw32")
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
|
@ -6,7 +6,7 @@ SET(CMAKE_CXX_COMPILER "x86_64-w64-mingw32-g++")
|
||||
SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres")
|
||||
SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib")
|
||||
|
||||
# Configure the behaviour of the find commands
|
||||
# Configure the behaviour of the find commands
|
||||
SET(CMAKE_FIND_ROOT_PATH "/usr/x86_64-w64-mingw32")
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
|
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2002-2006 Marcus Geelnard
|
||||
Copyright (c) 2002-2006 Marcus Geelnard
|
||||
Copyright (c) 2006-2016 Camilla Löwy <elmindreda@glfw.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
|
@ -12,7 +12,7 @@ creating windows, contexts and surfaces, reading input, handling events, etc.
|
||||
|
||||
GLFW natively supports Windows, macOS and Linux and other Unix-like systems.
|
||||
Experimental implementations for the Wayland protocol and the Mir display server
|
||||
are available but not yet officially supported.
|
||||
are available but not yet officially supported.
|
||||
|
||||
GLFW is licensed under the [zlib/libpng
|
||||
license](http://www.glfw.org/license.html).
|
||||
|
@ -27,7 +27,7 @@ foreach(arg ${glfw_DOCS_SOURCES})
|
||||
endforeach()
|
||||
|
||||
configure_file(Doxyfile.in Doxyfile @ONLY)
|
||||
|
||||
|
||||
add_custom_target(docs ALL "${DOXYGEN_EXECUTABLE}"
|
||||
WORKING_DIRECTORY "${GLFW_BINARY_DIR}/docs"
|
||||
COMMENT "Generating HTML documentation" VERBATIM)
|
||||
|
@ -11,7 +11,7 @@
|
||||
</tab>
|
||||
<tab type="classes" visible="no" title="">
|
||||
<tab type="classlist" visible="yes" title="" intro=""/>
|
||||
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||
<tab type="hierarchy" visible="yes" title="" intro=""/>
|
||||
<tab type="classmembers" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
@ -19,7 +19,7 @@
|
||||
<tab type="filelist" visible="yes" title="" intro=""/>
|
||||
<tab type="globals" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="examples" visible="yes" title="" intro=""/>
|
||||
<tab type="examples" visible="yes" title="" intro=""/>
|
||||
</navindex>
|
||||
|
||||
<!-- Layout definition for a class page -->
|
||||
|
@ -78,7 +78,7 @@ fallback path is used.
|
||||
|
||||
GLFW uses the XInput2 extension to provide raw, non-accelerated mouse motion
|
||||
when the cursor is disabled. If the running X server does not support this
|
||||
extension, regular accelerated mouse motion will be used.
|
||||
extension, regular accelerated mouse motion will be used.
|
||||
|
||||
GLFW uses both the XRender extension and the compositing manager to support
|
||||
transparent window framebuffers. If the running X server does not support this
|
||||
|
@ -161,7 +161,7 @@ An extension loader library is the easiest and best way to access both OpenGL an
|
||||
OpenGL ES extensions and modern versions of the core OpenGL or OpenGL ES APIs.
|
||||
They will take care of all the details of declaring and loading everything you
|
||||
need. One such library is [glad](https://github.com/Dav1dde/glad) and there are
|
||||
several others.
|
||||
several others.
|
||||
|
||||
The following example will use glad but all extension loader libraries work
|
||||
similarly.
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*!
|
||||
|
||||
@page input_guide Input guide
|
||||
|
||||
|
||||
@tableofcontents
|
||||
|
||||
This guide introduces the input related functions of GLFW. For details on
|
||||
@ -602,7 +602,7 @@ See the reference documentation for @ref glfwGetJoystickButtons for details.
|
||||
|
||||
The human-readable, UTF-8 encoded name of a joystick is returned by @ref
|
||||
glfwGetJoystickName. See the reference documentation for the lifetime of the
|
||||
returned string.
|
||||
returned string.
|
||||
|
||||
@code
|
||||
const char* name = glfwGetJoystickName(GLFW_JOYSTICK_4);
|
||||
|
@ -111,6 +111,6 @@ which is generated from the `glfw_config.h.in` file by CMake.
|
||||
Configuration macros the same style as tokens in the public interface, except
|
||||
with a leading underscore.
|
||||
|
||||
Examples: `_GLFW_USE_HYBRID_HPG`
|
||||
Examples: `_GLFW_USE_HYBRID_HPG`
|
||||
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*!
|
||||
/*!
|
||||
|
||||
@page intro_guide Introduction to the API
|
||||
|
||||
|
||||
@tableofcontents
|
||||
|
||||
This guide introduces the basic concepts of GLFW and describes initialization,
|
||||
@ -140,7 +140,7 @@ any other resources allocated by GLFW.
|
||||
Once the library is terminated, it is as if it had never been initialized and
|
||||
you will need to initialize it again before being able to use GLFW. If the
|
||||
library was not initialized or had already been terminated, it return
|
||||
immediately.
|
||||
immediately.
|
||||
|
||||
|
||||
@section error_handling Error handling
|
||||
@ -307,7 +307,7 @@ calls main), but some may be called from any thread once the library has been
|
||||
initialized. Before initialization the whole library is thread-unsafe.
|
||||
|
||||
The reference documentation for every GLFW function states whether it is limited
|
||||
to the main thread.
|
||||
to the main thread.
|
||||
|
||||
Initialization, termination, event processing and the creation and
|
||||
destruction of windows, cursors and OpenGL and OpenGL ES contexts are all
|
||||
|
@ -157,7 +157,7 @@ any UI elements.
|
||||
|
||||
The content scale may depend on both the monitor resolution and pixel density
|
||||
and on user settings. It may be very different from the raw DPI calculated from
|
||||
the physical size and current resolution.
|
||||
the physical size and current resolution.
|
||||
|
||||
|
||||
@subsection monitor_pos Virtual position
|
||||
|
@ -40,7 +40,7 @@ time away from the focus of GLFW (i.e. context, input and window). There are
|
||||
better threading libraries available and native threading support is available
|
||||
in both [C++11](http://en.cppreference.com/w/cpp/thread) and
|
||||
[C11](http://en.cppreference.com/w/c/thread), both of which are gaining
|
||||
traction.
|
||||
traction.
|
||||
|
||||
If you wish to use the C++11 or C11 facilities but your compiler doesn't yet
|
||||
support them, see the
|
||||
@ -73,7 +73,7 @@ To become of sufficiently high quality to warrant keeping them in GLFW 3, they
|
||||
would need not only to support other formats, but also modern extensions to
|
||||
OpenGL texturing. This would either add a number of external
|
||||
dependencies (libjpeg, libpng, etc.), or force GLFW to ship with inline versions
|
||||
of these libraries.
|
||||
of these libraries.
|
||||
|
||||
As there already are libraries doing this, it is unnecessary both to duplicate
|
||||
the work and to tie the duplicate to GLFW. The resulting library would also be
|
||||
@ -92,7 +92,7 @@ has been removed. GLFW is written in C, not Pascal. Removing this macro means
|
||||
there's one less thing for application programmers to remember, i.e. the
|
||||
requirement to mark all callback functions with `GLFWCALL`. It also simplifies
|
||||
the creation of DLLs and DLL link libraries, as there's no need to explicitly
|
||||
disable `@n` entry point suffixes.
|
||||
disable `@n` entry point suffixes.
|
||||
|
||||
@par Old syntax
|
||||
@code
|
||||
|
@ -174,7 +174,7 @@ If you are using an [extension loader library](@ref context_glext_auto) to
|
||||
access modern OpenGL then this is when to initialize it, as the loader needs
|
||||
a current context to load from. This example uses
|
||||
[glad](https://github.com/Dav1dde/glad), but the same rule applies to all such
|
||||
libraries.
|
||||
libraries.
|
||||
|
||||
@code
|
||||
gladLoadGLLoader((GLADloadproc) glfwGetProcAddress);
|
||||
@ -309,7 +309,7 @@ done each frame after buffer swapping.
|
||||
|
||||
There are two methods for processing pending events; polling and waiting. This
|
||||
example will use event polling, which processes only those events that have
|
||||
already been received and then returns immediately.
|
||||
already been received and then returns immediately.
|
||||
|
||||
@code
|
||||
glfwPollEvents();
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*!
|
||||
|
||||
@page vulkan_guide Vulkan guide
|
||||
|
||||
|
||||
@tableofcontents
|
||||
|
||||
This guide is intended to fill the gaps between the [Vulkan
|
||||
@ -180,7 +180,7 @@ ici.ppEnabledExtensionNames = extensions;
|
||||
Additional extensions may be required by future versions of GLFW. You should
|
||||
check whether any extensions you wish to enable are already in the returned
|
||||
array, as it is an error to specify an extension more than once in the
|
||||
`VkInstanceCreateInfo` struct.
|
||||
`VkInstanceCreateInfo` struct.
|
||||
|
||||
|
||||
@section vulkan_present Querying for Vulkan presentation support
|
||||
@ -197,7 +197,7 @@ if (glfwGetPhysicalDevicePresentationSupport(instance, physical_device, queue_fa
|
||||
}
|
||||
@endcode
|
||||
|
||||
The `VK_KHR_surface` extension additionally provides the
|
||||
The `VK_KHR_surface` extension additionally provides the
|
||||
`vkGetPhysicalDeviceSurfaceSupportKHR` function, which performs the same test on
|
||||
an existing Vulkan surface.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*!
|
||||
|
||||
@page window_guide Window guide
|
||||
|
||||
|
||||
@tableofcontents
|
||||
|
||||
This guide introduces the window related functions of GLFW. For details on
|
||||
@ -48,7 +48,7 @@ the event.
|
||||
|
||||
To create a full screen window, you need to specify which monitor the window
|
||||
should use. In most cases, the user's primary monitor is a good choice.
|
||||
For more information about retrieving monitors, see @ref monitor_monitors.
|
||||
For more information about retrieving monitors, see @ref monitor_monitors.
|
||||
|
||||
@code
|
||||
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", glfwGetPrimaryMonitor(), NULL);
|
||||
|
@ -1,3 +1,3 @@
|
||||
|
||||
GLFW_ICON ICON "glfw.ico"
|
||||
|
||||
|
||||
GLFW_ICON ICON "glfw.ico"
|
||||
|
||||
|
@ -1067,7 +1067,7 @@ extern "C" {
|
||||
* @sa @ref glfwGetProcAddress
|
||||
*
|
||||
* @since Added in version 3.0.
|
||||
|
||||
*
|
||||
* @ingroup context
|
||||
*/
|
||||
typedef void (*GLFWglproc)(void);
|
||||
@ -1654,7 +1654,7 @@ GLFWAPI void glfwTerminate(void);
|
||||
*
|
||||
* Some hints are platform specific. These may be set on any platform but they
|
||||
* will only affect their specific platform. Other platforms will ignore them.
|
||||
* Setting these hints requires no platform specific headers or functions.
|
||||
* Setting these hints requires no platform specific headers or functions.
|
||||
*
|
||||
* @param[in] hint The [init hint](@ref init_hints) to set.
|
||||
* @param[in] value The new value of the init hint.
|
||||
@ -1688,7 +1688,7 @@ GLFWAPI void glfwInitHint(int hint, int value);
|
||||
*
|
||||
* Some hints are platform specific. These may be set on any platform but they
|
||||
* will only affect their specific platform. Other platforms will ignore them.
|
||||
* Setting these hints requires no platform specific headers or functions.
|
||||
* Setting these hints requires no platform specific headers or functions.
|
||||
*
|
||||
* @param[in] hint The [init hint](@ref init_hints) to set.
|
||||
* @param[in] value The new value of the init hint.
|
||||
@ -3226,7 +3226,7 @@ GLFWAPI int glfwGetWindowAttrib(GLFWwindow* window, int attrib);
|
||||
* The supported attributes are [GLFW_DECORATED](@ref GLFW_DECORATED_attrib),
|
||||
* [GLFW_RESIZABLE](@ref GLFW_RESIZABLE_attrib),
|
||||
* [GLFW_FLOATING](@ref GLFW_FLOATING_attrib) and
|
||||
* [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib).
|
||||
* [GLFW_AUTO_ICONIFY](@ref GLFW_AUTO_ICONIFY_attrib).
|
||||
*
|
||||
* Some of these attributes are ignored for full screen windows. The new
|
||||
* value will take effect if the window is later made windowed.
|
||||
@ -4476,10 +4476,10 @@ GLFWAPI const unsigned char* glfwGetJoystickButtons(int jid, int* count);
|
||||
* it with the corresponding direction.
|
||||
*
|
||||
* @code
|
||||
* if (hats[2] & GLFW_HAT_RIGHT)
|
||||
* {
|
||||
* // State of hat 2 could be right-up, right or right-down
|
||||
* }
|
||||
* if (hats[2] & GLFW_HAT_RIGHT)
|
||||
* {
|
||||
* // State of hat 2 could be right-up, right or right-down
|
||||
* }
|
||||
* @endcode
|
||||
*
|
||||
* If the specified joystick is not present this function will return `NULL`
|
||||
@ -4859,7 +4859,7 @@ GLFWAPI void glfwSetTime(double time);
|
||||
* 1 / frequency seconds. To get the frequency, call @ref
|
||||
* glfwGetTimerFrequency.
|
||||
*
|
||||
* @return The value of the timer, or zero if an
|
||||
* @return The value of the timer, or zero if an
|
||||
* [error](@ref error_handling) occurred.
|
||||
*
|
||||
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED.
|
||||
|
@ -51,7 +51,7 @@
|
||||
// 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.
|
||||
// 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.
|
||||
|
@ -51,7 +51,7 @@
|
||||
// 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.
|
||||
// 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.
|
||||
|
212
tests/opacity.c
212
tests/opacity.c
@ -1,106 +1,106 @@
|
||||
//========================================================================
|
||||
// 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/glad.h>
|
||||
#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)
|
||||
{
|
||||
GLFWmonitor* monitor = NULL;
|
||||
GLFWwindow* window;
|
||||
struct nk_context* nk;
|
||||
struct nk_font_atlas* atlas;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
window = glfwCreateWindow(400, 400, "Opacity", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) 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);
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
// 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/glad.h>
|
||||
#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)
|
||||
{
|
||||
GLFWmonitor* monitor = NULL;
|
||||
GLFWwindow* window;
|
||||
struct nk_context* nk;
|
||||
struct nk_font_atlas* atlas;
|
||||
|
||||
glfwSetErrorCallback(error_callback);
|
||||
|
||||
if (!glfwInit())
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
window = glfwCreateWindow(400, 400, "Opacity", NULL, NULL);
|
||||
if (!window)
|
||||
{
|
||||
glfwTerminate();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
glfwMakeContextCurrent(window);
|
||||
gladLoadGLLoader((GLADloadproc) 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);
|
||||
}
|
||||
|
||||
|
@ -738,7 +738,7 @@ static void demo_prepare_buffers(struct demo *demo) {
|
||||
} else if (swapchainExtent.width > surfCapabilities.maxImageExtent.width) {
|
||||
swapchainExtent.width = surfCapabilities.maxImageExtent.width;
|
||||
}
|
||||
|
||||
|
||||
if (swapchainExtent.height < surfCapabilities.minImageExtent.height) {
|
||||
swapchainExtent.height = surfCapabilities.minImageExtent.height;
|
||||
} else if (swapchainExtent.height > surfCapabilities.maxImageExtent.height) {
|
||||
|
Loading…
Reference in New Issue
Block a user