Strange behavior when running irrlicht at lo-res

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
AlexAzazel
Posts: 31
Joined: Sun Jan 10, 2016 3:42 pm
Location: Tbilisi

Strange behavior when running irrlicht at lo-res

Post 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
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Strange behavior when running irrlicht at lo-res

Post 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).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
AlexAzazel
Posts: 31
Joined: Sun Jan 10, 2016 3:42 pm
Location: Tbilisi

Re: Strange behavior when running irrlicht at lo-res

Post 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?
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Strange behavior when running irrlicht at lo-res

Post by CuteAlien »

IVideoDriver:.getScreenSize is probably what you want.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply