Jump to content

Window::Show() should force closestate to true.


reepblue
 Share

Recommended Posts

Fix this so I don't have to hack it. If you're not going to fix this in Leadwerks, definitely apply this in the new engine if you didn't already!

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void ConsoleWindow::Update()
{
	//if (m_pWindow->KeyHit(KEY_END) || m_pWindow->Closed()) App::Shutdown();

	if (m_pWindow->Closed())
	{
		m_pWindow->Hide();
	}

	if (m_pWindow->GetHidden()) return;

	....
}

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void WinApp::UpdateConsoleWindow()
{
#if defined (USE_INPUTCOMMANDS) && (LEADWERKS_3_1) // TEMP
	if (m_pConsoleWindow != NULL)
	{
		m_pConsoleWindow->Update();
		if (m_pWindow->KeyHit(Key::Tilde) && m_pConsoleWindow->GetEngineWindow()->GetHidden())
		{
			// HACK: set the window's closestate to false so it stays open.
			m_pConsoleWindow->GetEngineWindow()->closestate = false;
			m_pConsoleWindow->GetEngineWindow()->Show();
		}
	}
#endif
}

 

  • Like 1
  • Thanks 1

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

Closing and hiding are not necessarily the same thing though. You probably want to use events for any kind of advanced window handling.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Yeah but at-least for Leadwerks 4, there isn't a event polling for the Window class. If you take the line forcing the member to be true, the window would show for a split second before closing again. What I have now works really well, it's just that I'm worried I'll not have a way to implement this in the new engine as the members of most classes are private. 

  • Like 1

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

3 hours ago, Josh said:

If anything, I think calling window::Closed() should reset the state, like how MouseHit does.

That's weird and not clear. There should be window::Open() then. 

I'll try that, however.

  • Like 1

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

No, I am talking about behavior I could change. Right now, the window has one Closed() state that is set to true forever if the user ever closes it.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...