2
0
Эх сурвалжийг харах

02-animation: toogle fullscreen

Daniele Bartolini 6 жил өмнө
parent
commit
4ddfbe3bb2

+ 2 - 2
samples/02-animation/boot.config

@@ -9,7 +9,7 @@ window_title = "02-animation"
 // Linux-only configs
 linux = {
 	renderer = {
-		resolution = [ 1280 720 ]
+		resolution = [ 960 540 ]
 		vsync = true
 	}
 }
@@ -17,7 +17,7 @@ linux = {
 // Windows-only configs
 windows = {
 	renderer = {
-		resolution = [ 1280 720 ]
+		resolution = [ 960 540 ]
 		vsync = true
 	}
 }

+ 8 - 1
samples/02-animation/main.lua

@@ -11,6 +11,7 @@ Game = {
 	player = nil,
 	players = {},
 	player_i = 1,
+	fullscreen = false
 }
 
 GameBase.game = Game
@@ -26,7 +27,7 @@ function Game.level_loaded()
 
 	-- Spawn camera
 	local camera_unit = World.spawn_unit(GameBase.world, "core/units/camera")
-	World.camera_set_orthographic_size(GameBase.world, camera_unit, 11.25/2)
+	World.camera_set_orthographic_size(GameBase.world, camera_unit, 540/2/32)
 	World.camera_set_projection_type(GameBase.world, camera_unit, "orthographic")
 	SceneGraph.set_local_position(Game.sg, camera_unit, Vector3(0, 8, 0))
 	SceneGraph.set_local_rotation(Game.sg, camera_unit, Quaternion.from_axis_angle(Vector3.right(), 90*(math.pi/180.0)))
@@ -45,6 +46,12 @@ function Game.update(dt)
 		Device.quit()
 	end
 
+	-- Toggle fullscreen
+	if Keyboard.released(Keyboard.button_id("0")) then
+		Game.fullscreen = not Game.fullscreen
+		Window.set_fullscreen(Game.fullscreen)
+	end
+
 	-- Cycle through characters
 	if Pad1.pressed(Pad1.button_id("shoulder_right")) or Keyboard.pressed(Keyboard.button_id("j")) then
 		AnimationStateMachine.trigger(Game.sm, Game.player, "idle")