Solarus quests
1.6
Quest maker's reference
|
sol.video
allows you to manage the window and the display.
The area where the game takes place has a fixed size called the quest size. The quest size is in a range specified in the quest properties file. This quest size is the logical size: it determines how much content the player can see on the map.
The quest size is typically 320x240 pixels, but some systems may prefer other sizes, like 400x240 on Android. You can set a range of supported quest sizes in the quest properties files for portability. However, it requires more work on your part: in particular, you have to implement menus and a HUD that can adapt to any size in this range. And be aware that some players will be able to see more game content than others.
The quest can be played in windowed mode or in fullscreen. In windowed mode, the window can be resized by the user or by your scripts. The quest size is independent from the actual window size: when you resize the window, the quest image is scaled to fit the window. The pixel ratio is always preserved, possibly by adding black borders.
Solarus supports OpenGL shaders to modify the rendering, for example to apply a smoothing filter. See the shader documentation for more details.
Returns the text of the title bar of the window.
Sets the text of the title bar of the window.
By default, the window title is set to the title of your quest followed by its version. Both these properties are indicated in the quest.dat file.
window_title
(string): The window title to set.Returns whether the current video mode is fullscreen.
true
if the video mode is fullscreen.Turns on or turns off fullscreen, keeping an equivalent video mode.
fullscreen
(boolean, optional): true
to set fullscreen (no value means true
).Returns whether the mouse cursor is currently visible.
true
if the mouse cursor is currently visible.Shows or hides the mouse cursor, keeping an equivalent video mode.
visible_cursor
(boolean, optional): true
to show mouse cursor (no value means true
).Returns the logical size of the quest screen.
This quest size is fixed at runtime. It is always in the range of allowed quest sizes specified in quest.dat.
The quest size is independent from the actual window size.
Returns the size of the window.
The quest image has a fixed size determined when the program starts. This quest image is then scaled to the window. The size of the window can be changed at any moment by the user or by sol.video.set_window_size(). Black borders are added if necessary to keep the correct pixel ratio.
When the window is in fullscreen, this function returns the size to be used when returning to windowed mode.
When Solarus starts, the size of the window is twice the quest size.
Sets the size of the window.
See sol.video.get_window_size() for a detailed description of the window size.
When the window is in fullscreen, this function still works: the changes will be visible when returning to windowed mode.
Returns the shader currently applied to the rendering, if any.
nil
if no shader is applied.Sets a shader to be applied to the rendering.
nil
value means to apply no shader.Events are callback methods automatically called by the engine if you define them.
Called at the very end of the engine rendering. This event allows you to draw directly on the screen after the quest surface has been scaled to fit the size of the window (possibly using shaders). One pixel in the surface parameter will correspond to one pixel on screen.
screen
(surface): Special surface representing the window.The following functions are deprecated and may be removed it future releases.
Returns the current video mode. Video modes are built-in software filters that can scale the rendering. The following modes are available:
"normal"
(default): The quest screen is unchanged. In windowed mode, the image is stretched by a factor of 2."scale2x"
: The quest screen is scaled by a factor of 2 with the Scale2X algorithm."hq2x"
: The quest screen is scaled by a factor of 2 with the hq2x algorithm."hq3x"
: The quest screen is scaled by a factor of 3 with the hq3x algorithm."hq4x"
: The quest screen is scaled by a factor of 4 with the hq4x algorithm.Use sol.video.get_shader() instead.
Sets the current video mode. Video modes are built-in software filters that can scale the rendering. The window size is reset to a default value that depends on the video mode.
video_mode
(string): Name of the video mode (see the list above).Use sol.video.set_shader() instead.
Sets the next video mode in the list of video modes supported.
Video modes are built-in software filters that can scale the rendering.
You can use this function if you want to change the video mode without specifying which one to use.
Use sol.video.set_shader() instead.
Returns whether a video mode is supported.
video_mode
(string): Name of a video mode (see the list above).Use sol.shader.create() instead and check if it fails.
Returns an array of all video modes supported.
Return
value (table): An array of names of all video modes supported.Use sol.main.get_resource_ids("shader") instead.
Restores the size of the window to a default value that depends on the current video mode.
Use sol.video.set_window_size() instead.