Jump to content

Crash on window recreate in game


Go to solution Solved by Josh,

Recommended Posts

Posted

For now can reproduce only in my game:

1. Load any map.

2. Open settings and switch full screen or just change resolution

3. On apply game crash with errors on screenshot (no my code in call stack). Window recreate used to work without problems before.

image.thumb.png.41581185c87614bbae91a50ba0506271.pngCr

Check out Slipgate Tactics - turn based tactics Quake fan game, which is made with Ultra Engine/Leadwerks 5:

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

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 - turn based tactics Quake fan game, 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...