Skip to content

Commit

Permalink
hmmm
Browse files Browse the repository at this point in the history
  • Loading branch information
sonphantrung authored Nov 8, 2024
1 parent 7908e7a commit 7cb8d37
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions build-scripts/xcodegen-cataclysm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ targets:
LIBRARY_SEARCH_PATHS:
- ../build/libs/
- $(inherited)
SWIFT_OBJC_BRIDGING_HEADER: "swift/CataclysmExperimental-Bridging-Header.h"
GCC_PREPROCESSOR_DEFINITIONS:
- GIT_VERSION
- TILES
Expand Down
4 changes: 2 additions & 2 deletions src/sdltiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ static void WinCreate()
#endif

#if defined(__IPHONEOS__)
window_flags = SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI;
window_flags = SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_ALLOW_HIGHDPI;
#endif

int display = std::stoi( get_option<std::string>( "DISPLAY" ) );
Expand Down Expand Up @@ -326,7 +326,7 @@ static void WinCreate()
) );
throwErrorIf( !::window, "SDL_CreateWindow failed" );

#if !defined(__ANDROID__) || !defined(__IPHONEOS__) || !defined(EMSCRIPTEN)
#if !defined(__ANDROID__) || !defined(EMSCRIPTEN)
// On Android SDL seems janky in windowed mode so we're fullscreen all the time.
// Fullscreen mode is now modified so it obeys terminal width/height, rather than
// overwriting it with this calculation.
Expand Down
1 change: 1 addition & 0 deletions src/swift/CataclysmExperimental-Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#import "../../build/libs/headers/SDL_uikitappdelegate.h"
15 changes: 15 additions & 0 deletions src/swift/ios_stuff.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Foundation
import GameController
import UIKit
import AVFoundation
import OSLog

extension UIWindow {
static var current: UIWindow? {
Expand All @@ -15,6 +16,11 @@ extension UIWindow {
}
}

extension SDLUIKitDelegate {
class func getAppDelegateClassName() -> String? {
return NSStringFromClass(AppDelegate.self.self)
}
}

extension UIScreen {
static var current: UIScreen? {
Expand All @@ -33,4 +39,13 @@ public func isIOSKeyBoardAvailable() -> Bool {

public func vibrateDevice() {
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
}

class AppDelegate : SDLUIKitDelegate
{
override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
{
os_log("Calling from SWIFT")
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

0 comments on commit 7cb8d37

Please sign in to comment.