Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: SDL/SDLx issue with application resizing

by Athanasius (Archbishop)
on Jan 31, 2019 at 13:42 UTC ( [id://1229198]=note: print w/replies, xml ) Need Help??


in reply to SDL/SDLx issue with application resizing

Hello Garden Dwarf,

As soon as I release the mouse button, the application ends without any message (window is closing, and I get back to the terminal prompt).

I get the same result, except that I do get a message on the command terminal:

23:34 >perl 1972_SoPW.pl SDL cannot set video:DDraw created surface with wrong pitch at C:/Perl +/Strawberry/strawberry-perl-ld-5.26.0.1-64bit-PDL/perl/site/lib/SDLx/ +App.pm line 146. 23:34 >

My platform:

  • Windows 8.1, 64-bit
  • Strawberry Perl 5.26.0
  • SDL 2.546

Hope that information helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: SDL/SDLx issue with application resizing
by Garden Dwarf (Beadle) on Jan 31, 2019 at 14:02 UTC

    Hello Athanasius,

    Thank you for your time, it helped me to verify that my installation is not corrupted. I guess now I have to find how to manage the application resizing properly, and despite my researches I wasn't able to find an example.

    By the way, I noticed that I have the same message appearing but not each time. Weird.

    If someone has succeeded into this previously, it would be nice to share some lines of code now. Thanks :)

      In SDL::Event I found this:

      Window resize events resize_w, resize_h When SDL_RESIZABLE is passed as a flag to SDL_SetVideoMode the user is + allowed to resize the applications window. When the window is resized an SDL_VIDEORESIZE is reported, with the new window width and height values stored in the resize structure's resize_w and resize_h. When an + SDL_VIDEORESIZE is received the window should be resized to the new dimensions using SDL_SetVideoMode.

      In your program it looks like you have everything except the last part where it says to use SDL_SetVideoMode.

      I couldn't find any examples that use that but I did find an example included in SDL called examples/cookbook/1.pl that uses SDL::Video::set_video_mode(320, 320, 32, SDL_SWSURFACE );

      The documentation for SDL::Video::set_video_mode() shows that function seems to be what you need:

      SDL_RESIZABLE Create a resizable window. When the window is resized by the user a SDL_VIDEORESIZE event is generated and SDL::Video::set_video_mode can be called again with the new size.

      There are more details there on how to call SDL::Video::set_video_mode().

      Your application looks interesting. Let us know how it works out. Good luck!

      Update:

      After looking at your application again and looking at the contents of App.pm I notice the resize() function you use calls SDL::Video::set_video_mode() so it seems like you've done it correctly. My comments above were not very helpful it seems.

        Hello Lotus1,

        Thanks for having tried, I appreciate :)

        The error message above suggest an issue with DirectDraw (DDraw), maybe something related with the driver. I'll look at this, but first queries on Google do not return much answers. Stay tuned.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1229198]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2024-03-28 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found