Add a ViewControllerCommon.h

This commit is contained in:
Henrik Rydgård 2024-05-22 15:59:23 +02:00
parent 832b21ad45
commit cc37476c79
5 changed files with 26 additions and 18 deletions

View file

@ -1292,6 +1292,7 @@ elseif(IOS AND NOT LIBRETRO)
ios/DisplayManager.mm
ios/Controls.h
ios/Controls.mm
ios/ViewControllerCommon.h
ios/ViewController.mm
ios/ViewController.h
ios/iOSCoreAudio.mm

View file

@ -7,15 +7,7 @@
#import "CameraHelper.h"
#import "LocationHelper.h"
@protocol PPSSPPViewController<NSObject>
@optional
- (void)hideKeyboard;
- (void)showKeyboard;
- (void)shareText:(NSString *)text;
- (void)shutdown;
- (void)bindDefaultFBO;
- (UIView *)getView;
@end
#include "ViewControllerCommon.h"
@interface PPSSPPViewControllerGL : GLKViewController <
iCadeEventDelegate, LocationHandlerDelegate, CameraFrameDelegate,
@ -27,5 +19,3 @@ extern id <PPSSPPViewController> sharedViewController;
void setCameraSize(int width, int height);
void startVideo();
void stopVideo();
void startLocation();
void stopLocation();

View file

@ -95,13 +95,13 @@ id<PPSSPPViewController> sharedViewController;
// TODO: Reach these through sharedViewController
static CameraHelper *cameraHelper;
static LocationHelper *locationHelper;
@interface PPSSPPViewControllerGL () {
ICadeTracker g_iCadeTracker;
TouchTracker g_touchTracker;
GraphicsContext *graphicsContext;
LocationHelper *locationHelper;
}
@property (nonatomic, strong) EAGLContext* context;
@ -394,19 +394,19 @@ void stopVideo() {
[cameraHelper stopVideo];
}
-(void) PushCameraImageIOS:(long long)len buffer:(unsigned char*)data {
- (void)PushCameraImageIOS:(long long)len buffer:(unsigned char*)data {
Camera::pushCameraImage(len, data);
}
void startLocation() {
- (void)startLocation {
[locationHelper startLocationUpdates];
}
void stopLocation() {
- (void)stopLocation {
[locationHelper stopLocationUpdates];
}
-(void) SetGpsDataIOS:(CLLocation *)newLocation {
- (void)SetGpsDataIOS:(CLLocation *)newLocation {
GPS::setGpsData((long long)newLocation.timestamp.timeIntervalSince1970,
newLocation.horizontalAccuracy/5.0,
newLocation.coordinate.latitude, newLocation.coordinate.longitude,

View file

@ -0,0 +1,17 @@
#pragma once
#import <UIKit/UIKit.h>
@protocol PPSSPPViewController<NSObject>
@optional
- (void)hideKeyboard;
- (void)showKeyboard;
- (void)shareText:(NSString *)text;
- (void)shutdown;
- (void)bindDefaultFBO;
- (UIView *)getView;
- (void)startLocation;
- (void)stopLocation;
@end

View file

@ -437,9 +437,9 @@ bool System_MakeRequest(SystemRequestType type, int requestId, const std::string
return true;
case SystemRequestType::GPS_COMMAND:
if (param1 == "open") {
startLocation();
[sharedViewController startLocation];
} else if (param1 == "close") {
stopLocation();
[sharedViewController stopLocation];
}
return true;
case SystemRequestType::SHARE_TEXT: