-
-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Experimental iOS Support #8407
base: master
Are you sure you want to change the base?
Experimental iOS Support #8407
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"colors" : [ | ||
{ | ||
"idiom" : "universal" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"platform" : "ios", | ||
"size" : "1024x1024" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
}, | ||
"properties" : { | ||
"origin" : "bottom-left", | ||
"interpretation" : "non-premultiplied-colors" | ||
}, | ||
"textures" : [ | ||
{ | ||
"idiom" : "universal", | ||
"filename" : "Universal.mipmapset" | ||
} | ||
] | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
}, | ||
"levels" : [ | ||
{ | ||
"filename" : "ColorMap.png", | ||
"mipmap-level" : "base" | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM"> | ||
<dependencies> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/> | ||
<capability name="Safe area layout guides" minToolsVersion="9.0"/> | ||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> | ||
</dependencies> | ||
<scenes> | ||
<!--View Controller--> | ||
<scene sceneID="EHf-IW-A2E"> | ||
<objects> | ||
<viewController id="01J-lp-oVM" sceneMemberID="viewController"> | ||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | ||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> | ||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/> | ||
</view> | ||
</viewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="53" y="375"/> | ||
</scene> | ||
</scenes> | ||
</document> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
SDL_uikit_main.c, placed in the public domain by Sam Lantinga 3/18/2019 | ||
*/ | ||
|
||
/* Include the SDL main definition header */ | ||
#include "SDL_main.h" | ||
|
||
#if defined(__IPHONEOS__) || defined(__TVOS__) | ||
|
||
#ifndef SDL_MAIN_HANDLED | ||
#ifdef main | ||
#undef main | ||
#endif | ||
|
||
int | ||
main(int argc, char *argv[]) | ||
{ | ||
return SDL_UIKitRunApp(argc, argv, SDL_main); | ||
} | ||
#endif /* !SDL_MAIN_HANDLED */ | ||
|
||
#endif /* __IPHONEOS__ || __TVOS__ */ | ||
|
||
/* vi: set ts=4 sw=4 expandtab: */ |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,49 @@ | ||||||
// | ||||||
// ShaderTypes.h | ||||||
// fheroes2 | ||||||
// | ||||||
// Created by Drew Bratcher on 4/29/23. | ||||||
// | ||||||
|
||||||
// | ||||||
// Header containing types and enum constants shared between Metal shaders and Swift/ObjC source | ||||||
// | ||||||
#ifndef ShaderTypes_h | ||||||
#define ShaderTypes_h | ||||||
|
||||||
#ifdef __METAL_VERSION__ | ||||||
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type | ||||||
typedef metal::int32_t EnumBackingType; | ||||||
#else | ||||||
#import <Foundation/Foundation.h> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
typedef NSInteger EnumBackingType; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
#endif | ||||||
|
||||||
#include <simd/simd.h> | ||||||
|
||||||
typedef NS_ENUM(EnumBackingType, BufferIndex) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
{ | ||||||
BufferIndexMeshPositions = 0, | ||||||
BufferIndexMeshGenerics = 1, | ||||||
BufferIndexUniforms = 2 | ||||||
}; | ||||||
|
||||||
typedef NS_ENUM(EnumBackingType, VertexAttribute) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
{ | ||||||
VertexAttributePosition = 0, | ||||||
VertexAttributeTexcoord = 1, | ||||||
}; | ||||||
|
||||||
typedef NS_ENUM(EnumBackingType, TextureIndex) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
{ | ||||||
TextureIndexColor = 0, | ||||||
}; | ||||||
|
||||||
typedef struct | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
{ | ||||||
matrix_float4x4 projectionMatrix; | ||||||
matrix_float4x4 modelViewMatrix; | ||||||
} Uniforms; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
#endif /* ShaderTypes_h */ | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// Shaders.metal | ||
// fheroes2 | ||
// | ||
// Created by Drew Bratcher on 4/29/23. | ||
// | ||
|
||
// File for Metal kernel and shader functions | ||
|
||
#include <metal_stdlib> | ||
#include <simd/simd.h> | ||
|
||
// Including header shared between this Metal shader code and Swift/C code executing Metal API commands | ||
#import "ShaderTypes.h" | ||
|
||
using namespace metal; | ||
|
||
typedef struct | ||
{ | ||
float3 position [[attribute(VertexAttributePosition)]]; | ||
float2 texCoord [[attribute(VertexAttributeTexcoord)]]; | ||
} Vertex; | ||
|
||
typedef struct | ||
{ | ||
float4 position [[position]]; | ||
float2 texCoord; | ||
} ColorInOut; | ||
|
||
vertex ColorInOut vertexShader(Vertex in [[stage_in]], | ||
constant Uniforms & uniforms [[ buffer(BufferIndexUniforms) ]]) | ||
{ | ||
ColorInOut out; | ||
|
||
float4 position = float4(in.position, 1.0); | ||
out.position = uniforms.projectionMatrix * uniforms.modelViewMatrix * position; | ||
out.texCoord = in.texCoord; | ||
|
||
return out; | ||
} | ||
|
||
fragment float4 fragmentShader(ColorInOut in [[stage_in]], | ||
constant Uniforms & uniforms [[ buffer(BufferIndexUniforms) ]], | ||
texture2d<half> colorMap [[ texture(TextureIndexColor) ]]) | ||
{ | ||
constexpr sampler colorSampler(mip_filter::linear, | ||
mag_filter::linear, | ||
min_filter::linear); | ||
|
||
half4 colorSample = colorMap.sample(colorSampler, in.texCoord.xy); | ||
|
||
return float4(colorSample); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SDL_main.h
file not found