Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions demo/d3d11/nuklear_d3d11.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static struct
struct nk_font_atlas atlas;
struct nk_buffer cmds;

struct nk_draw_null_texture null;
struct nk_draw_null_texture tex_null;
unsigned int max_vertex_buffer;
unsigned int max_index_buffer;

Expand Down Expand Up @@ -137,7 +137,7 @@ nk_d3d11_render(ID3D11DeviceContext *context, enum nk_anti_aliasing AA)
config.circle_segment_count = 22;
config.curve_segment_count = 22;
config.arc_segment_count = 22;
config.null = d3d11.null;
config.tex_null = d3d11.tex_null;

{/* setup buffers to load vertices and elements */
struct nk_buffer vbuf, ibuf;
Expand Down Expand Up @@ -373,7 +373,7 @@ nk_d3d11_clipboard_paste(nk_handle usr, struct nk_text_edit *edit)
(void)usr;
if (IsClipboardFormatAvailable(CF_UNICODETEXT) && OpenClipboard(NULL))
{
HGLOBAL mem = GetClipboardData(CF_UNICODETEXT);
HGLOBAL mem = GetClipboardData(CF_UNICODETEXT);
if (mem)
{
SIZE_T size = GlobalSize(mem) - 1;
Expand All @@ -393,7 +393,7 @@ nk_d3d11_clipboard_paste(nk_handle usr, struct nk_text_edit *edit)
free(utf8);
}
}
GlobalUnlock(mem);
GlobalUnlock(mem);
}
}
}
Expand All @@ -419,7 +419,7 @@ nk_d3d11_clipboard_copy(nk_handle usr, const char *text, int len)
MultiByteToWideChar(CP_UTF8, 0, text, len, wstr, wsize);
wstr[wsize] = 0;
GlobalUnlock(mem);
SetClipboardData(CF_UNICODETEXT, mem);
SetClipboardData(CF_UNICODETEXT, mem);
}
}
}
Expand Down Expand Up @@ -603,7 +603,7 @@ nk_d3d11_font_stash_end(void)
assert(SUCCEEDED(hr));}
ID3D11Texture2D_Release(font_texture);}

nk_font_atlas_end(&d3d11.atlas, nk_handle_ptr(d3d11.font_texture_view), &d3d11.null);
nk_font_atlas_end(&d3d11.atlas, nk_handle_ptr(d3d11.font_texture_view), &d3d11.tex_null);
if (d3d11.atlas.default_font)
nk_style_set_font(&d3d11.ctx, &d3d11.atlas.default_font->handle);
}
Expand Down
28 changes: 14 additions & 14 deletions demo/d3d12/nuklear_d3d12.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Nuklear - 1.32.0 - public domain
* no warrenty implied; use at your own risk.
* authored from 2015-2016 by Micha Mettke
*
*
* D3D12 backend created by Ludwig Fuechsl (2022)
*/
/*
Expand Down Expand Up @@ -30,7 +30,7 @@ NK_API struct nk_context *nk_d3d12_init(ID3D12Device *device, int width, int hei
NK_API void nk_d3d12_font_stash_begin(struct nk_font_atlas **atlas);
/*
* USAGE:
* - Call this function after a call to nk_d3d12_font_stash_begin(...) when all fonts have been loaded and configured.
* - Call this function after a call to nk_d3d12_font_stash_begin(...) when all fonts have been loaded and configured.
* - This function will place commands on the supplied ID3D12GraphicsCommandList.
* - This function will allocate temporary data that is required until the command list has finish executing. The temporary data can be free by calling nk_d3d12_font_stash_cleanup(...)
*/
Expand Down Expand Up @@ -96,7 +96,7 @@ NK_API void nk_d3d12_shutdown(void);
#include "nuklear_d3d12_vertex_shader.h"
#include "nuklear_d3d12_pixel_shader.h"

struct nk_d3d12_vertex
struct nk_d3d12_vertex
{
float position[2];
float uv[2];
Expand All @@ -109,7 +109,7 @@ static struct
struct nk_font_atlas atlas;
struct nk_buffer cmds;

struct nk_draw_null_texture null;
struct nk_draw_null_texture tex_null;
unsigned int max_vertex_buffer;
unsigned int max_index_buffer;
unsigned int max_user_textures;
Expand Down Expand Up @@ -198,7 +198,7 @@ nk_d3d12_render(ID3D12GraphicsCommandList *command_list, enum nk_anti_aliasing A
config.circle_segment_count = 22;
config.curve_segment_count = 22;
config.arc_segment_count = 22;
config.null = d3d12.null;
config.tex_null = d3d12.tex_null;

struct nk_buffer vbuf, ibuf;
nk_buffer_init_fixed(&vbuf, &ptr_data[sizeof(float) * 4 * 4], (size_t)d3d12.max_vertex_buffer);
Expand Down Expand Up @@ -505,7 +505,7 @@ nk_d3d12_clipboard_paste(nk_handle usr, struct nk_text_edit *edit)
(void)usr;
if (IsClipboardFormatAvailable(CF_UNICODETEXT) && OpenClipboard(NULL))
{
HGLOBAL mem = GetClipboardData(CF_UNICODETEXT);
HGLOBAL mem = GetClipboardData(CF_UNICODETEXT);
if (mem)
{
SIZE_T size = GlobalSize(mem) - 1;
Expand All @@ -525,7 +525,7 @@ nk_d3d12_clipboard_paste(nk_handle usr, struct nk_text_edit *edit)
free(utf8);
}
}
GlobalUnlock(mem);
GlobalUnlock(mem);
}
}
}
Expand All @@ -551,7 +551,7 @@ nk_d3d12_clipboard_copy(nk_handle usr, const char *text, int len)
MultiByteToWideChar(CP_UTF8, 0, text, len, wstr, wsize);
wstr[wsize] = 0;
GlobalUnlock(mem);
SetClipboardData(CF_UNICODETEXT, mem);
SetClipboardData(CF_UNICODETEXT, mem);
}
}
}
Expand All @@ -566,7 +566,7 @@ nk_d3d12_init(ID3D12Device *device, int width, int height, unsigned int max_vert
D3D12_CONSTANT_BUFFER_VIEW_DESC cbv;
D3D12_CPU_DESCRIPTOR_HANDLE cbv_handle;

/* Do plain object / ref copys */
/* Do plain object / ref copys */
d3d12.max_vertex_buffer = max_vertex_buffer;
d3d12.max_index_buffer = max_index_buffer;
d3d12.max_user_textures = max_user_textures;
Expand Down Expand Up @@ -679,7 +679,7 @@ nk_d3d12_init(ID3D12Device *device, int width, int height, unsigned int max_vert
/* Get address of first handle (CPU and GPU) */
ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(d3d12.desc_heap, &d3d12.cpu_descriptor_handle);
ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(d3d12.desc_heap, &d3d12.gpu_descriptor_handle);

/* Get addresses of vertex & index buffers */
d3d12.gpu_vertex_buffer_address = ID3D12Resource_GetGPUVirtualAddress(d3d12.vertex_buffer);
d3d12.gpu_index_buffer_address = ID3D12Resource_GetGPUVirtualAddress(d3d12.index_buffer);
Expand Down Expand Up @@ -863,14 +863,14 @@ nk_d3d12_font_stash_end(ID3D12GraphicsCommandList *command_list)
ID3D12Device_CreateShaderResourceView(d3d12.device, d3d12.font_texture, &srv_desc, srv_handle);

/* Done with nk atlas data. Atlas will be served with texture id 0 */
nk_font_atlas_end(&d3d12.atlas, nk_handle_id(0), &d3d12.null);
nk_font_atlas_end(&d3d12.atlas, nk_handle_id(0), &d3d12.tex_null);

/* Setup default font */
if (d3d12.atlas.default_font)
nk_style_set_font(&d3d12.ctx, &d3d12.atlas.default_font->handle);
}

NK_API
NK_API
void nk_d3d12_font_stash_cleanup()
{
if(d3d12.font_upload_buffer)
Expand All @@ -880,7 +880,7 @@ void nk_d3d12_font_stash_cleanup()
}
}

NK_API
NK_API
nk_bool nk_d3d12_set_user_texture(unsigned int index, ID3D12Resource* texture, const D3D12_SHADER_RESOURCE_VIEW_DESC* description, nk_handle* handle_out)
{
nk_bool result = nk_false;
Expand Down Expand Up @@ -919,7 +919,7 @@ void nk_d3d12_shutdown(void)
ID3D12Resource_Release(d3d12.const_buffer);
ID3D12Resource_Release(d3d12.index_buffer);
ID3D12Resource_Release(d3d12.vertex_buffer);
if(d3d12.font_texture)
if(d3d12.font_texture)
ID3D12Resource_Release(d3d12.font_texture);
if(d3d12.font_upload_buffer)
ID3D12Resource_Release(d3d12.font_upload_buffer);
Expand Down
10 changes: 5 additions & 5 deletions demo/d3d9/nuklear_d3d9.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static struct {
struct nk_font_atlas atlas;
struct nk_buffer cmds;

struct nk_draw_null_texture null;
struct nk_draw_null_texture tex_null;

D3DVIEWPORT9 viewport;
D3DMATRIX projection;
Expand Down Expand Up @@ -150,7 +150,7 @@ nk_d3d9_render(enum nk_anti_aliasing AA)
config.circle_segment_count = 22;
config.curve_segment_count = 22;
config.arc_segment_count = 22;
config.null = d3d9.null;
config.tex_null = d3d9.tex_null;

/* convert shapes into vertexes */
nk_buffer_init_default(&vbuf);
Expand Down Expand Up @@ -248,7 +248,7 @@ nk_d3d9_create_font_texture()
hr = IDirect3DTexture9_UnlockRect(d3d9.texture, 0);
NK_ASSERT(SUCCEEDED(hr));

nk_font_atlas_end(&d3d9.atlas, nk_handle_ptr(d3d9.texture), &d3d9.null);
nk_font_atlas_end(&d3d9.atlas, nk_handle_ptr(d3d9.texture), &d3d9.tex_null);
}

NK_API void
Expand Down Expand Up @@ -468,7 +468,7 @@ nk_d3d9_clipboard_paste(nk_handle usr, struct nk_text_edit *edit)
}
}

GlobalUnlock(mem);
GlobalUnlock(mem);
CloseClipboard();
}

Expand All @@ -491,7 +491,7 @@ nk_d3d9_clipboard_copy(nk_handle usr, const char *text, int len)
MultiByteToWideChar(CP_UTF8, 0, text, len, wstr, wsize);
wstr[wsize] = 0;
GlobalUnlock(mem);
SetClipboardData(CF_UNICODETEXT, mem);
SetClipboardData(CF_UNICODETEXT, mem);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions demo/glfw_opengl2/nuklear_glfw_gl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ NK_API void nk_gflw3_scroll_callback(GLFWwindow *win, double xof

struct nk_glfw_device {
struct nk_buffer cmds;
struct nk_draw_null_texture null;
struct nk_draw_null_texture tex_null;
GLuint font_tex;
};

Expand Down Expand Up @@ -140,7 +140,7 @@ nk_glfw3_render(enum nk_anti_aliasing AA)
config.vertex_layout = vertex_layout;
config.vertex_size = sizeof(struct nk_glfw_vertex);
config.vertex_alignment = NK_ALIGNOF(struct nk_glfw_vertex);
config.null = dev->null;
config.tex_null = dev->tex_null;
config.circle_segment_count = 22;
config.curve_segment_count = 22;
config.arc_segment_count = 22;
Expand Down Expand Up @@ -288,7 +288,7 @@ nk_glfw3_font_stash_end(void)
const void *image; int w, h;
image = nk_font_atlas_bake(&glfw.atlas, &w, &h, NK_FONT_ATLAS_RGBA32);
nk_glfw3_device_upload_atlas(image, w, h);
nk_font_atlas_end(&glfw.atlas, nk_handle_id((int)glfw.ogl.font_tex), &glfw.ogl.null);
nk_font_atlas_end(&glfw.atlas, nk_handle_id((int)glfw.ogl.font_tex), &glfw.ogl.tex_null);
if (glfw.atlas.default_font)
nk_style_set_font(&glfw.ctx, &glfw.atlas.default_font->handle);
}
Expand Down
6 changes: 3 additions & 3 deletions demo/glfw_opengl3/nuklear_glfw_gl3.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ enum nk_glfw_init_state{

struct nk_glfw_device {
struct nk_buffer cmds;
struct nk_draw_null_texture null;
struct nk_draw_null_texture tex_null;
GLuint vbo, vao, ebo;
GLuint prog;
GLuint vert_shdr;
Expand Down Expand Up @@ -266,7 +266,7 @@ nk_glfw3_render(struct nk_glfw* glfw, enum nk_anti_aliasing AA, int max_vertex_b
config.vertex_layout = vertex_layout;
config.vertex_size = sizeof(struct nk_glfw_vertex);
config.vertex_alignment = NK_ALIGNOF(struct nk_glfw_vertex);
config.null = dev->null;
config.tex_null = dev->tex_null;
config.circle_segment_count = 22;
config.curve_segment_count = 22;
config.arc_segment_count = 22;
Expand Down Expand Up @@ -403,7 +403,7 @@ nk_glfw3_font_stash_end(struct nk_glfw* glfw)
const void *image; int w, h;
image = nk_font_atlas_bake(&glfw->atlas, &w, &h, NK_FONT_ATLAS_RGBA32);
nk_glfw3_device_upload_atlas(glfw, image, w, h);
nk_font_atlas_end(&glfw->atlas, nk_handle_id((int)glfw->ogl.font_tex), &glfw->ogl.null);
nk_font_atlas_end(&glfw->atlas, nk_handle_id((int)glfw->ogl.font_tex), &glfw->ogl.tex_null);
if (glfw->atlas.default_font)
nk_style_set_font(&glfw->ctx, &glfw->atlas.default_font->handle);
}
Expand Down
6 changes: 3 additions & 3 deletions demo/glfw_opengl4/nuklear_glfw_gl4.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct nk_glfw_vertex {

struct nk_glfw_device {
struct nk_buffer cmds;
struct nk_draw_null_texture null;
struct nk_draw_null_texture tex_null;
GLuint vbo, vao, ebo;
GLuint prog;
GLuint vert_shdr;
Expand Down Expand Up @@ -407,7 +407,7 @@ nk_glfw3_render(enum nk_anti_aliasing AA)
config.vertex_layout = vertex_layout;
config.vertex_size = sizeof(struct nk_glfw_vertex);
config.vertex_alignment = NK_ALIGNOF(struct nk_glfw_vertex);
config.null = dev->null;
config.tex_null = dev->tex_null;
config.circle_segment_count = 22;
config.curve_segment_count = 22;
config.arc_segment_count = 22;
Expand Down Expand Up @@ -553,7 +553,7 @@ nk_glfw3_font_stash_end(void)
const void *image; int w, h;
image = nk_font_atlas_bake(&glfw.atlas, &w, &h, NK_FONT_ATLAS_RGBA32);
nk_glfw3_device_upload_atlas(image, w, h);
nk_font_atlas_end(&glfw.atlas, nk_handle_id((int)glfw.ogl.font_tex_index), &glfw.ogl.null);
nk_font_atlas_end(&glfw.atlas, nk_handle_id((int)glfw.ogl.font_tex_index), &glfw.ogl.tex_null);
if (glfw.atlas.default_font)
nk_style_set_font(&glfw.ctx, &glfw.atlas.default_font->handle);
}
Expand Down
6 changes: 3 additions & 3 deletions demo/sdl_opengl2/nuklear_sdl_gl2.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ NK_API void nk_sdl_shutdown(void);

struct nk_sdl_device {
struct nk_buffer cmds;
struct nk_draw_null_texture null;
struct nk_draw_null_texture tex_null;
GLuint font_tex;
};

Expand Down Expand Up @@ -120,7 +120,7 @@ nk_sdl_render(enum nk_anti_aliasing AA)
config.vertex_layout = vertex_layout;
config.vertex_size = sizeof(struct nk_sdl_vertex);
config.vertex_alignment = NK_ALIGNOF(struct nk_sdl_vertex);
config.null = dev->null;
config.tex_null = dev->tex_null;
config.circle_segment_count = 22;
config.curve_segment_count = 22;
config.arc_segment_count = 22;
Expand Down Expand Up @@ -226,7 +226,7 @@ nk_sdl_font_stash_end(void)
const void *image; int w, h;
image = nk_font_atlas_bake(&sdl.atlas, &w, &h, NK_FONT_ATLAS_RGBA32);
nk_sdl_device_upload_atlas(image, w, h);
nk_font_atlas_end(&sdl.atlas, nk_handle_id((int)sdl.ogl.font_tex), &sdl.ogl.null);
nk_font_atlas_end(&sdl.atlas, nk_handle_id((int)sdl.ogl.font_tex), &sdl.ogl.tex_null);
if (sdl.atlas.default_font)
nk_style_set_font(&sdl.ctx, &sdl.atlas.default_font->handle);
}
Expand Down
6 changes: 3 additions & 3 deletions demo/sdl_opengl3/nuklear_sdl_gl3.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ NK_API void nk_sdl_device_create(void);

struct nk_sdl_device {
struct nk_buffer cmds;
struct nk_draw_null_texture null;
struct nk_draw_null_texture tex_null;
GLuint vbo, vao, ebo;
GLuint prog;
GLuint vert_shdr;
Expand Down Expand Up @@ -247,7 +247,7 @@ nk_sdl_render(enum nk_anti_aliasing AA, int max_vertex_buffer, int max_element_b
config.vertex_layout = vertex_layout;
config.vertex_size = sizeof(struct nk_sdl_vertex);
config.vertex_alignment = NK_ALIGNOF(struct nk_sdl_vertex);
config.null = dev->null;
config.tex_null = dev->tex_null;
config.circle_segment_count = 22;
config.curve_segment_count = 22;
config.arc_segment_count = 22;
Expand Down Expand Up @@ -334,7 +334,7 @@ nk_sdl_font_stash_end(void)
const void *image; int w, h;
image = nk_font_atlas_bake(&sdl.atlas, &w, &h, NK_FONT_ATLAS_RGBA32);
nk_sdl_device_upload_atlas(image, w, h);
nk_font_atlas_end(&sdl.atlas, nk_handle_id((int)sdl.ogl.font_tex), &sdl.ogl.null);
nk_font_atlas_end(&sdl.atlas, nk_handle_id((int)sdl.ogl.font_tex), &sdl.ogl.tex_null);
if (sdl.atlas.default_font)
nk_style_set_font(&sdl.ctx, &sdl.atlas.default_font->handle);

Expand Down
Loading