File tree Expand file tree Collapse file tree 4 files changed +11
-27
lines changed Expand file tree Collapse file tree 4 files changed +11
-27
lines changed Original file line number Diff line number Diff line change @@ -95,9 +95,6 @@ The Orthographic API provides a helper module to easily update the camera and se
95
95
end
96
96
97
97
function update(self)
98
- render_helper.update()
99
- ...
100
-
101
98
render_helper.set_world_view_projection()
102
99
-- draw world
103
100
...
Original file line number Diff line number Diff line change @@ -144,15 +144,17 @@ function M.set_window_scaling_factor(scaling_factor)
144
144
end
145
145
end
146
146
147
- --- Set the window size
148
- -- Call this from your render script to update the current window size
149
- -- The width and height can later be retrieved through the M.get_window_size()
150
- -- function. This is a convenience for use by custom projector functions
147
+ --- Update the window size
151
148
-- @param width Current window width
152
149
-- @param height Current window height
153
- function M .set_window_size (width , height )
154
- assert (width , " You must provide window width" )
155
- assert (height , " You must provide window height" )
150
+ local function update_window_size ()
151
+ local width , height = window .get_size ()
152
+ if width == 0 or height == 0 then
153
+ return
154
+ end
155
+ if width == WINDOW_WIDTH and height == WINDOW_HEIGHT then
156
+ return
157
+ end
156
158
WINDOW_WIDTH = width
157
159
WINDOW_HEIGHT = height
158
160
@@ -269,6 +271,8 @@ function M.update(camera_id, dt)
269
271
return
270
272
end
271
273
274
+ update_window_size ()
275
+
272
276
local camera_world_pos = go .get_world_position (camera_id )
273
277
local camera_world_to_local_diff = camera_world_pos - go .get_position (camera_id )
274
278
local follow_enabled = go .get (camera .url , " follow" )
Original file line number Diff line number Diff line change @@ -15,25 +15,11 @@ local world_view = vmath.matrix4()
15
15
local world_projection = vmath .matrix4 ()
16
16
local screen_view = vmath .matrix4 ()
17
17
local camera_offset = nil
18
- local window_width = nil
19
- local window_height = nil
20
18
21
19
22
20
function M .init ()
23
21
end
24
22
25
-
26
- function M .update ()
27
- local current_window_width = render .get_window_width ()
28
- local current_window_height = render .get_window_height ()
29
- if window_width ~= current_window_width or window_height ~= current_window_height then
30
- window_width = current_window_width
31
- window_height = current_window_height
32
- camera .set_window_size (current_window_width , current_window_height )
33
- end
34
- end
35
-
36
-
37
23
function M .world_projection ()
38
24
return world_projection
39
25
end
Original file line number Diff line number Diff line change @@ -19,9 +19,6 @@ function init(self)
19
19
end
20
20
21
21
function update(self)
22
- render_helper.update()
23
-
24
-
25
22
-- clear color
26
23
render.set_depth_mask(true)
27
24
render.clear({[render.BUFFER_COLOR_BIT] = self.clear_color, [render.BUFFER_DEPTH_BIT] = 1, [render.BUFFER_STENCIL_BIT] = 0})
You can’t perform that action at this time.
0 commit comments