Jump to content

Recommended Posts

  • Honorable Member

This is the hidden content, please

This is the hidden content, please

.jpg

 

 Library:

Spoiler

This is the hidden content, please
 (v1.92.3-docking)

 

Edited by Mali
  • Metin2 Dev 197
  • Good 28
  • Love 3
  • Love 55

 

Link to comment
https://metin2.dev/topic/31240-imgui-library-support/
Share on other sites

  • 3 weeks later...
  • 2 months later...
  • Honorable Member

UPDATE:

  • DirectX 8 Support.
  • WantCaptureMouse, WantCaptureKeyboard fixes.

 

 

Known Problems:

  • Directx 8 doesn't support D3DRS_SCISSORTESTENABLE.
  • You cannot take Imgui off screen in DirectX 8 version.
Edited by Mali
  • Metin2 Dev 6
  • Love 1

 

Link to comment
https://metin2.dev/topic/31240-imgui-library-support/#findComment-161632
Share on other sites

  • Premium

Wanted to point out that on device reset, you might get your whole client frozen. That happens because the imgui's objects aren't invalidated & created again.

To fix it, use Imgui's own implementations inside CGraphicDevice::Reset:

 

bool CGraphicDevice::Reset()
{
	HRESULT hr;
	if (FAILED(hr = ms_lpd3dDevice->TestCooperativeLevel()))
	{
		if (hr == D3DERR_DEVICELOST)
			return false;
		
		if (hr == D3DERR_DEVICENOTRESET)
		{
			__DestroyPDTVertexBufferList();
			ImGui_ImplDX9_InvalidateDeviceObjects();
			
			if (FAILED(hr = ms_lpd3dDevice->Reset(&ms_d3dPresentParameter))) {
				TraceError("Failed to reset device");
				return false;
			}
			
			m_pStateManager->SetDefaultState();
			if (!__CreatePDTVertexBufferList())
				return false;
			
			ImGui_ImplDX9_CreateDeviceObjects();
		}
	}
	
	return true;
}


Don't forget to include imgui.h and imgui_impl_dx9.h (or imgui_impl_dx8.h depending on what you're using)

Edited by dumita123
  • Love 1
Link to comment
https://metin2.dev/topic/31240-imgui-library-support/#findComment-161719
Share on other sites

  • 1 month later...
  • Active+ Member

Hi Mali, first of all, this is super cool, thank you. I noticed a problem with this.

If you click on ImGui window, you can't open ESC menu on Release client or directly close the game on Debug client using the X button of Metin2 window anymore.

Link to comment
https://metin2.dev/topic/31240-imgui-library-support/#findComment-162930
Share on other sites

  • 1 year later...
  • Honorable Member

It became very popular, it used a lot (It's not nice to remove my name from the credits 🙄)

UPDATE:

  • v1.89.9 WIP -> v1.92.3 
  • Thanks to ChatGPT for imgui_impl_dx8 (DirectX-9+ is still highly recommended)

 

.png

  • Metin2 Dev 9
  • Love 3

 

Link to comment
https://metin2.dev/topic/31240-imgui-library-support/#findComment-172312
Share on other sites

  • 3 months later...
  • Active+ Member
On 2/2/2024 at 11:30 PM, Kaptan Yosun said:

Hi Mali, first of all, this is super cool, thank you. I noticed a problem with this.

If you click on ImGui window, you can't open ESC menu on Release client or directly close the game on Debug client using the X button of Metin2 window anymore.

Fix:
// Edited again, we just need to change the order the logic

We’re capturing the mouse before checking ImGui, so when ImGui consumes the click, capture is never released, breaking the title bar close button.


Find

		case WM_LBUTTONDOWN:
#ifdef __BL_IMGUI__
			if (GetCapture() != hWnd)
				SafeSetCapture();
			
			if (ImGui::GetIO().WantCaptureMouse)
				return 0;
#else
			SafeSetCapture();
#endif

Change

		case WM_LBUTTONDOWN:
#ifdef __BL_IMGUI__
            if (ImGui::GetIO().WantCaptureMouse)
                return 0;

            if (GetCapture() != hWnd)
                SafeSetCapture();
#else
            SafeSetCapture();
#endif

 

Find

		case WM_LBUTTONUP:
#ifdef __BL_IMGUI__
			if (GetCapture() != hWnd)
				SafeSetCapture();
			
			if (ImGui::GetIO().WantCaptureMouse)
				return 0;
#endif

Change

		case WM_LBUTTONUP:
#ifdef __BL_IMGUI__
            if (ImGui::GetIO().WantCaptureMouse)
                return 0;

            if (GetCapture() != hWnd)
                SafeSetCapture();
#endif

 

Edited by Kaptan Yosun
Clarification
Link to comment
https://metin2.dev/topic/31240-imgui-library-support/#findComment-174132
Share on other sites

  • 4 weeks later...

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.