The OpenD Programming Language

Resizability

When you create a SimpleWindow, you can see its resizability to be one of these via the constructor...

Values

ValueMeaning
fixedSize

the window cannot be resized. If it is resized anyway, simpledisplay will position and truncate your drawn content without necessarily informing your program, maintaining the API illusion of a non-resizable window.

allowResizing

the window can be resized. The buffer (if there is one) will automatically adjust size, but not stretch the contents. the windowResized delegate will be called so you can respond to the new size yourself. This allows most control for both user and you as the library consumer, but you also have to do the most work to handle it well.

allowResizingMaintainingAspectRatio
Planned for the future but not implemented.

Allow the user to resize the window, but try to maintain the original aspect ratio of the client area. The simpledisplay library may letterbox your content if necessary but will not stretch it. The windowResized delegate and width and height members will be updated with the size.

History: Added November 11, 2022, but not yet implemented and may not be for some time.

automaticallyScaleIfPossible

If possible, your drawing buffer will remain the same size and simply be automatically scaled to the new window size, letterboxing if needed to keep the aspect ratio. If this is impossible, it will fallback to fixedSize. The simpledisplay library will always provide the illusion that your window is the same size you requested, even if it scales things for you, meaning width and height will never change.

History: Prior to November 11, 2022, width and height would change, which made this mode harder to use than intended. While I had documented this as a possiblity, I still considered it a bug, a leaky abstraction, and changed the code to tighten it up. After that date, the width and height members, as well as mouse coordinates, are always scaled to maintain the illusion of a fixed canvas size.

Your programs should not be affected, as they will continue to function as if the user simply never resized the window at all.

Meta