Lines Matching defs:glfw
80 } glfw;
85 struct nk_glfw_device *dev = &glfw.ogl;
98 struct nk_glfw_device *dev = &glfw.ogl;
108 glViewport(0,0,(GLsizei)glfw.display_width,(GLsizei)glfw.display_height);
112 glOrtho(0.0f, glfw.width, glfw.height, 0.0f, -1.0f, 1.0f);
154 nk_convert(&glfw.ctx, &dev->cmds, &vbuf, &ebuf, &config);
164 nk_draw_foreach(cmd, &glfw.ctx, &dev->cmds)
169 (GLint)(cmd->clip_rect.x * glfw.fb_scale.x),
170 (GLint)((glfw.height - (GLint)(cmd->clip_rect.y + cmd->clip_rect.h)) * glfw.fb_scale.y),
171 (GLint)(cmd->clip_rect.w * glfw.fb_scale.x),
172 (GLint)(cmd->clip_rect.h * glfw.fb_scale.y));
176 nk_clear(&glfw.ctx);
204 if (glfw.text_len < NK_GLFW_TEXT_MAX)
205 glfw.text[glfw.text_len++] = codepoint;
212 glfw.scroll.x += (float)xoff;
213 glfw.scroll.y += (float)yoff;
223 double dt = glfwGetTime() - glfw.last_button_click;
225 glfw.is_double_click_down = nk_true;
226 glfw.double_click_pos = nk_vec2((float)x, (float)y);
228 glfw.last_button_click = glfwGetTime();
229 } else glfw.is_double_click_down = nk_false;
235 const char *text = glfwGetClipboardString(glfw.win);
250 glfwSetClipboardString(glfw.win, str);
257 glfw.win = win;
263 nk_init_default(&glfw.ctx, 0);
264 glfw.ctx.clip.copy = nk_glfw3_clipboard_copy;
265 glfw.ctx.clip.paste = nk_glfw3_clipboard_paste;
266 glfw.ctx.clip.userdata = nk_handle_ptr(0);
267 nk_buffer_init_default(&glfw.ogl.cmds);
269 glfw.is_double_click_down = nk_false;
270 glfw.double_click_pos = nk_vec2(0, 0);
272 return &glfw.ctx;
278 nk_font_atlas_init_default(&glfw.atlas);
279 nk_font_atlas_begin(&glfw.atlas);
280 *atlas = &glfw.atlas;
287 image = nk_font_atlas_bake(&glfw.atlas, &w, &h, NK_FONT_ATLAS_RGBA32);
289 nk_font_atlas_end(&glfw.atlas, nk_handle_id((int)glfw.ogl.font_tex), &glfw.ogl.null);
290 if (glfw.atlas.default_font)
291 nk_style_set_font(&glfw.ctx, &glfw.atlas.default_font->handle);
299 struct nk_context *ctx = &glfw.ctx;
300 struct GLFWwindow *win = glfw.win;
302 glfwGetWindowSize(win, &glfw.width, &glfw.height);
303 glfwGetFramebufferSize(win, &glfw.display_width, &glfw.display_height);
304 glfw.fb_scale.x = (float)glfw.display_width/(float)glfw.width;
305 glfw.fb_scale.y = (float)glfw.display_height/(float)glfw.height;
308 for (i = 0; i < glfw.text_len; ++i)
309 nk_input_unicode(ctx, glfw.text[i]);
313 glfwSetInputMode(glfw.win, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);
315 glfwSetInputMode(glfw.win, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
355 glfwSetCursorPos(glfw.win, (double)ctx->input.mouse.prev.x, (double)ctx->input.mouse.prev.y);
363 nk_input_button(ctx, NK_BUTTON_DOUBLE, (int)glfw.double_click_pos.x, (int)glfw.double_click_pos.y, glfw.is_double_click_down);
364 nk_input_scroll(ctx, glfw.scroll);
365 nk_input_end(&glfw.ctx);
366 glfw.text_len = 0;
367 glfw.scroll = nk_vec2(0,0);
373 struct nk_glfw_device *dev = &glfw.ogl;
374 nk_font_atlas_clear(&glfw.atlas);
375 nk_free(&glfw.ctx);
378 NK_MEMSET(&glfw, 0, sizeof(glfw));