This commit is contained in:
Михаил Капелько committed 2026-10-21 17:35:20 +03:00
1 parent 738a5bffd0
commit 47f9eb904a
30 files changed
+339 -35

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
<key>CFBundleDisplayName</key>
<string>OGS Mahjong</string>
<key>CFBundleIdentifier</key>
<string>org.opengamestudio.Mahjong</string>
<string>org.opengamestudio.mahjong</string>
<key>CFBundleExecutable</key>
<string>ogs-mahjong</string>
<key>CFBundleIconFile</key>
+5 -1
View File
@@ -7,7 +7,11 @@ struct GameApp: App {
var body: some Scene {
WindowGroup {
RootView(appDelegate.rootVM)
ZStack {
RenderView()
.ignoresSafeArea()
RootView(appDelegate.rootVM)
}
}
.defaultSize(width: 640, height: 480)
}
+73
View File
@@ -123,6 +123,7 @@ public struct F {
public static let count = "count"
public static let countText = "countText"
public static let didClickIncrement = "didClickIncrement"
public static let didClickLoadModel = "didClickLoadModel"
public static let didLaunch = "didLaunch"
public static let didPrepareGL = "didPrepareGL"
public static let didSetup = "didSetup"
@@ -131,6 +132,44 @@ public struct F {
public static let willDeinit = "willDeinit"
}
public struct ChkgfxContext: DialectContext {
public var didClickLoadModel = Bool()
public var didLaunch = Bool()
public var didSetup = Bool()
public var recentField = ""
public func field<T>(_ name: String) -> T {
if (name == "didClickLoadModel") {
return didClickLoadModel as! T
}
else if (name == "didLaunch") {
return didLaunch as! T
}
else if (name == "didSetup") {
return didSetup as! T
}
return "unknown-field-name" as! T
}
public mutating func setField(
_ name: String,
_ value: Any
) {
if (name == "didClickLoadModel") {
didClickLoadModel = value as! Bool
}
else if (name == "didLaunch") {
didLaunch = value as! Bool
}
else if (name == "didSetup") {
didSetup = value as! Bool
}
}
}
public struct RenderContext: DialectContext {
public var backingPixelSize = [Int32]()
public var didClickIncrement = Bool()
@@ -256,6 +295,13 @@ public struct RootContext: DialectContext {
}
}
public func chkgfxSet(
_ key: String,
_ value: Any
) {
ChkgfxComponent.singleton!.ctrl.set(key, value)
}
public func renderSet(
_ key: String,
_ value: Any
@@ -270,6 +316,24 @@ public func rootSet(
RootComponent.singleton!.ctrl.set(key, value)
}
func chkgfxShouldResetDidLaunch(_ c: ChkgfxContext) -> ChkgfxContext {
var c = c
/* 1. Only once during the first setup */
if
c.recentField == F.didSetup &&
c.didLaunch == false
{
c.didLaunch = true
c.recentField = F.didLaunch
return c
}
c.recentField = DIALECT_CONTEXT_RECENT_FIELD_NONE
return c
}
func renderShouldResetDidLaunch(_ c: RenderContext) -> RenderContext {
var c = c
@@ -394,6 +458,15 @@ func rootShouldResetDidLaunch(_ c: RootContext) -> RootContext {
return c
}
func chkgfxRegisterShoulds(_ ctrl: DialectController) {
[
chkgfxShouldResetDidLaunch,
].forEach { f in
ctrl.registerFunction { c in f(c as! ChkgfxContext) }
}
}
func renderRegisterShoulds(_ ctrl: DialectController) {
[
renderShouldResetDidLaunch,