-
Notifications
You must be signed in to change notification settings - Fork 572
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for 9-slice/9-patch textures for various widgets and in…
…cremented version to 4.01.6.
- Loading branch information
1 parent
7fe20af
commit 505c0f9
Showing
20 changed files
with
26,376 additions
and
25,845 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#include "nuklear.h" | ||
#include "nuklear_internal.h" | ||
|
||
/* =============================================================== | ||
* | ||
* 9-SLICE | ||
* | ||
* ===============================================================*/ | ||
NK_API struct nk_9slice | ||
nk_sub9slice_ptr(void *ptr, nk_ushort w, nk_ushort h, struct nk_rect rgn, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b) | ||
{ | ||
struct nk_9slice s; | ||
nk_zero(&s, sizeof(s)); | ||
struct nk_image *i = (struct nk_image*)&s; | ||
i->handle.ptr = ptr; | ||
i->w = w; i->h = h; | ||
i->region[0] = (nk_ushort)rgn.x; | ||
i->region[1] = (nk_ushort)rgn.y; | ||
i->region[2] = (nk_ushort)rgn.w; | ||
i->region[3] = (nk_ushort)rgn.h; | ||
s.l = l; s.t = t; s.r = r; s.b = b; | ||
return s; | ||
} | ||
NK_API struct nk_9slice | ||
nk_sub9slice_id(int id, nk_ushort w, nk_ushort h, struct nk_rect rgn, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b) | ||
{ | ||
struct nk_9slice s; | ||
nk_zero(&s, sizeof(s)); | ||
struct nk_image *i = (struct nk_image*)&s; | ||
i->handle.id = id; | ||
i->w = w; i->h = h; | ||
i->region[0] = (nk_ushort)rgn.x; | ||
i->region[1] = (nk_ushort)rgn.y; | ||
i->region[2] = (nk_ushort)rgn.w; | ||
i->region[3] = (nk_ushort)rgn.h; | ||
s.l = l; s.t = t; s.r = r; s.b = b; | ||
return s; | ||
} | ||
NK_API struct nk_9slice | ||
nk_sub9slice_handle(nk_handle handle, nk_ushort w, nk_ushort h, struct nk_rect rgn, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b) | ||
{ | ||
struct nk_9slice s; | ||
nk_zero(&s, sizeof(s)); | ||
struct nk_image *i = (struct nk_image*)&s; | ||
i->handle = handle; | ||
i->w = w; i->h = h; | ||
i->region[0] = (nk_ushort)rgn.x; | ||
i->region[1] = (nk_ushort)rgn.y; | ||
i->region[2] = (nk_ushort)rgn.w; | ||
i->region[3] = (nk_ushort)rgn.h; | ||
s.l = l; s.t = t; s.r = r; s.b = b; | ||
return s; | ||
} | ||
NK_API struct nk_9slice | ||
nk_9slice_handle(nk_handle handle, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b) | ||
{ | ||
struct nk_9slice s; | ||
nk_zero(&s, sizeof(s)); | ||
struct nk_image *i = (struct nk_image*)&s; | ||
i->handle = handle; | ||
i->w = 0; i->h = 0; | ||
i->region[0] = 0; | ||
i->region[1] = 0; | ||
i->region[2] = 0; | ||
i->region[3] = 0; | ||
s.l = l; s.t = t; s.r = r; s.b = b; | ||
return s; | ||
} | ||
NK_API struct nk_9slice | ||
nk_9slice_ptr(void *ptr, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b) | ||
{ | ||
struct nk_9slice s; | ||
nk_zero(&s, sizeof(s)); | ||
struct nk_image *i = (struct nk_image*)&s; | ||
NK_ASSERT(ptr); | ||
i->handle.ptr = ptr; | ||
i->w = 0; i->h = 0; | ||
i->region[0] = 0; | ||
i->region[1] = 0; | ||
i->region[2] = 0; | ||
i->region[3] = 0; | ||
s.l = l; s.t = t; s.r = r; s.b = b; | ||
return s; | ||
} | ||
NK_API struct nk_9slice | ||
nk_9slice_id(int id, nk_ushort l, nk_ushort t, nk_ushort r, nk_ushort b) | ||
{ | ||
struct nk_9slice s; | ||
nk_zero(&s, sizeof(s)); | ||
struct nk_image *i = (struct nk_image*)&s; | ||
i->handle.id = id; | ||
i->w = 0; i->h = 0; | ||
i->region[0] = 0; | ||
i->region[1] = 0; | ||
i->region[2] = 0; | ||
i->region[3] = 0; | ||
s.l = l; s.t = t; s.r = r; s.b = b; | ||
return s; | ||
} | ||
NK_API int | ||
nk_9slice_is_sub9slice(const struct nk_9slice* slice) | ||
{ | ||
NK_ASSERT(slice); | ||
return !(slice->img.w == 0 && slice->img.h == 0); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.