Difference between revisions of "love.resize"

m
m
Line 1: Line 1:
 
{{newin|[[0.9.0]]|090|type=callback}}
 
{{newin|[[0.9.0]]|090|type=callback}}
 
Called when the window is resized, for example if the user resizes the window, or if <code>love.window.setMode</code> is called with an unsupported width or height in fullscreen and the window chooses the closest appropriate size.
 
Called when the window is resized, for example if the user resizes the window, or if <code>love.window.setMode</code> is called with an unsupported width or height in fullscreen and the window chooses the closest appropriate size.
 
Calls to <code>love.window.setMode</code> will '''only''' trigger this event if the width or height of the window after the call doesn't match the requested width and height. This can happen if a fullscreen mode is requested which doesn't match any supported mode, or if the fullscreen type is [[FullscreenType|'desktop']] and the requested width or height don't match the desktop resolution.
 
 
== Function ==
 
== Function ==
 
=== Synopsis ===
 
=== Synopsis ===
Line 9: Line 7:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|number|w|The new width.}}
+
{{param|number|w|The new width, in pixels.}}
{{param|number|h|The new height.}}
+
{{param|number|h|The new height, in pixels.}}
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
 +
== Notes ==
 +
Calls to <code>love.window.setMode</code> will '''only''' trigger this event if the width or height of the window after the call doesn't match the requested width and height. This can happen if a fullscreen mode is requested which doesn't match any supported mode, or if the fullscreen type is [[FullscreenType|'desktop']] and the requested width or height don't match the desktop resolution.
 
== Example ==
 
== Example ==
 
<source lang="lua">
 
<source lang="lua">

Revision as of 23:48, 17 January 2014

Available since LÖVE 0.9.0
This callback is not supported in earlier versions.

Called when the window is resized, for example if the user resizes the window, or if love.window.setMode is called with an unsupported width or height in fullscreen and the window chooses the closest appropriate size.

Function

Synopsis

love.resize( w, h )

Arguments

number w
The new width, in pixels.
number h
The new height, in pixels.

Returns

Nothing.

Notes

Calls to love.window.setMode will only trigger this event if the width or height of the window after the call doesn't match the requested width and height. This can happen if a fullscreen mode is requested which doesn't match any supported mode, or if the fullscreen type is 'desktop' and the requested width or height don't match the desktop resolution.

Example

function love.resize(w, h)
  print(("Window resized to width: %d and height: %d."):format(w, h))
end

See Also


Other Languages