Skip to content

Commit ddc6410

Browse files
committed
Fix iOS build: Call sleepIfNeeded on FrameLimiter
1 parent 39bbada commit ddc6410

File tree

3 files changed

+45
-37
lines changed

3 files changed

+45
-37
lines changed

src/ios/JNGLView.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ - (void) drawView: (CADisplayLink*) displayLink {
113113

114114
jngl::pWindow->draw();
115115
[context presentRenderbuffer:GL_RENDERBUFFER];
116-
jngl::pWindow->sleepIfNeeded();
116+
impl->sleepIfNeeded();
117117
}
118118
}
119119

src/ios/windowimpl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,8 @@ void WindowImpl::updateInput() {
7878
}
7979
}
8080

81+
void WindowImpl::sleepIfNeeded() {
82+
window->frameLimiter.sleepIfNeeded();
83+
}
84+
8185
} // namespace jngl

src/ios/windowimpl.hpp

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2020 Jan Niklas Hasse <jhasse@bixense.com>
1+
// Copyright 2012-2026 Jan Niklas Hasse <jhasse@bixense.com>
22
// For conditions of distribution and use, see copyright notice in LICENSE.txt
33

44
#pragma once
@@ -7,39 +7,43 @@
77
#include <map>
88

99
namespace jngl {
10-
class AppleController;
11-
class Vec2;
12-
class Window;
13-
14-
class WindowImpl {
15-
public:
16-
WindowImpl(Window*);
17-
WindowImpl(const WindowImpl&) = delete;
18-
WindowImpl& operator=(const WindowImpl&) = delete;
19-
20-
enum class Touch {
21-
BEGAN,
22-
ENDED,
23-
MOVED,
24-
};
25-
26-
void handleTouch(const std::pair<intptr_t, Vec2>*, size_t count, Touch);
27-
// ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TODO: use std::span
28-
29-
void setMouseDown(bool);
30-
void setRelativeMouseMode(bool);
31-
int relativeX = 0;
32-
int relativeY = 0;
33-
void updateInput();
34-
35-
std::map<int64_t, Vec2> touches;
36-
37-
bool shouldCallControllerChangedCallback = false;
38-
std::map<void*, std::shared_ptr<AppleController>> appleControllers;
39-
40-
private:
41-
Window* const window;
42-
int mouseX = 0;
43-
int mouseY = 0;
10+
11+
class AppleController;
12+
class Vec2;
13+
class Window;
14+
15+
class WindowImpl {
16+
public:
17+
WindowImpl(Window*);
18+
WindowImpl(const WindowImpl&) = delete;
19+
WindowImpl& operator=(const WindowImpl&) = delete;
20+
21+
enum class Touch {
22+
BEGAN,
23+
ENDED,
24+
MOVED,
4425
};
45-
}
26+
27+
void handleTouch(const std::pair<intptr_t, Vec2>*, size_t count, Touch);
28+
// ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TODO: use std::span
29+
30+
void setMouseDown(bool);
31+
void setRelativeMouseMode(bool);
32+
int relativeX = 0;
33+
int relativeY = 0;
34+
void updateInput();
35+
36+
std::map<int64_t, Vec2> touches;
37+
38+
bool shouldCallControllerChangedCallback = false;
39+
std::map<void*, std::shared_ptr<AppleController>> appleControllers;
40+
41+
void sleepIfNeeded();
42+
43+
private:
44+
Window* const window;
45+
int mouseX = 0;
46+
int mouseY = 0;
47+
};
48+
49+
} // namespace jngl

0 commit comments

Comments
 (0)