Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Undesired texture stretching (wxWidgets+SFML 2.0)  (Read 1427 times)

0 Members and 1 Guest are viewing this topic.

SpectreNectar

  • Newbie
  • *
  • Posts: 39
    • View Profile
Undesired texture stretching (wxWidgets+SFML 2.0)
« on: November 05, 2012, 01:37:36 pm »
Hi,

I'm somewhat of a beginner in both wxWidgets and SFML but here goes:

I'm making a level editor and have made a small part of it that scans a directory for tilesets and then shows one of them in a wxWindow. Problem is, whenever I change the tile graphics it gets stretched (see attachment).

The tiles are supposed to be 32x24 pixels. The stretch happen after calling SetClientSize in this function:

void MyPalette::pickTileset(int num) {

    if(num<tileset_max && num>=0) {
        tileset_n = num;

        int w, h;
            w = myTilesets[num].getSize().x;
            h = myTilesets[num].getSize().y;

        cols = (w+width-1)/width;
        rows = (h+height-1)/height;
        cells = cols*rows;

        wxWindow::SetClientSize(wxSize(w, h));

        wxScrolledWindow* par = (wxScrolledWindow*) GetParent();
        //if(par!=0) par->SetScrollbars(1, 1, event.GetSize().x, event.GetSize().y);
    }
}

(initial size is 800x600 which looks fine)

[attachment deleted by admin]

 

anything