Jump to content

Pixmap->Resize() changes color of some images


Dreikblack
 Share

Go to solution Solved by Josh,

Recommended Posts

After resizing icon of yellow armor becomes a blue one. Red also becomes blue. Green stays green. Used to be fine several months ago.

#include "UltraEngine.h"
#include "ComponentSystem.h"

using namespace UltraEngine;


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

shared_ptr<Widget> panel;
shared_ptr<Widget> panel2;

bool isFirst = true;

void initGui()
{
    auto default_font = LoadFont("Fonts\\arial.ttf");
    ui = CreateInterface(world, default_font, framebuffer->GetSize());
    ui->SetRenderLayers(2);
    ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f);
    uiCamera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
    uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0);
    uiCamera->SetRenderLayers(2);
    uiCamera->SetClearMode(CLEAR_DEPTH);

    panel = CreatePanel(10, 10, 50, 50, ui->root, PANEL_DEFAULT);
    panel2 = CreatePanel(10, 70, 100, 100, ui->root, PANEL_DEFAULT);

    auto pixmap = LoadPixmap("/gfx/items.wad/armor2");//yellow armor
    panel->SetPixmap(pixmap);
    auto pixmap2 = pixmap->Resize(pixmap->size.x * 1.5f, pixmap->size.y * 1.5f);//blue now O_o
    panel2->SetPixmap(pixmap2);
}

int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    window = CreateWindow("Ultra Engine", 0, 0, 300, 300, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

    //Create a world
    world = CreateWorld();
    world->SetAmbientLight(0);

    //Create a framebuffer
    framebuffer = CreateFramebuffer(window);

    //Load FreeImage plugin
    auto plg = LoadPlugin("Plugins/FITextureLoader");
    auto quakeLoaderPlugin = LoadPlugin("Plugins/QuakeLoader");

    //Load model
    WString path = AppDir();
    auto pak = LoadPackage(path + "/PAK0.PAK");
    ChangeDir(path);


    //Create a camera    
    auto camera = CreateCamera(world);
    camera->SetClearColor(0, 0, 0);
    camera->Move(0, 0, -0.3);
    camera->SetRange(0.01, 100);
    camera->SetFov(70);

    initGui();

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

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