Jump to content

Pixmap WritePixel() Error


SpiderPig
 Share

Go to solution Solved by Josh,

Recommended Posts

I'm getting a popup error when writing the pixels of a non-square pixmap.  This program crashes when x = 8 and y = 0.  I assume its just testing the x value against the y size.

#include "UltraEngine.h"
#include "ComponentSystem.h"
using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    auto displays = GetDisplays();
    auto window = CreateWindow("Ultra Engine", 0, 0, 1440, 900, displays[0]);
    auto framebuffer = CreateFramebuffer(window);
    auto world = CreateWorld();

    auto camera = CreateCamera(world);
    camera->Move(0, 2, -3);
    camera->SetClearColor(1, 0, 0);

    auto light = CreateDirectionalLight(world);
    light->SetRotation(35, 35, 35);

    auto floor = CreateBox(world, 100.0f, 0.5f, 100.0f);

    auto default_font = LoadFont("Fonts\\arial.ttf");
    auto ui = CreateInterface(world, default_font, framebuffer->size);
    ui->SetRenderLayers(2);
    ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f);

    auto ui_camera = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
    ui_camera->SetPosition((float)framebuffer->size.x * 0.5f, (float)framebuffer->size.y * 0.5f, 0);
    ui_camera->SetRenderLayers(2);
    ui_camera->SetClearMode(CLEAR_DEPTH);

    auto pixmap = CreatePixmap(16, 8);
    for (int y = 0; y < 8; y++) {
        for (int x = 0; x < 16; x++) {
            pixmap->WritePixel(x, y, 0);
        }
    }

    while (window->KeyHit(KEY_ESCAPE) == false && window->Closed() == false)
    {
        while (PeekEvent()) {
            ui->ProcessEvent(WaitEvent());
        }

        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

  • Confused 1
Link to comment
Share on other sites

  • SpiderPig changed the title to Pixmap WritePixel() Error

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