• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ ImVec2函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ImVec2函数的典型用法代码示例。如果您正苦于以下问题:C++ ImVec2函数的具体用法?C++ ImVec2怎么用?C++ ImVec2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了ImVec2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ImGui_ImplSdl_NewFrame

void ImGui_ImplSdl_NewFrame(SDL_Window *window)
{
    if (!g_FontTexture)
        ImGui_ImplSdl_CreateDeviceObjects();

    ImGuiIO& io = ImGui::GetIO();

    // 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);

    // Setup time step
	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;

    // Setup inputs
    // (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents())
    int mx, my;
    Uint32 mouseMask = SDL_GetMouseState(&mx, &my);
    if (SDL_GetWindowFlags(window) & 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);
   
	io.MouseDown[0] = g_MousePressed[0] || (mouseMask & SDL_BUTTON(SDL_BUTTON_LEFT)) != 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.
	io.MouseDown[1] = g_MousePressed[1] || (mouseMask & SDL_BUTTON(SDL_BUTTON_RIGHT)) != 0;
	io.MouseDown[2] = g_MousePressed[2] || (mouseMask & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
    g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;

    io.MouseWheel = g_MouseWheel;
    g_MouseWheel = 0.0f;

    // Hide OS mouse cursor if ImGui is drawing it
    SDL_ShowCursor(io.MouseDrawCursor ? 0 : 1);

    // Start the frame
    ImGui::NewFrame();
}
开发者ID:ragadeeshu,项目名称:planetoid,代码行数:41,代码来源:imgui_impl_sdl.cpp


示例2: GetCurrentWindow

bool ImGui::Image(cocos2d::Texture2D* texture, const cocos2d::Rect cropSize, const ImVec2& displaySize, int borderSize)
{
	ImGuiWindow* window = GetCurrentWindow();
	if (window->SkipItems)
		return false;
	const ImVec4& tint_col = ImVec4(1, 1, 1, 1);
	const ImVec4& border_col = ImVec4(0.95f, 0.12f, 0.04f, 1);
	
	GLuint textureID = texture->getName();
	ImRect bb(window->DC.CursorPos, window->DC.CursorPos + displaySize);
	if (border_col.w > 0.0f)
		bb.Max += ImVec2(2, 2);
	ItemSize(bb);
	if (!ItemAdd(bb, NULL))
		return false;

	ImGui::PushID((void *)textureID);
	const ImGuiID id = window->GetID("#image");
	ImGui::PopID();

	bool hovered, held;
	bool pressed = ButtonBehavior(bb, id, &hovered, &held);

	float focus_x = cropSize.origin.x;
	float focus_y = cropSize.origin.y;
	ImVec2 uv0 = ImVec2((focus_x) / texture->getContentSize().width, (focus_y) / texture->getContentSize().height);
	ImVec2 uv1 = ImVec2((focus_x + cropSize.size.width) / texture->getContentSize().width, (focus_y + cropSize.size.height) / texture->getContentSize().height);

	if (border_col.w > 0.0f)
	{
		window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(border_col));
		window->DrawList->AddImage((ImTextureID)textureID, bb.Min + ImVec2(borderSize, borderSize), bb.Max - ImVec2(borderSize, borderSize), uv0, uv1, GetColorU32(tint_col));
	}
	else
	{
		window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(border_col));
		window->DrawList->AddImage((ImTextureID)textureID, bb.Min + ImVec2(borderSize, borderSize), bb.Max - ImVec2(borderSize, borderSize), uv0, uv1, GetColorU32(tint_col));
	}

	return pressed;
}
开发者ID:namkazt,项目名称:imguix,代码行数:41,代码来源:imgui_extend.cpp


示例3: RenderInMenu

void CEditorLights::RenderInMenu()
{
	ImGui::SetNextWindowSize(ImVec2(512, 512), ImGuiSetCond_FirstUseEver);
	if (m_activated_editor) {
		ImGui::Begin("LightsEditor", &m_activated_editor);
		RenderGeneral();
		RenderNewLight();
		RenderAllLights();
		RenderMultiEdit();
		ImGui::End();
	}
}
开发者ID:DopaminaInTheVein,项目名称:ItLightens,代码行数:12,代码来源:editor_lights.cpp


示例4: onToolbar

void AssetBrowser::onToolbar()
{
	auto pos = ImGui::GetCursorScreenPos();
	if (ImGui::BeginToolbar("asset_browser_toolbar", pos, ImVec2(0, 24)))
	{
		if (m_history_index > 0) m_back_action->toolbarButton();
		if (m_history_index < m_history.size() - 1) m_forward_action->toolbarButton();
		m_auto_reload_action->toolbarButton();
		m_refresh_action->toolbarButton();
	}
	ImGui::EndToolbar();
}
开发者ID:Fergus1986,项目名称:LumixEngine,代码行数:12,代码来源:asset_browser.cpp


示例5: beginFrame

	void beginFrame(int32_t _mx, int32_t _my, uint8_t _button, int32_t _scroll, int _width, int _height, char _inputChar, uint8_t _viewId)
	{
		m_viewId = _viewId;

		ImGuiIO& io = ImGui::GetIO();
		if (_inputChar < 0x7f)
		{
			io.AddInputCharacter(_inputChar); // ASCII or GTFO! :(
		}

		io.DisplaySize = ImVec2( (float)_width, (float)_height);

		const int64_t now = bx::getHPCounter();
		const int64_t frameTime = now - m_last;
		m_last = now;
		const double freq = double(bx::getHPFrequency() );
		io.DeltaTime = float(frameTime/freq);

		io.MousePos = ImVec2( (float)_mx, (float)_my);
		io.MouseDown[0] = 0 != (_button & IMGUI_MBUT_LEFT);
		io.MouseDown[1] = 0 != (_button & IMGUI_MBUT_RIGHT);
		io.MouseDown[2] = 0 != (_button & IMGUI_MBUT_MIDDLE);
		io.MouseWheel = (float)(_scroll - m_lastScroll);
		m_lastScroll = _scroll;

#if defined(SCI_NAMESPACE)
		uint8_t modifiers = inputGetModifiersState();
		io.KeyShift = 0 != (modifiers & (entry::Modifier::LeftShift | entry::Modifier::RightShift) );
		io.KeyCtrl  = 0 != (modifiers & (entry::Modifier::LeftCtrl  | entry::Modifier::RightCtrl ) );
		io.KeyAlt   = 0 != (modifiers & (entry::Modifier::LeftAlt   | entry::Modifier::RightAlt  ) );
		for (int32_t ii = 0; ii < (int32_t)entry::Key::Count; ++ii)
		{
			io.KeysDown[ii] = inputGetKeyState(entry::Key::Enum(ii) );
		}
#endif // defined(SCI_NAMESPACE)

		ImGui::NewFrame();
		ImGuizmo::BeginFrame();
		ImGui::PushStyleVar(ImGuiStyleVar_ViewId, (float)_viewId);
	}
开发者ID:Enverex,项目名称:mame,代码行数:40,代码来源:ocornut_imgui.cpp


示例6: ImGui_ImplSDL2_UpdateMousePosAndButtons

static void ImGui_ImplSDL2_UpdateMousePosAndButtons()
{
    ImGuiIO& io = ImGui::GetIO();

    // Set OS mouse position if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
    if (io.WantSetMousePos)
        SDL_WarpMouseInWindow(g_Window, (int)io.MousePos.x, (int)io.MousePos.y);
    else
        io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);

    int mx, my;
    Uint32 mouse_buttons = SDL_GetMouseState(&mx, &my);
    io.MouseDown[0] = g_MousePressed[0] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_LEFT)) != 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.
    io.MouseDown[1] = g_MousePressed[1] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_RIGHT)) != 0;
    io.MouseDown[2] = g_MousePressed[2] || (mouse_buttons & SDL_BUTTON(SDL_BUTTON_MIDDLE)) != 0;
    g_MousePressed[0] = g_MousePressed[1] = g_MousePressed[2] = false;

#if SDL_HAS_CAPTURE_AND_GLOBAL_MOUSE && !defined(__EMSCRIPTEN__) && !defined(__ANDROID__) && !(defined(__APPLE__) && TARGET_OS_IOS)
    SDL_Window* focused_window = SDL_GetKeyboardFocus();
    if (g_Window == focused_window)
    {
        // SDL_GetMouseState() gives mouse position seemingly based on the last window entered/focused(?)
        // The creation of a new windows at runtime and SDL_CaptureMouse both seems to severely mess up with that, so we retrieve that position globally.
        int wx, wy;
        SDL_GetWindowPosition(focused_window, &wx, &wy);
        SDL_GetGlobalMouseState(&mx, &my);
        mx -= wx;
        my -= wy;
        io.MousePos = ImVec2((float)mx, (float)my);
    }

    // SDL_CaptureMouse() let the OS know e.g. that our imgui drag outside the SDL window boundaries shouldn't e.g. trigger the OS window resize cursor.
    // The function is only supported from SDL 2.0.4 (released Jan 2016)
    bool any_mouse_button_down = ImGui::IsAnyMouseDown();
    SDL_CaptureMouse(any_mouse_button_down ? SDL_TRUE : SDL_FALSE);
#else
    if (SDL_GetWindowFlags(g_Window) & SDL_WINDOW_INPUT_FOCUS)
        io.MousePos = ImVec2((float)mx, (float)my);
#endif
}
开发者ID:bkaradzic,项目名称:imgui,代码行数:40,代码来源:imgui_impl_sdl.cpp


示例7: ImVec2

		void NotificationOSDLayer::Draw(RenderWindowOSD* OSD, ImGuiDX9* GUI)
		{
			if (Tick() == false)
				return;

			ImGui::SetNextWindowPos(ImVec2(10, *TESRenderWindow::ScreenHeight - 150));
			ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0);
			ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 0));
			ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0, 0));
			ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
			if (!ImGui::Begin("Notification Overlay", nullptr,
							  ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize |
							  ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings |
							  ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoInputs))
			{
				ImGui::End();
				ImGui::PopStyleVar(4);
				return;
			}

			const Notification& Current = GetNextNotification();
			float RemainingTime = Current.GetRemainingTicks() / (float)Current.Duration;

			ImGui::Text("  %s  ", Current.Message.c_str());
			ImGui::Dummy(ImVec2(10, 15));
			ImGui::ProgressBar(RemainingTime, ImVec2(-1, 1));
			ImGui::End();
			ImGui::PopStyleVar(4);
		}
开发者ID:shadeMe,项目名称:Construction-Set-Extender,代码行数:29,代码来源:RenderWindowOSD.cpp


示例8: ImGui_ImplAllegro5_Init

bool ImGui_ImplAllegro5_Init(ALLEGRO_DISPLAY* display)
{
    g_Display = display;

    // Setup back-end capabilities flags
    ImGuiIO& io = ImGui::GetIO();
    io.BackendFlags |= ImGuiBackendFlags_HasMouseCursors;       // We can honor GetMouseCursor() values (optional)
    io.BackendPlatformName = io.BackendRendererName = "imgui_impl_allegro5";

    // Create custom vertex declaration.
    // Unfortunately Allegro doesn't support 32-bits packed colors so we have to convert them to 4 floats.
    // We still use a custom declaration to use 'ALLEGRO_PRIM_TEX_COORD' instead of 'ALLEGRO_PRIM_TEX_COORD_PIXEL' else we can't do a reliable conversion.
    ALLEGRO_VERTEX_ELEMENT elems[] =
    {
        { ALLEGRO_PRIM_POSITION, ALLEGRO_PRIM_FLOAT_2, IM_OFFSETOF(ImDrawVertAllegro, pos) },
        { ALLEGRO_PRIM_TEX_COORD, ALLEGRO_PRIM_FLOAT_2, IM_OFFSETOF(ImDrawVertAllegro, uv) },
        { ALLEGRO_PRIM_COLOR_ATTR, 0, IM_OFFSETOF(ImDrawVertAllegro, col) },
        { 0, 0, 0 }
    };
    g_VertexDecl = al_create_vertex_decl(elems, sizeof(ImDrawVertAllegro));

    io.KeyMap[ImGuiKey_Tab] = ALLEGRO_KEY_TAB;
    io.KeyMap[ImGuiKey_LeftArrow] = ALLEGRO_KEY_LEFT;
    io.KeyMap[ImGuiKey_RightArrow] = ALLEGRO_KEY_RIGHT;
    io.KeyMap[ImGuiKey_UpArrow] = ALLEGRO_KEY_UP;
    io.KeyMap[ImGuiKey_DownArrow] = ALLEGRO_KEY_DOWN;
    io.KeyMap[ImGuiKey_PageUp] = ALLEGRO_KEY_PGUP;
    io.KeyMap[ImGuiKey_PageDown] = ALLEGRO_KEY_PGDN;
    io.KeyMap[ImGuiKey_Home] = ALLEGRO_KEY_HOME;
    io.KeyMap[ImGuiKey_End] = ALLEGRO_KEY_END;
    io.KeyMap[ImGuiKey_Insert] = ALLEGRO_KEY_INSERT;
    io.KeyMap[ImGuiKey_Delete] = ALLEGRO_KEY_DELETE;
    io.KeyMap[ImGuiKey_Backspace] = ALLEGRO_KEY_BACKSPACE;
    io.KeyMap[ImGuiKey_Space] = ALLEGRO_KEY_SPACE;
    io.KeyMap[ImGuiKey_Enter] = ALLEGRO_KEY_ENTER;
    io.KeyMap[ImGuiKey_Escape] = ALLEGRO_KEY_ESCAPE;
    io.KeyMap[ImGuiKey_A] = ALLEGRO_KEY_A;
    io.KeyMap[ImGuiKey_C] = ALLEGRO_KEY_C;
    io.KeyMap[ImGuiKey_V] = ALLEGRO_KEY_V;
    io.KeyMap[ImGuiKey_X] = ALLEGRO_KEY_X;
    io.KeyMap[ImGuiKey_Y] = ALLEGRO_KEY_Y;
    io.KeyMap[ImGuiKey_Z] = ALLEGRO_KEY_Z;
    io.MousePos = ImVec2(-FLT_MAX, -FLT_MAX);

#if ALLEGRO_HAS_CLIPBOARD
    io.SetClipboardTextFn = ImGui_ImplAllegro5_SetClipboardText;
    io.GetClipboardTextFn = ImGui_ImplAllegro5_GetClipboardText;
    io.ClipboardUserData = NULL;
#endif

    return true;
}
开发者ID:audiohacked,项目名称:imgui,代码行数:52,代码来源:imgui_impl_allegro5.cpp


示例9: aEvent

void GUISelectAdapterWindow::draw(const sf::Vector2u& windowSize) {

    if (!this->isEnabled) return;

    int winFlags = ImGuiWindowFlags_NoMove |
                   ImGuiWindowFlags_NoResize |
                   ImGuiWindowFlags_NoCollapse |
                   ImGuiWindowFlags_NoTitleBar |
                   ImGuiWindowFlags_AlwaysAutoResize;

    // temp bool for state etc

    ImGui::Begin("Select Network Adapter Device", &this->isEnabled, winFlags);

    ImGui::Text("Select Network Adapter Device");

    ImGui::Spacing();
    ImGui::Separator();
    ImGui::Spacing();

    std::vector<AdapterDevice>& adapters = *state.adapters;

    for (unsigned i = 0; i < adapters.size(); i++) {

        ImGui::RadioButton(
            adapters[i].name.c_str(),
            state.selectedAdapter,
            i );

        ImGui::Text(adapters[i].description.c_str());

        ImGui::Spacing();
    }

    ImGui::Separator();
    ImGui::Spacing();
    ImGui::Spacing();

    ImGui::SameLine(ImGui::GetWindowContentRegionMax().x - 55);
    if (ImGui::Button("Select")) {

        Event aEvent(this, EventType::AdapterChosen, *state.selectedAdapter);
        adapterChosenDispatcher.fire(aEvent);
    }

    // center the window
    ImVec2 thisSize = ImGui::GetWindowSize();
    ImGui::SetWindowPos(ImVec2(windowSize.x / 2 - thisSize.x / 2,
                               windowSize.y / 2 - thisSize.y / 2));

    ImGui::End();
}
开发者ID:mridsole,项目名称:supreme-succotash,代码行数:52,代码来源:GUISelectAdapterWindow.cpp


示例10: ImColor

void RoR::DrawImGuiSpinner(float& counter, const ImVec2 size, const float spacing, const float step_sec)
{
    // Hardcoded to 4 segments, counter is reset after full round (4 steps)
    // --------------------------------------------------------------------

    const ImU32 COLORS[] = { ImColor(255,255,255,255), ImColor(210,210,210,255), ImColor(120,120,120,255), ImColor(60,60,60,255) };

    // Update counter, determine coloring
    counter += ImGui::GetIO().DeltaTime;
    int color_start = 0; // Index to GUI_SPINNER_COLORS array for the top middle segment (segment 0)
    while (counter > (step_sec*4.f))
    {
        counter -= (step_sec*4.f);
    }

    if (counter > (step_sec*3.f))
    {
        color_start = 3;
    }
    else if (counter > (step_sec*2.f))
    {
        color_start = 2;
    }
    else if (counter > (step_sec))
    {
        color_start = 1;
    }

    // Draw segments
    ImDrawList* draw_list = ImGui::GetWindowDrawList();
    const ImVec2 pos = ImGui::GetCursorScreenPos();
    const float left = pos.x;
    const float top = pos.y;
    const float right = pos.x + size.x;
    const float bottom = pos.y + size.y;
    const float mid_x = pos.x + (size.x / 2.f);
    const float mid_y = pos.y + (size.y / 2.f);

    // NOTE: Enter vertices in clockwise order, otherwise anti-aliasing doesn't work and polygon is rasterized larger! -- Observed under OpenGL2 / OGRE 1.9

    // Top triangle, vertices: mid, left, right
    draw_list->AddTriangleFilled(ImVec2(mid_x, mid_y-spacing),   ImVec2(left + spacing, top),     ImVec2(right - spacing, top),     COLORS[color_start]);
    // Right triangle, vertices: mid, top, bottom
    draw_list->AddTriangleFilled(ImVec2(mid_x+spacing, mid_y),   ImVec2(right, top + spacing),    ImVec2(right, bottom - spacing),  COLORS[(color_start+3)%4]);
    // Bottom triangle, vertices: mid, right, left
    draw_list->AddTriangleFilled(ImVec2(mid_x, mid_y+spacing),   ImVec2(right - spacing, bottom), ImVec2(left + spacing, bottom),   COLORS[(color_start+2)%4]);
    // Left triangle, vertices: mid, bottom, top
    draw_list->AddTriangleFilled(ImVec2(mid_x-spacing, mid_y),   ImVec2(left, bottom - spacing),  ImVec2(left, top + spacing),      COLORS[(color_start+1)%4]);
}
开发者ID:Speciesx,项目名称:rigs-of-rods,代码行数:49,代码来源:GUIUtils.cpp


示例11: ImGui_ImplGLUT_MouseFunc

void ImGui_ImplGLUT_MouseFunc(int glut_button, int state, int x, int y)
{
    ImGuiIO& io = ImGui::GetIO();
    io.MousePos = ImVec2((float)x, (float)y);
    int button = -1;
    if (glut_button == GLUT_LEFT_BUTTON) button = 0;
    if (glut_button == GLUT_RIGHT_BUTTON) button = 1;
    if (glut_button == GLUT_MIDDLE_BUTTON) button = 2;
    if (button != -1 && state == GLUT_DOWN)
        io.MouseDown[button] = true;
    if (button != -1 && state == GLUT_UP)
        io.MouseDown[button] = false;
}
开发者ID:bkaradzic,项目名称:imgui,代码行数:13,代码来源:imgui_impl_glut.cpp


示例12: ImGui_ImplSDL2_NewFrame

void ImGui_ImplSDL2_NewFrame(SDL_Window* window)
{
    ImGuiIO& io = ImGui::GetIO();
    IM_ASSERT(io.Fonts->IsBuilt());     // Font atlas needs to be built, call renderer _NewFrame() function e.g. ImGui_ImplOpenGL3_NewFrame() 

    // Setup display size (every frame to accommodate for window resizing)
    int w, h;
    int display_w, display_h;
    SDL_GetWindowSize(window, &w, &h);
    SDL_GL_GetDrawableSize(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 (we don't use SDL_GetTicks() because it is using millisecond resolution)
    static Uint64 frequency = SDL_GetPerformanceFrequency();
    Uint64 current_time = SDL_GetPerformanceCounter();
    io.DeltaTime = g_Time > 0 ? (float)((double)(current_time - g_Time) / frequency) : (float)(1.0f / 60.0f);
    g_Time = current_time;

    ImGui_ImplSDL2_UpdateMousePosAndButtons();
    ImGui_ImplSDL2_UpdateMouseCursor();
}
开发者ID:warrenm,项目名称:imgui,代码行数:22,代码来源:imgui_impl_sdl.cpp


示例13: ImGui_ImplNyan_NewFrame

void ImGui_ImplNyan_NewFrame(void)
{
    unsigned int winx, winy;
    int mx, my;
    ImGuiIO &io = ImGui::GetIO();
    wchar_t *inputstr;

    winx = nvGetStatusi(NV_STATUS_WINX);
    winy = nvGetStatusi(NV_STATUS_WINY);

    mx = nvGetStatusi(NV_STATUS_WINMX);
    my = nvGetStatusi(NV_STATUS_WINMY);

    inputstr = nvGetStatusw(NV_STATUS_WINTEXTINPUTBUF);

    io.DisplaySize = ImVec2((float)winx, (float)winy);
    io.DeltaTime = (float)nGetspf();
    io.MousePos = ImVec2((float)mx, (float)my);
    io.MouseDown[0] = (nvGetStatusi(NV_STATUS_WINMBL)==1)?true:false;
    io.MouseDown[1] = (nvGetStatusi(NV_STATUS_WINMBR)==1)?true:false;
    io.MouseDown[2] = (nvGetStatusi(NV_STATUS_WINMBM)==1)?true:false;

    for(int i = 0; i < 256; i++)
        io.KeysDown[i] = (nvGetKey(i) == 1)?true:false;

    io.KeyCtrl = io.KeysDown[NK_CONTROL];
    io.KeyShift = io.KeysDown[NK_SHIFT];
    io.KeyAlt = io.KeysDown[NK_ALT];
    io.KeySuper = io.KeysDown[NK_LWIN] || io.KeysDown[NK_RWIN];

    while(*inputstr) {
        if(*inputstr > 0 && *inputstr < 0x10000)
            io.AddInputCharacter(*inputstr);

        inputstr++;
    }

    ImGui::NewFrame();
}
开发者ID:plzombie,项目名称:ne,代码行数:39,代码来源:imgui_impl_ne.cpp


示例14: dc_debug

extern "C" void dc_debug(void)
{
	static DebugMemoryState memory_ctx_sat;

	ImGui::SetNextWindowPos(ImVec2(0.0f, 0.0f), ImGuiSetCond_FirstUseEver);
	ImGui::Begin("Dreamcast", NULL, ImGuiWindowFlags_NoMove);

	if(ImGui::CollapsingHeader("Memory", NULL, true, true)) {
		static DebugMemoryState memory_state;
		debug_memory("DC RAM", &memory_state, dc_ram, sizeof(dc_ram));
	}
	ImGui::End();
}
开发者ID:nmlgc,项目名称:aosdk,代码行数:13,代码来源:dc_debug.cpp


示例15: ImVec2

void game_system::on_resize_viewport(const uint2& size)
{
	if (size.x == 0 || size.y == 0) {
		viewport_is_visible_ = false;
		return;
	}

	ImGui::GetIO().DisplaySize = ImVec2(float(size.x), float(size.y));

	viewport_is_visible_ = true;
	frame_.projection_matrix = math::perspective_matrix_directx(game_system::projection_fov, 
		aspect_ratio(size), game_system::projection_near, game_system::projection_far);
	render_system_.resize_viewport(size);
}
开发者ID:ref2401,项目名称:SPARKi,代码行数:14,代码来源:game.cpp


示例16: contextModelDelete

void DialogControlsModels::contextModelDelete() {
//    ImGui::SetNextWindowPos(ImGui::GetIO().MouseClickedPos[0]);

    ImGui::OpenPopup("Delete?");

    ImGui::BeginPopupModal("Delete?", NULL, ImGuiWindowFlags_AlwaysAutoResize);

    ImGui::Text("Are you sure?\n");
    //ImGui::Text("(%s)", (*meshModelFaces)[static_cast<size_t>(this->selectedObject)]->meshModel.ModelTitle.c_str());

    if (ImGui::Button("OK", ImVec2(ImGui::GetContentRegionAvailWidth() * 0.5f,0))) {
        this->funcDeleteModel(this->selectedObject);
        ImGui::CloseCurrentPopup();
        this->cmenu_deleteYn = false;
    }
    ImGui::SameLine();
    if (ImGui::Button("No", ImVec2(ImGui::GetContentRegionAvailWidth(),0))) {
        ImGui::CloseCurrentPopup();
        this->cmenu_deleteYn = false;
    }

    ImGui::EndPopup();
}
开发者ID:supudo,项目名称:Kuplung,代码行数:23,代码来源:DialogControlsModels.cpp


示例17: updateInput

void
updateInput()
{
   auto &io = ImGui::GetIO();
   io.MousePos = ImVec2(sMousePosX, sMousePosY);

   for (int i = 0; i < 3; i++) {
      io.MouseDown[i] = sMouseClicked[i] || sMousePressed[i];
      sMouseClicked[i] = false;
   }

   io.MouseWheel = sMouseWheel;
   sMouseWheel = 0.0;
}
开发者ID:achurch,项目名称:decaf-emu,代码行数:14,代码来源:debugger_ui.cpp


示例18: _VenomModuleLoad

extern "C" void _VenomModuleLoad(GameMemory *memory) {
#ifdef VENOM_HOTLOAD
#define _(returnType, name, ...) name = memory->engineAPI.name;
EngineAPIList
#undef _
#define _(signature, name) name = memory->engineAPI.name;
#include "opengl_procedures.h"
#undef _ 
#endif//VENOM_HOTLOAD
	
	ImGuiIO& io = ImGui::GetIO();
  
	SystemInfo *system = &memory->systemInfo;
  io.KeyMap[ImGuiKey_Enter] = KEYCODE_ENTER;
	io.KeyMap[ImGuiKey_Escape] = KEYCODE_ESCAPE;
	io.KeyMap[ImGuiKey_Tab] = KEYCODE_TAB;
	io.KeyMap[ImGuiKey_Backspace] = KEYCODE_BACKSPACE;
	io.KeyMap[ImGuiKey_LeftArrow] = KEYCODE_LEFT;
	io.KeyMap[ImGuiKey_RightArrow] = KEYCODE_RIGHT;
	io.KeyMap[ImGuiKey_DownArrow] = KEYCODE_DOWN;
	io.KeyMap[ImGuiKey_UpArrow] = KEYCODE_UP;

  io.KeyMap[ImGuiKey_A] = KEYCODE_A;
  io.KeyMap[ImGuiKey_C] = KEYCODE_C;
  io.KeyMap[ImGuiKey_V] = KEYCODE_V;
  io.KeyMap[ImGuiKey_X] = KEYCODE_X;
  io.KeyMap[ImGuiKey_Y] = KEYCODE_Y; 
  io.KeyMap[ImGuiKey_Z] = KEYCODE_Z; 
  memory->keyEventCallback = HackVenomKeyEventCallback;

	io.RenderDrawListsFn = RenderImGuiDrawList;
	io.DisplaySize = ImVec2(system->screenWidth, system->screenHeight);
	io.UserData = memory;

  U8* pixels;
  int width, height, components;
  //io.Fonts->AddFontFromFileTTF("/usr/share/fonts/TTF/DejaVuSans.ttf", 14);
  io.Fonts->GetTexDataAsRGBA32(&pixels, &width, &height, &components);
	io.Fonts->TexID = (void *)(size_t)memory->renderState.imguiFontTexture;

#if 0
  { //Reload the MaterialList Why the hell are we doing this?
    MaterialAssetList* list = &memory->assets.materialAssetList;
    LoadMaterialList(list);
  }
#endif

  InitalizeEditor(&memory->editor);
  VenomModuleLoad(memory);
}
开发者ID:Twiebs,项目名称:venom,代码行数:50,代码来源:venom_module.cpp


示例19: RESOLVE_DEPENDENCY

bool GameLoopSystem::startup() {
  RESOLVE_DEPENDENCY(m_settings);
  RESOLVE_DEPENDENCY(m_events);
  RESOLVE_DEPENDENCY(m_window);
  RESOLVE_DEPENDENCY(m_renderer);
  RESOLVE_DEPENDENCY(m_audio);

  m_targetFrameRate = m_settings->getTargetFps();

  m_events->subscribe<"DrawUI"_sh>([this] {
    static bool opened = true;
    ImGui::SetNextWindowPos(ImVec2(10, 10));
    if (!ImGui::Begin("Frame Statistics", &opened, ImVec2(275, 0), 0.3f, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings)) {
      ImGui::End();
      return;
    }

    static auto prev = SDL_GetPerformanceCounter();
    auto now = SDL_GetPerformanceCounter();

    static int frameTimeIndex = 0;
    double totalFrameTime = (double)((now - prev)*1000) / SDL_GetPerformanceFrequency();
    prev = now;

    m_frameTimeHistory[frameTimeIndex] = (float)totalFrameTime;
    frameTimeIndex = (frameTimeIndex + 1) % m_frameTimeHistory.size();
    
    ImGui::Text("FPS:          %d", (int)(1000.0f/(totalFrameTime)));
    ImGui::Separator();
    ImGui::PlotHistogram("", m_frameTimeHistory.data(), m_frameTimeHistory.size(), 0, NULL, 0, 100, glm::vec2(250, 100));
    ImGui::Separator();
    ImGui::Text("Mouse Position: (%.1f,%.1f)", ImGui::GetIO().MousePos.x, ImGui::GetIO().MousePos.y);
    ImGui::End();
  });

  return true;
}
开发者ID:daseyb,项目名称:pro-se-cg,代码行数:37,代码来源:GameLoopSystem.cpp


示例20: UpdateImGui

void UpdateImGui()
{
	ImGuiIO& io = ImGui::GetIO();

	// Setup resolution (every frame to accommodate for window resizing)
	io.DisplaySize = ImVec2((float)800, (float)400); 

	// Setup time step
	static double time = 0.0f;
	const double current_time = SDL_GetTicks() / 1000.0;
	if (current_time == time)
		return;
	io.DeltaTime = (float)(current_time - time);
	time = current_time;

	io.MousePos = ImVec2((float)gUIState.mousex, (float)gUIState.mousey);
	io.MouseDown[0] = gUIState.mousedown != 0;
	io.MouseDown[1] = 0;

	if (gUIState.scroll)
	{
		io.MouseWheel += (float)gUIState.scroll * 0.5f;
		gUIState.scroll = 0;
	}

	if (gUIState.textinput[0])
	{
		io.AddInputCharactersUTF8(gUIState.textinput);
		gUIState.textinput[0] = 0;
	}

	for (int n = 0; n < 256; n++)
		io.KeysDown[n] = gPressed[n] != 0;
    io.KeyShift = ((SDL_GetModState() & KMOD_SHIFT) != 0);
    io.KeyCtrl = ((SDL_GetModState() & KMOD_CTRL) != 0);
    io.KeyAlt = ((SDL_GetModState() & KMOD_ALT) != 0);
}
开发者ID:Itaros,项目名称:soloud,代码行数:37,代码来源:soloud_demo_framework.cpp



注:本文中的ImVec2函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ImageKey函数代码示例发布时间:2022-05-30
下一篇:
C++ IllegalArgumentException函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap