Skip to content

Commit

Permalink
investigating touch problems
Browse files Browse the repository at this point in the history
  • Loading branch information
sonphantrung authored Nov 13, 2024
1 parent 80e133e commit 8da85dc
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 43 deletions.
4 changes: 0 additions & 4 deletions build-scripts/xcodegen-cataclysm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ targets:
UISupportedInterfaceOrientations:
- UIInterfaceOrientationLandscapeLeft
- UIInterfaceOrientationLandscapeRight
- UIInterfaceOrientationPortraitUpsideDown
- UIInterfaceOrientationPortrait
UILaunchStoryboardName: LaunchScreen
CFBundleIconFile: AppIcon.icns
UIApplicationSupportsIndirectInputEvents: true
Expand All @@ -47,7 +45,6 @@ targets:
buildPhase: sources
includes:
- "**/swift/*.swift"
- "**/swift/*.h"
- "**/third-party/imgui/*.cpp"
- "**/third-party/imgui/*.h"
- "*.cpp"
Expand Down Expand Up @@ -99,7 +96,6 @@ targets:
LIBRARY_SEARCH_PATHS:
- ../build/libs/
- $(inherited)
SWIFT_OBJC_BRIDGING_HEADER: "../src/swift/CataclysmExperimental-Bridging-Header.h"
GCC_PREPROCESSOR_DEFINITIONS:
- GIT_VERSION
- TILES
Expand Down
14 changes: 3 additions & 11 deletions src/sdltiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,17 +504,6 @@ extern "C" {
#endif
} // "C"

/*#if defined(__IPHONEOS__)
void iossetvisibledisplayframe(int left, int top, int right, int bottom){
has_visible_display_frame = true;
visible_display_frame_dirty = true;
visible_display_frame.x = left;
visible_display_frame.y = top;
visible_display_frame.w = right - left;
visible_display_frame.h = bottom - top;
}
#endif*/

SDL_Rect get_android_render_rect( float DisplayBufferWidth, float DisplayBufferHeight )
{
// If the display buffer aspect ratio is wider than the display,
Expand Down Expand Up @@ -3345,6 +3334,7 @@ static void CheckMessages()

#if defined(__ANDROID__) || defined(__IPHONEOS__)
case SDL_FINGERMOTION:
dbg( D_INFO ) << "Fingermotion triggered.";
if( ev.tfinger.fingerId == 0 ) {
if( !is_quick_shortcut_touch ) {
update_finger_repeat_delay();
Expand Down Expand Up @@ -3378,6 +3368,7 @@ static void CheckMessages()
}
break;
case SDL_FINGERDOWN:
dbg( D_INFO ) << "Fingerdown triggered.";
if( ev.tfinger.fingerId == 0 ) {
finger_down_x = finger_curr_x = ev.tfinger.x * WindowWidth;
finger_down_y = finger_curr_y = ev.tfinger.y * WindowHeight;
Expand Down Expand Up @@ -3405,6 +3396,7 @@ static void CheckMessages()
}
break;
case SDL_FINGERUP:
dbg( D_INFO ) << "Fingerup triggered.";
if( ev.tfinger.fingerId == 0 ) {
finger_curr_x = ev.tfinger.x * WindowWidth;
finger_curr_y = ev.tfinger.y * WindowHeight;
Expand Down
4 changes: 0 additions & 4 deletions src/sdltiles.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@ void rescale_tileset( int size );
bool save_screenshot( const std::string &file_path );
void toggle_fullscreen_window();

#if defined(__IPHONEOS__)
void iossetvisibledisplayframe( int left, int top, int right, int bottom );
#endif

struct window_dimensions {
point scaled_font_size;
point window_pos_cell;
Expand Down
2 changes: 0 additions & 2 deletions src/swift/CataclysmExperimental-Bridging-Header.h

This file was deleted.

22 changes: 0 additions & 22 deletions src/swift/ios_stuff.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import Foundation
import GameController
import UIKit
import AVFoundation
import OSLog

//https://stackoverflow.com/a/76728094
extension UIWindow {
Expand All @@ -23,12 +22,6 @@ extension UIScreen {
}
}

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

public func iosGetDisplayDensity() -> Float {
let scale = UIScreen.current?.nativeScale ?? 1.0
return Float(scale)
Expand All @@ -41,18 +34,3 @@ 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")
let scenes = UIApplication.shared.connectedScenes
let windowScene = scenes.first as? UIWindowScene
let window = windowScene?.windows.first
let safeareainsets = window?.safeAreaInsets
// Yeah i know it's extremely dirty
//iossetvisibledisplayframe(Int32(safeareainsets?.left ?? 9999), Int32(safeareainsets?.top ?? 9999), Int32(safeareainsets?.right ?? 9999), Int32(safeareainsets?.bottom ?? 9999))
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}

0 comments on commit 8da85dc

Please sign in to comment.