Skip to content

Commit a304b17

Browse files
committed
Use typed throw
1 parent 707c63b commit a304b17

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

Sources/GateEngine/Resources/Import & Export/Importers/ApplePlatformImageImporter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public final class ApplePlatformImageImporter: TextureImporter {
5353
}
5454
}
5555

56-
public func loadTexture(options: TextureImporterOptions) async throws -> (data: Data, size: Size2) {
56+
public func loadTexture(options: TextureImporterOptions) throws(GateEngineError) -> (data: Data, size: Size2) {
5757
return (data, size)
5858
}
5959

Sources/GateEngine/Resources/Import & Export/Importers/PNGImporter.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
* http://stregasgate.com
66
*/
77

8-
import GameMath
8+
public import Foundation
9+
public import GameMath
910

1011
public final class PNGImporter: TextureImporter {
1112
var data: Data! = nil
@@ -37,7 +38,7 @@ public final class PNGImporter: TextureImporter {
3738
}
3839
}
3940

40-
public func loadTexture(options: TextureImporterOptions) throws -> (data: Data, size: Size2) {
41+
public func loadTexture(options: TextureImporterOptions) throws(GateEngineError) -> (data: Data, size: Size2) {
4142
return (self.data, self.size)
4243
}
4344

Sources/GateEngine/Resources/Texture/Texture.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
* http://stregasgate.com
66
*/
77

8-
#if GATEENGINE_PLATFORM_SUPPORTS_FOUNDATION_FILEMANAGER
98
import Foundation
10-
#endif
119

1210
public enum MipMapping: Hashable, Sendable {
1311
/// No mipmapping
@@ -167,7 +165,7 @@ extension Texture: Equatable, Hashable {
167165
// MARK: - Resource Manager
168166

169167
public protocol TextureImporter: ResourceImporter {
170-
func loadTexture(options: TextureImporterOptions) async throws -> (data: Data, size: Size2)
168+
func loadTexture(options: TextureImporterOptions) throws(GateEngineError) -> (data: Data, size: Size2)
171169
}
172170

173171
public struct TextureImporterOptions: Equatable, Hashable, Sendable {
@@ -371,7 +369,7 @@ extension ResourceManager {
371369
throw GateEngineError.failedToLoad("No importer for \(fileExtension).")
372370
}
373371

374-
let texture = try await importer.loadTexture(options: key.textureOptions)
372+
let texture = try importer.loadTexture(options: key.textureOptions)
375373
guard texture.data.isEmpty == false else {
376374
throw GateEngineError.failedToLoad("File is empty.")
377375
}

0 commit comments

Comments
 (0)