2015-12-04 18:20:09 +01:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
|
|
|
*
|
2021-12-26 18:47:58 +01:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2015-12-04 18:20:09 +01:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2021-12-26 18:47:58 +01:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2015-12-04 18:20:09 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-01-07 12:30:19 +01:00
|
|
|
#ifndef BACKENDS_PLATFORM_IOS7_IOS7_VIDEO_H
|
|
|
|
#define BACKENDS_PLATFORM_IOS7_IOS7_VIDEO_H
|
2015-12-04 18:20:09 +01:00
|
|
|
|
|
|
|
#include <UIKit/UIKit.h>
|
|
|
|
#include <Foundation/Foundation.h>
|
|
|
|
#include <QuartzCore/QuartzCore.h>
|
2023-02-02 15:31:53 +01:00
|
|
|
#include <Accelerate/Accelerate.h>
|
2015-12-04 18:20:09 +01:00
|
|
|
|
|
|
|
#include <OpenGLES/EAGL.h>
|
2015-12-10 15:49:00 +01:00
|
|
|
#include <OpenGLES/ES2/gl.h>
|
|
|
|
#include <OpenGLES/ES2/glext.h>
|
2015-12-04 18:20:09 +01:00
|
|
|
|
2016-01-07 12:40:55 +01:00
|
|
|
#include "backends/platform/ios7/ios7_keyboard.h"
|
|
|
|
#include "backends/platform/ios7/ios7_common.h"
|
2022-06-20 13:36:14 +02:00
|
|
|
#include "backends/platform/ios7/ios7_game_controller.h"
|
2015-12-04 18:20:09 +01:00
|
|
|
|
|
|
|
#include "common/list.h"
|
|
|
|
|
2015-12-10 15:49:00 +01:00
|
|
|
typedef struct {
|
|
|
|
GLfloat x, y;
|
|
|
|
GLfloat u,v;
|
|
|
|
} GLVertex;
|
|
|
|
|
2023-02-02 15:31:53 +01:00
|
|
|
uint getSizeNextPOT(uint size);
|
|
|
|
|
2015-12-04 18:20:09 +01:00
|
|
|
@interface iPhoneView : UIView {
|
|
|
|
VideoContext _videoContext;
|
|
|
|
|
|
|
|
Common::List<InternalEvent> _events;
|
|
|
|
NSLock *_eventLock;
|
|
|
|
SoftKeyboard *_keyboardView;
|
2022-06-20 13:36:14 +02:00
|
|
|
Common::List<GameController*> _controllers;
|
2015-12-04 18:20:09 +01:00
|
|
|
|
2020-09-06 07:05:39 +01:00
|
|
|
UIBackgroundTaskIdentifier _backgroundSaveStateTask;
|
|
|
|
|
2015-12-04 18:20:09 +01:00
|
|
|
EAGLContext *_context;
|
|
|
|
GLuint _viewRenderbuffer;
|
|
|
|
GLuint _viewFramebuffer;
|
|
|
|
GLuint _screenTexture;
|
|
|
|
GLuint _overlayTexture;
|
|
|
|
GLuint _mouseCursorTexture;
|
|
|
|
|
2015-12-10 15:49:00 +01:00
|
|
|
GLuint _vertexShader;
|
|
|
|
GLuint _fragmentShader;
|
|
|
|
|
|
|
|
GLuint _vertexBuffer;
|
|
|
|
|
|
|
|
GLuint _screenSizeSlot;
|
|
|
|
GLuint _textureSlot;
|
2019-11-16 03:23:35 -08:00
|
|
|
GLuint _shakeXSlot;
|
|
|
|
GLuint _shakeYSlot;
|
2015-12-10 15:49:00 +01:00
|
|
|
|
|
|
|
GLuint _positionSlot;
|
|
|
|
GLuint _textureCoordSlot;
|
|
|
|
|
2015-12-04 18:20:09 +01:00
|
|
|
GLint _renderBufferWidth;
|
|
|
|
GLint _renderBufferHeight;
|
|
|
|
|
2015-12-10 15:49:00 +01:00
|
|
|
GLVertex _gameScreenCoords[4];
|
2015-12-04 18:20:09 +01:00
|
|
|
CGRect _gameScreenRect;
|
|
|
|
|
2015-12-10 15:49:00 +01:00
|
|
|
GLVertex _overlayCoords[4];
|
2015-12-04 18:20:09 +01:00
|
|
|
CGRect _overlayRect;
|
|
|
|
|
2015-12-10 15:49:00 +01:00
|
|
|
GLVertex _mouseCoords[4];
|
|
|
|
|
2015-12-04 18:20:09 +01:00
|
|
|
GLint _mouseHotspotX, _mouseHotspotY;
|
|
|
|
GLint _mouseWidth, _mouseHeight;
|
|
|
|
GLfloat _mouseScaleX, _mouseScaleY;
|
|
|
|
|
2019-11-15 01:38:21 -08:00
|
|
|
int _scaledShakeXOffset;
|
|
|
|
int _scaledShakeYOffset;
|
2015-12-04 18:20:09 +01:00
|
|
|
}
|
|
|
|
|
2022-06-20 13:33:26 +02:00
|
|
|
@property (nonatomic, assign) CGPoint pointerPosition;
|
2023-01-21 23:24:33 +01:00
|
|
|
@property (nonatomic, assign) BOOL isInGame;
|
2022-06-20 13:33:26 +02:00
|
|
|
|
2015-12-04 18:20:09 +01:00
|
|
|
- (id)initWithFrame:(struct CGRect)frame;
|
|
|
|
|
|
|
|
- (VideoContext *)getVideoContext;
|
|
|
|
|
2023-02-02 15:31:53 +01:00
|
|
|
- (void)setGameScreenCoords;
|
2015-12-04 18:20:09 +01:00
|
|
|
- (void)initSurface;
|
|
|
|
- (void)setViewTransformation;
|
|
|
|
|
|
|
|
- (void)setGraphicsMode;
|
|
|
|
|
|
|
|
- (void)updateSurface;
|
|
|
|
- (void)updateMainSurface;
|
|
|
|
- (void)updateOverlaySurface;
|
|
|
|
- (void)updateMouseSurface;
|
|
|
|
- (void)clearColorBuffer;
|
|
|
|
|
|
|
|
- (void)notifyMouseMove;
|
|
|
|
- (void)updateMouseCursorScaling;
|
|
|
|
- (void)updateMouseCursor;
|
|
|
|
|
2022-12-04 22:49:53 +01:00
|
|
|
#if TARGET_OS_IOS
|
2023-04-02 19:52:39 +01:00
|
|
|
- (void)interfaceOrientationChanged:(UIInterfaceOrientation)orientation;
|
2022-12-04 22:49:53 +01:00
|
|
|
#endif
|
2015-12-04 18:20:09 +01:00
|
|
|
|
2019-02-12 23:48:14 +00:00
|
|
|
- (void)showKeyboard;
|
|
|
|
- (void)hideKeyboard;
|
|
|
|
- (BOOL)isKeyboardShown;
|
|
|
|
|
2023-01-21 23:49:10 +01:00
|
|
|
- (void)handleMainMenuKey;
|
|
|
|
|
2015-12-04 18:20:09 +01:00
|
|
|
- (void)applicationSuspend;
|
|
|
|
- (void)applicationResume;
|
2020-09-12 19:14:49 +01:00
|
|
|
|
|
|
|
- (void)saveApplicationState;
|
|
|
|
- (void)clearApplicationState;
|
|
|
|
- (void)restoreApplicationState;
|
2015-12-04 18:20:09 +01:00
|
|
|
|
2020-09-06 07:05:39 +01:00
|
|
|
- (void) beginBackgroundSaveStateTask;
|
|
|
|
- (void) endBackgroundSaveStateTask;
|
|
|
|
|
2022-06-20 13:28:27 +02:00
|
|
|
- (void)addEvent:(InternalEvent)event;
|
2015-12-04 18:20:09 +01:00
|
|
|
- (bool)fetchEvent:(InternalEvent *)event;
|
|
|
|
|
2022-06-20 13:28:27 +02:00
|
|
|
- (bool)getMouseCoords:(CGPoint)point eventX:(int *)x eventY:(int *)y;
|
2022-06-22 10:24:54 +02:00
|
|
|
- (BOOL)isTouchControllerConnected;
|
|
|
|
- (BOOL)isMouseControllerConnected;
|
|
|
|
- (BOOL)isGamepadControllerConnected;
|
2023-03-14 11:39:24 +01:00
|
|
|
- (void)virtualController:(bool)connect;
|
2015-12-04 18:20:09 +01:00
|
|
|
@end
|
|
|
|
|
|
|
|
#endif
|