Skip to content

Commit b4b9364

Browse files
committed
FlutterView C++ wrpapers
1 parent 10d7f34 commit b4b9364

File tree

1 file changed

+131
-0
lines changed

1 file changed

+131
-0
lines changed

Sources/FlutterSwift/Client/FlutterView.swift

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,136 @@ public struct FlutterView {
5353
public var frameRate: Int32 {
5454
view.GetFrameRate()
5555
}
56+
57+
func createRenderSurface() -> Bool {
58+
view.CreateRenderSurface()
59+
}
60+
61+
func destroyRenderSurface() {
62+
view.DestroyRenderSurface()
63+
}
64+
65+
var rootSurfaceTransformation: FlutterTransformation {
66+
view.GetRootSurfaceTransformation()
67+
}
68+
69+
func makeCurrent() -> Bool {
70+
view.MakeCurrent()
71+
}
72+
73+
func clearCurrent() -> Bool {
74+
view.ClearCurrent()
75+
}
76+
77+
func present() -> Bool {
78+
view.Present()
79+
}
80+
81+
func presentWithInfo(_ info: UnsafePointer<FlutterPresentInfo>) -> Bool {
82+
view.PresentWithInfo(info)
83+
}
84+
85+
func populateExistingDamage(fboID: Int, existingDamage: UnsafeMutablePointer<FlutterDamage>) {
86+
view.PopulateExistingDamage(fboID, existingDamage)
87+
}
88+
89+
func getOnscreenFBO() -> UInt32 {
90+
view.GetOnscreenFBO()
91+
}
92+
93+
func makeResourceCurrent() -> Bool {
94+
view.MakeResourceCurrent()
95+
}
96+
97+
func sendInitialBounds() {
98+
view.SendInitialBounds()
99+
}
100+
101+
func onWindowSizeChanged(widthPx: Int, heightPx: Int) {
102+
view.OnWindowSizeChanged(widthPx, heightPx)
103+
}
104+
105+
func onPointerMove(xPx: Double, yPx: Double) {
106+
view.OnPointerMove(xPx, yPx)
107+
}
108+
109+
func onPointerDown(xPx: Double, yPx: Double, button: FlutterPointerMouseButtons) {
110+
view.OnPointerDown(xPx, yPx, button)
111+
}
112+
113+
func onPointerUp(xPx: Double, yPx: Double, button: FlutterPointerMouseButtons) {
114+
view.OnPointerUp(xPx, yPx, button)
115+
}
116+
117+
func onPointerLeave() {
118+
view.OnPointerLeave()
119+
}
120+
121+
func onTouchDown(time: UInt32, id: Int32, x: Double, y: Double) {
122+
view.OnTouchDown(time, id, x, y)
123+
}
124+
125+
func onTouchUp(time: UInt32, id: Int32) {
126+
view.OnTouchUp(time, id)
127+
}
128+
129+
func onTouchMotion(time: UInt32, id: Int32, x: Double, y: Double) {
130+
view.OnTouchMotion(time, id, x, y)
131+
}
132+
133+
func onTouchCancel() {
134+
view.OnTouchCancel()
135+
}
136+
137+
func onKeyMap(format: UInt32, fd: CInt, size: UInt32) {
138+
view.OnKeyMap(format, fd, size)
139+
}
140+
141+
func onKeyModifiers(
142+
modsDepressed: UInt32,
143+
modsLatched: UInt32,
144+
modsLocked: UInt32,
145+
group: UInt32
146+
) {
147+
view.OnKeyModifiers(modsDepressed, modsLatched, modsLocked, group)
148+
}
149+
150+
func onKey(key: UInt32, pressed: Bool) {
151+
view.OnKey(key, pressed)
152+
}
153+
154+
func onVirtualKey(codePoint: UInt32) {
155+
view.OnVirtualKey(codePoint)
156+
}
157+
158+
func onVirtualSpecialKey(keyCode: UInt32) {
159+
view.OnVirtualSpecialKey(keyCode)
160+
}
161+
162+
func onScroll(
163+
x: Double,
164+
y: Double,
165+
deltaX: Double,
166+
deltaY: Double,
167+
scrollOffsetMultiplier: CInt
168+
) {
169+
view.OnScroll(x, y, deltaX, deltaY, scrollOffsetMultiplier)
170+
}
171+
172+
func onVsync(lastFrameTimeNS: UInt64, vsyncIntervalTimeNS: UInt64) {
173+
view.OnVsync(lastFrameTimeNS, vsyncIntervalTimeNS)
174+
}
175+
176+
func updateHighContrastEnabled(_ enabled: Bool) {
177+
view.UpdateHighContrastEnabled(enabled)
178+
}
179+
180+
func updateTextScaleFactor(_ factor: Float) {
181+
view.UpdateTextScaleFactor(factor)
182+
}
183+
184+
func updateDisplayInfo(refreshRate: Double, widthPx: Int, heightPx: Int, pixelRatio: Double) {
185+
view.UpdateDisplayInfo(refreshRate, widthPx, heightPx, pixelRatio)
186+
}
56187
}
57188
#endif

0 commit comments

Comments
 (0)