VertexManager::VertexManager() { CreateDeviceObjects(); s_pCurBufferPointer = s_pBaseBufferPointer = (u8*)m_vertexBufferData; s_pEndBufferPointer = s_pBaseBufferPointer + MAX_VBUFFER_SIZE; s_pIndexBufferPointer = (u8*)m_indexBufferData; }
FramebufferManagerGLES::FramebufferManagerGLES(Draw::DrawContext *draw, GLRenderManager *render) : FramebufferManagerCommon(draw), render_(render) { needBackBufferYSwap_ = true; needGLESRebinds_ = true; CreateDeviceObjects(); render_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); }
VertexManager::VertexManager() { LocalVBuffer.resize(MAXVBUFFERSIZE); s_pCurBufferPointer = s_pBaseBufferPointer = &LocalVBuffer[0]; s_pEndBufferPointer = s_pBaseBufferPointer + LocalVBuffer.size(); LocalIBuffer.resize(MAXIBUFFERSIZE); CreateDeviceObjects(); }
void NavigationLine::SetVisible(bool visible) { if (m_visible != visible) { m_visible = visible; if (m_visible) { m_needsUpdate = true; CreateDeviceObjects(); } else InvalidateDeviceObjects(); } }
void NewFrame() { if (!g_FontTexture) CreateDeviceObjects(); ImGuiIO& io = ImGui::GetIO(); // Setup display size (every frame to accommodate for window resizing) int w, h; int display_w, display_h; glfwGetWindowSize(g_Window, &w, &h); glfwGetFramebufferSize(g_Window, &display_w, &display_h); io.DisplaySize = ImVec2((float)w, (float)h); io.DisplayFramebufferScale = ImVec2(w > 0 ? ((float)display_w / w) : 0, h > 0 ? ((float)display_h / h) : 0); // Setup time step double current_time = glfwGetTime(); io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f/60.0f); g_Time = current_time; // Setup inputs // (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents()) if (glfwGetWindowAttrib(g_Window, GLFW_FOCUSED)) { double mouse_x, mouse_y; glfwGetCursorPos(g_Window, &mouse_x, &mouse_y); io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position in screen coordinates (set to -1,-1 if no mouse / on another screen, etc.) } else { io.MousePos = ImVec2(-1,-1); } for (int i = 0; i < 3; i++) { io.MouseDown[i] = g_MousePressed[i] || glfwGetMouseButton(g_Window, i) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame. g_MousePressed[i] = false; } io.MouseWheel = g_MouseWheel; g_MouseWheel = 0.0f; // Hide OS mouse cursor if ImGui is drawing it glfwSetInputMode(g_Window, GLFW_CURSOR, io.MouseDrawCursor ? GLFW_CURSOR_HIDDEN : GLFW_CURSOR_NORMAL); // Start the frame ImGui::NewFrame(); }
void CGUIManager::NewFrame() { static int frame = 0; SingletonPointer<CTimeManager> TimeManager; if (! FontTexture) CreateDeviceObjects(); ImGuiIO& io = ImGui::GetIO(); // Setup display size (every frame to accommodate for window resizing) int w = Window->GetSize().X, h = Window->GetSize().Y; int display_w = Window->GetFrameBufferSize().X, display_h = Window->GetFrameBufferSize().Y; io.DisplaySize = ImVec2((float) w, (float) h); io.DisplayFramebufferScale = ImVec2(w > 0 ? ((float) display_w / w) : 0, h > 0 ? ((float) display_h / h) : 0); // Setup time step double current_time = TimeManager->GetRunTime(); io.DeltaTime = Time > 0.0 ? (float) (current_time - Time) : (float) (1.0f / 60.0f); Time = current_time; // Setup inputs // (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents()) if (Window->IsFocused()) { double mouse_x, mouse_y; mouse_x = Window->GetCursorLocation().X; mouse_y = Window->GetCursorLocation().Y; io.MousePos = ImVec2((float) mouse_x, (float) mouse_y); // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) } else { io.MousePos = ImVec2(-1, -1); } for (int i = 0; i < 3; i++) { io.MouseDown[i] = MousePressed[i] || Window->IsMouseDown((SMouseEvent::EButton) i); // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame. MousePressed[i] = false; } io.MouseWheel = MouseWheel; MouseWheel = 0; // Start the frame ImGui::NewFrame(); }
void ImGuiDX9::NewFrame() { SME_ASSERT(Initialized); if (!FontTexture) CreateDeviceObjects(); ImGuiIO& io = ImGui::GetIO(); // Setup display size (every frame to accommodate for window resizing) RECT rect; GetClientRect(RenderWindowHandle, &rect); io.DisplaySize = ImVec2((float)(rect.right - rect.left), (float)(rect.bottom - rect.top)); // Setup time step INT64 current_time; QueryPerformanceCounter((LARGE_INTEGER *)¤t_time); io.DeltaTime = (float)(current_time - Time) / TicksPerSecond; Time = current_time; // Read keyboard modifiers inputs io.KeyCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0; io.KeyShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0; io.KeyAlt = (GetKeyState(VK_MENU) & 0x8000) != 0; io.KeySuper = false; // clear the input event whitelists every frame PassthroughWhitelistMouseEvents.clear(); // Start the frame ImGui::NewFrame(); ImGuizmo::BeginFrame(); // manually update the double click state as ImGui's default polling doesn't consistently catch the events given our conditional rendering io.MouseDoubleClicked[0] = MouseDoubleClicked[0]; io.MouseDoubleClicked[1] = MouseDoubleClicked[1]; }
VertexManager::VertexManager() : m_cpu_v_buffer(MAX_VBUFFER_SIZE), m_cpu_i_buffer(MAX_IBUFFER_SIZE) { CreateDeviceObjects(); }
VertexManager::VertexManager() { CreateDeviceObjects(); }
bool NewFrame(SDL_Window *window) { if (!g_FontTexture) CreateDeviceObjects(); ImGuiIO &io = ImGui::GetIO(); bool done(false); SDL_Event event; while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: done = true; break; case SDL_MOUSEWHEEL: if (event.wheel.y > 0) { g_MouseWheel = 1; } if (event.wheel.y < 0) { g_MouseWheel = -1; } break; case SDL_TEXTINPUT: CharCallback(event.text.text[0]); break; case SDL_KEYUP: KeyCallback(event.key.keysym.sym & ~SDLK_SCANCODE_MASK, false); break; case SDL_KEYDOWN: KeyCallback(event.key.keysym.sym & ~SDLK_SCANCODE_MASK, true); break; default: break; } } // Setup display size (every frame to accommodate for window resizing) int w, h; SDL_GetWindowSize(window, &w, &h); io.DisplaySize = ImVec2((float)w, (float)h); // Time Uint32 time = SDL_GetTicks(); double current_time = time / 1000.0; io.DeltaTime = g_Time > 0.0 ? (float)(current_time - g_Time) : (float)(1.0f / 60.0f); g_Time = current_time; int mx, my; Uint32 mouseMask = SDL_GetMouseState(&mx, &my); // Setup inputs // (we already got mouse wheel, keyboard keys & characters from glfw callbacks // polled in glfwPollEvents()) Uint32 windowFlags = SDL_GetWindowFlags(window); if (windowFlags & SDL_WINDOW_MOUSE_FOCUS) { io.MousePos = ImVec2((float)mx, (float)my); // Mouse position, in pixels // (set to -1,-1 if no mouse / // on another screen, etc.) } else { io.MousePos = ImVec2(-1, -1); } for (int i = 0; i < 3; i++) { io.MouseDown[i] = g_MousePressed[i] || (mouseMask & (1 << i)) != 0; // If a mouse press event came, always pass // it as "mouse held this frame", so we // don't miss click-release events that are // shorter than 1 frame. g_MousePressed[i] = false; } io.MouseWheel = g_MouseWheel; g_MouseWheel = 0.0f; // Hide/show hardware mouse cursor SDL_ShowCursor(io.MouseDrawCursor ? 0 : 1); // Start the frame ImGui::NewFrame(); return done; }
RenderHandler::RenderHandler() { CreateDeviceObjects(); }
void FramebufferManagerGLES::DeviceRestore(Draw::DrawContext *draw) { draw_ = draw; render_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER); CreateDeviceObjects(); }