Jump to content

Recommended Posts

Posted

Managed to make an example with same error, which happen with "btn->SetPixmap(pixmap);":

#include "Leadwerks.h"

using namespace Leadwerks;

shared_ptr<Interface> ui;
shared_ptr<Camera> camera;
shared_ptr<Framebuffer> framebuffer;
shared_ptr<Window> window;
shared_ptr<World> world;

void initWindow() {
    auto displays = GetDisplays();
    window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0]);
    framebuffer = CreateFramebuffer(window);
}

void initGui() {
    camera = CreateCamera(world);
    camera->SetPosition(0, 0, -3);
    auto font = LoadFont("Fonts/arial.ttf");
    ui = CreateInterface(camera, font, framebuffer->size);
    ui->background->SetColor(0, 0, 0, 0.5);

    iVec2 sz = ui->background->ClientSize();
    auto btn = CreateButton("Button", sz.x / 2 - 75, sz.y / 2 - 15, 150, 30, ui->background);

    auto pixmap = CreatePixmap(100, 1000);
    btn->SetPixmap(pixmap);
}

int main(int argc, const char* argv[]) {
    initWindow();
    world = CreateWorld();
    initGui();
   
    while (true) {
        while (PeekEvent()) {
            const Event ev = WaitEvent();
            switch (ev.id) {
            case EVENT_WINDOWCLOSE:
                if (ev.source == window) {
                    return 0;
                }
                break;
            default:
                ui->ProcessEvent(ev);
                break;
            }
        }
        if (window && window->KeyHit(KEY_SPACE)) {
            initWindow();
            initGui();
        }
        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

Check out Slipgate Tactics demo, which is made with Ultra Engine/Leadwerks 5:

https://www.leadwerks.com/community/topic/61480-slipgate-tactics-demo/

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...