Page 1 of 1

Strange behavior when running irrlicht at lo-res

Posted: Sat Jul 09, 2016 11:06 am
by AlexAzazel
TL;Didn't read
I can't create a window that is small like 80x80 or anything in that range or smaller apparently does set the y axis as I ask it to but it doesn't set the x axis smaller than some value. Why is that? Can I still do it in some other way?

TL;Don't read
When I set resolution dimensions of device below some point, 80x80 for example

Code: Select all

const int X = 80;
IrrlichtDevice *device =
createDevice(driverType, core::dimension2d<u32>(X,X), 32, false);
then take screenshots in the game like this

Code: Select all

video::IImage *screenShot = driver->createScreenShot();
const uint8_t *source = (uint8_t*)screenShot->lock();
saveSource(source, X);
screenShot->drop();
Where

Code: Select all

void saveSource(const uint8_t *source, const int X)
{
    int xx;
    int yy;
    std::ofstream myfile(".../Source.txt");
    for (int c = 0; c < X * X; c++)
    {
        yy = c / X;
        xx = c - (c / X) * X;
        myfile << (float) source[4*(X*xx + yy)] << std::endl; // [4*(128*xx + yy)] 
    }
    myfile.close();
    print("saved!")
}
and then recover image in Matlab

Code: Select all

load('Source.txt')
V = reshape(Source,[80,80]);
imagesc(V)
I can't recover the image since it has more pixels on the x axis than what I set it to be, 80.

Image

Re: Strange behavior when running irrlicht at lo-res

Posted: Sat Jul 09, 2016 11:22 am
by CuteAlien
This is a restriction in Windows itself. You can't make smaller Window unless you override some system message (can't remember which one right now). The minimum size even increased for Windows 10 (I think around 130 pixel is the minimum width now - so your 128 pixel should also no longer work with Windows 10).

edit: If that's important we could maybe override that message in Irrlicht - I don't really see much of a problem with it. Just have to figure out again which one it was (I had that problem recently, but forget again already which WM_message was responsible... maybe WM_SIZING)

edit2: Figured out the message again. It's WM_GETMINMAXINFO. But would only change it in svn trunk - don't want to do that in 1.8 branch (might change behavior for existing apps... and I've already spend all monring working on the next 1.8 release and don't want to start again from beginning).

Re: Strange behavior when running irrlicht at lo-res

Posted: Sat Jul 09, 2016 2:18 pm
by AlexAzazel
CuteAlien wrote:This is a restriction in Windows itself. You can't make smaller
If you could change it in next versions it would be great but for now I think I could just cut screenshot and that will work, I'm just struggling to figure out what the exact size my windows is. What's the function that will getWindowResolution of my IrrlichtDevice?

Re: Strange behavior when running irrlicht at lo-res

Posted: Sat Jul 09, 2016 2:57 pm
by CuteAlien
IVideoDriver:.getScreenSize is probably what you want.