Fixed C++ demo errors

This commit is contained in:
vurtun 2016-04-29 14:31:27 +02:00
parent 389176ef4b
commit 34a9405e69
5 changed files with 7 additions and 7 deletions

View File

@ -111,7 +111,7 @@ nk_allegro_render(enum nk_anti_aliasing AA)
/* <sign> allegro does not support 32-bit packed color */
unsigned int i = 0;
struct nk_draw_vertex *verts = (struct nk_draw_vertex*)dev->vertex_buffer;
vertices = calloc(sizeof(struct nk_allegro_vertex), ctx->draw_list.vertex_count);
vertices = (struct nk_allegro_vertex*)calloc(sizeof(struct nk_allegro_vertex), ctx->draw_list.vertex_count);
for (i = 0; i < ctx->draw_list.vertex_count; ++i) {
nk_byte *c;
vertices[i].pos = verts[i].position;
@ -125,7 +125,7 @@ nk_allegro_render(enum nk_anti_aliasing AA)
* @OPT: define nk_draw_index as int to fix this issue. */
unsigned int i = 0;
nk_draw_index *elements = (nk_draw_index*)dev->element_buffer;
indices = calloc(sizeof(int), ctx->draw_list.element_count);
indices = (int*)calloc(sizeof(int), ctx->draw_list.element_count);
for (i = 0; i < ctx->draw_list.element_count; ++i)
indices[i] = elements[i];
}
@ -133,7 +133,7 @@ nk_allegro_render(enum nk_anti_aliasing AA)
/* iterate over and execute each draw command */
nk_draw_foreach(cmd, ctx, &dev->cmds)
{
ALLEGRO_BITMAP *texture = cmd->texture.ptr;
ALLEGRO_BITMAP *texture = (ALLEGRO_BITMAP*)cmd->texture.ptr;
if (!cmd->elem_count) continue;
al_set_clipping_rectangle((int)cmd->clip_rect.x, (int)cmd->clip_rect.y,
(int)cmd->clip_rect.w, (int)cmd->clip_rect.h);

View File

@ -171,7 +171,7 @@ nk_glfw3_clipbard_copy(nk_handle usr, const char *text, int len)
char *str = 0;
(void)usr;
if (!len) return;
str = malloc((size_t)len+1);
str = (char*)malloc((size_t)len+1);
if (!str) return;
memcpy(str, text, (size_t)len);
str[len] = '\0';

View File

@ -277,7 +277,7 @@ nk_glfw3_clipbard_copy(nk_handle usr, const char *text, int len)
char *str = 0;
(void)usr;
if (!len) return;
str = malloc((size_t)len+1);
str = (char*)malloc((size_t)len+1);
if (!str) return;
memcpy(str, text, (size_t)len);
str[len] = '\0';

View File

@ -150,7 +150,7 @@ nk_sdl_clipbard_copy(nk_handle usr, const char *text, int len)
char *str = 0;
(void)usr;
if (!len) return;
str = malloc((size_t)len+1);
str = (char*)malloc((size_t)len+1);
if (!str) return;
memcpy(str, text, (size_t)len);
str[len] = '\0';

View File

@ -253,7 +253,7 @@ nk_sdl_clipbard_copy(nk_handle usr, const char *text, int len)
char *str = 0;
(void)usr;
if (!len) return;
str = malloc((size_t)len+1);
str = (char*)malloc((size_t)len+1);
if (!str) return;
memcpy(str, text, (size_t)len);
str[len] = '\0';