Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Recommended Posts

Isn't there more differences with the settings besides the compiler?  I recall  there being other things I had to change when I was writing my project builder for the new engine.

For the record, I imported UAK to Leadwerks, and not the other way around. 

Link to post
Share on other sites

I successfully compiled a project that includes both. Add this code to the end of App.h in a new Leadwerks project:

#undef GMF_FLOAT
#undef GMF_DOUBLE
#undef COPY_INSTANCE
#undef COPY_DUPLICATE
#undef CLEAR_COLOR
#undef CLEAR_DEPTH
#undef LUA_VERSION
#undef STREAM_READ
#undef STREAM_WRITE

//Include header file
#define _ULTRA_APPKIT
#include "C:\\Program Files (x86)\\Steam\\\steamapps\\common\\Ultra App Kit\\Include\\UltraEngine.h"

//Compile library into project
#ifdef _WIN32
#ifdef _DEBUG
#pragma comment (lib, "C:\\Program Files (x86)\\Steam\\\steamapps\\common\\Ultra App Kit\\Libs\\win32\\App Kit_d.lib")
#else
#pragma comment (lib, "C:\\Program Files (x86)\\Steam\\\steamapps\\common\\Ultra App Kit\\Libs\\win32\\App Kit.lib")
#endif  
#endif

And add this to the header search paths:

C:\\Program Files (x86)\\Steam\\\steamapps\\common\\Ultra App Kit\Include

That's all! It will work. Use VS2019.

UAKTest.rar

  • Thanks 1
Link to post
Share on other sites

Well, it works but the scene only updates if the mouse is moving. Not sure if I'm doing this correctly, but it's still neat.

image.thumb.png.f14f720f20edc50f6d484e36ae6a9abf.png

#include "App.h"

int main()
{
	UltraEngine::Print("Hello world!");

	auto display = UltraEngine::ListDisplays();
	shared_ptr<UltraEngine::Window> mainwindow = UltraEngine::CreateWindow("Leadwerks + UAK", 0, 0, 1024, 768, display[0], UltraEngine::WINDOW_TITLEBAR | UltraEngine::WINDOW_RESIZABLE);

	//Create User Interface
	auto ui = CreateInterface(mainwindow);
	auto sz = ui->root->ClientSize();

	//Create widget
	//auto panel = CreatePanel(50, 50, sz.x - 100, sz.y - 100, ui->root);

	shared_ptr<UltraEngine::Window> leadwerkswindow = UltraEngine::CreateWindow("Leadwerks + UAK", 0, 0, 800, 600, mainwindow, UltraEngine::WINDOW_CHILD);
	Leadwerks::Window* lewindow = Leadwerks::Window::Create(leadwerkswindow->GetHandle());
	Leadwerks::Context* context = Leadwerks::Context::Create(lewindow);
	Leadwerks::World* world = World::Create();
	lewindow->SetActive();

	auto button = CreateButton("Button", 850, 200, 120, 30, ui->root);

	if (!Map::Load("Maps/start.map"))
		return 1;

	while (!mainwindow->KeyHit(UltraEngine::KEY_END))
	{
		if (mainwindow->Closed())
			break;

		Leadwerks::Time::Update();
		world->Update();
		world->Render();

		context->DrawStats(2, 2, true);
		context->Sync(false);

		const UltraEngine::Event ev = UltraEngine::WaitEvent();
		if (ev.id == UltraEngine::EVENT_WIDGETACTION)
		{
			if (ev.source == button) UltraEngine::Print("I'm still active!");
		}

	}

	return 0;
}

 

Something simple like this seems to work fine.

#include "App.h"

int main()
{
	UltraEngine::Print("Hello world!");

	auto display = UltraEngine::ListDisplays();
	shared_ptr<UltraEngine::Window> mainwindow = UltraEngine::CreateWindow("Leadwerks + UAK", 0, 0, 1024, 768, display[0], UltraEngine::WINDOW_TITLEBAR);
	Leadwerks::Window* lewindow = Leadwerks::Window::Create(mainwindow->GetHandle());
	Leadwerks::Context* context = Leadwerks::Context::Create(lewindow);
	Leadwerks::World* world = World::Create();
	lewindow->SetActive();

	if (!Map::Load("Maps/start.map"))
		return 1;

	while (!mainwindow->KeyHit(UltraEngine::KEY_END))
	{
		if (mainwindow->Closed())
			break;

		Leadwerks::Time::Update();
		world->Update();
		world->Render();

		context->DrawStats(2, 2, true);
		context->Sync(false);
	}
}

The only benefit of doing this is tools and having more control over multiple monitors. For some reason I was thinking I could easily draw images to the context, but that's a whole different thing.

Still really, cool. Maybe you should test the app kit by redoing the Leadwerks Editor. This way you have a bridge/starting point for the new editor maybe. 

Link to post
Share on other sites
4 minutes ago, reepblue said:

Still really, cool. Maybe you should test the app kit by redoing the Leadwerks Editor. This way you have a bridge/starting point for the new editor maybe. 

https://media1.giphy.com/media/SdYnnxQ30OahG/200.gif

  • Sad 1
Link to post
Share on other sites

Use this code in your main loop:

	while (UltraEngine::PeekEvent())
	{
		const UltraEngine::Event ev = UltraEngine::WaitEvent();
		if (ev.id == UltraEngine::EVENT_WIDGETACTION)
		{
			if (ev.source == button) UltraEngine::Print("I'm still active!");
		}
	}

 

  • Thanks 1
Link to post
Share on other sites

Does UAK have any functionality for changing the font of your GUI? I've been perusing through the documentation and can't seem to find any hint of loading a new font. I saw freetype in the dependencies so I assume it can be done but maybe not through UAK 🤔

Link to post
Share on other sites
47 minutes ago, SlipperyBrick said:

Does UAK have any functionality for changing the font of your GUI? I've been perusing through the documentation and can't seem to find any hint of loading a new font. I saw freetype in the dependencies so I assume it can be done but maybe not through UAK 🤔

Not yet. The DPI scaling made this a little tricky. There is a command to change the font scale for a widget, and it will give consistent results no matter what DPI is in use.

  • Thanks 1
Link to post
Share on other sites
21 minutes ago, Josh said:

Not yet. The DPI scaling made this a little tricky. There is a command to change the font scale for a widget, and it will give consistent results no matter what DPI is in use.

Ok the "not yet" has me hopeful haha. Yeah I saw the SetFontScale(), I'll just hang in there for now and wait for further developments 😎

  • Like 1
Link to post
Share on other sites

An update is available on Steam that fixes a bug with treeview sliders, where dragging the slider knob would not work correctly. I believe this was the only bug that exists in the library.

Link to post
Share on other sites
4 hours ago, Robert_d1968 said:

So now, my programs name is Ultra App Kit instead of Ultra Engine.

Are you merging them?

I don't understand what this means. What program is this? Where is the name?

Link to post
Share on other sites
4 hours ago, Robert_d1968 said:

PS. is there any game made with this as of yet? If so I would like to see some source code as I learn faster from that.

Ultra App Kit is not for making games, it is just for making GUI applications. Leadwerks Game Engine is our current game engine. Ultra Engine is in development and will include all the functionality of Ultra App Kit (except for 32-bit builds).

Link to post
Share on other sites

Hello, firstly thanks a lot for this amazing framework. Now my question is;

I'm starting a notepad process everytime I press a button, I push_back the process handle to a vector and update a label and show the current number of the vector's size. Like this;

auto proc = CreateProcess("C:/Windows/notepad.exe");
procList.push_back(proc);
label1->SetText(procList.size());

Now, when the user clicks the close button of any notepad window opened by the app, I want to catch this, close that process and remove it from the vector and update the label with current number.  I don't want to periodically check the status of every process in the vector. Is there a way to emit an event every time a notepad child process closed externally? In other words instead of polling the status of the process, I want to be notified when the status is changed.

Link to post
Share on other sites

Hmmmm, check out this code example:
https://stackoverflow.com/questions/3556048/how-to-detect-win32-process-creation-termination-in-c

It looks like something like that might work:

VOID CALLBACK WaitOrTimerCallback(
    _In_  PVOID lpParameter,
    _In_  BOOLEAN TimerOrWaitFired
    )
{
    MessageBox(0, L"The process has exited.", L"INFO", MB_OK);
    return;
}

DWORD dwProcessID = 1234;
HANDLE hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessID);

HANDLE hNewHandle;
RegisterWaitForSingleObject(&hNewHandle, hProcHandle , WaitOrTimerCallback, NULL, INFINITE, WT_EXECUTEONLYONCE);

I am adding a Process::GetHandle() method now so you can gain access to the win32 process handle.

  • Thanks 2
Link to post
Share on other sites

Yeah, the advantage is that this can be used by separate pieces of code, so you don't have to worry about two different code files using the same constant for the event ID like you would if you did this:

const EventID EVENT_PROCESSCLOSE = 1000;

 

Link to post
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.

×
×
  • Create New...