TiledGlobals
public class TiledGlobals
The TiledGlobals
object provides information about the framework, as well as allowing
you to set default attributes for various objects.
Properties
renderer
: returns the current SpriteKit renderer (get-only).loggingLevel
: global logging verbosity.updateMode
: default tile update mode.enableRenderCallbacks
: enable callbacks from the tilemap on rendering statistics.enableCameraCallbacks
: enable callbacks from camera to camera delegates.renderQuality
: global render quality values.contentScale
: returns the device retina display scale factor.version
: returns the current framework version.
Usage
SKTiled framework default values are set in the TiledGlobals
object.
// access the default singleton instance
let tiledGlobals = TiledGlobals.default
// disable camera callbacks
tiledGlobals.enableCameraCallbacks = false
// set debugging mouse filters (macOS)
tiledGlobals.debugDisplayOptions.mouseFilters = [.tileCoordinates, .tilesUnderCursor]
// increase the default text object render quality
tiledGlobals.renderQuality.text = 12.0
-
Default
TiledGlobals
singleton.Declaration
Swift
public static var `default`: TiledGlobals { get }
-
Current SpriteKit renderer.
Declaration
Swift
public let renderer: Renderer
-
Speed modifier applied to all actions executed by the scene and its descendants.
Declaration
Swift
public internal(set) var speed: CGFloat { get set }
-
Returns the resource URL.
Declaration
Swift
public var resourceUrl: URL? { get }
-
Returns the URL of the current version’s documentation online.
Declaration
Swift
public var helpUrl: URL { get }
-
Indicates the current framework is a beta release.
Declaration
Swift
public var isBeta: Bool { get }
-
Indicates the current environment is a playground.
Declaration
Swift
public var isPlayground: Bool { get }
-
Framework domain.
Declaration
Swift
public var domain: String { get }
-
Indicates the current application is the demo.
Declaration
Swift
public var isDemo: Bool { get }
-
Indicates extra development features should be enabled.
Declaration
Swift
public var isDevelopment: Bool { get }
-
Default logging verbosity.
Declaration
Swift
public var loggingLevel: LoggingLevel
-
Default debug draw options for all node types.
Usage
drawGrid
: visualize the nodes’s tile grid.drawFrame
: visualize the nodes’s bounding rect.drawGraph
: visualize the nodes’s pathfinding graph.drawObjectFrames
: draw object’s bounding shapes.drawAnchor
: draw the layer’s anchor point.
Declaration
Swift
public var debugDrawOptions: DebugDrawOptions
-
Default tile update mode.
Declaration
Swift
public var updateMode: TileUpdateMode
-
Default layer z-position offset.
Declaration
Swift
public var zDeltaForLayers: CGFloat
-
User interface color.
Declaration
Swift
public var uiColor: SKColor
-
Default debugging objects lower range.
Declaration
Swift
public var lowerBoundForDebugging: CGFloat
-
Enable callbacks for render performance statistics.
Declaration
Swift
public var enableRenderPerformanceCallbacks: Bool
-
Enable callbacks from the tilemap to subscribers.
Declaration
Swift
public var enableTilemapNotifications: Bool
-
Enable infinite offset use.
Declaration
Swift
public var enableTilemapInfiniteOffsets: Bool { get set }
-
Enable callbacks from camera to camera delegates.
Declaration
Swift
public var enableCameraCallbacks: Bool
-
Allows the camera to update delegate when the contained nodes array changes. Disable this to improve render performance.
Declaration
Swift
public var enableCameraContainedNodesCallbacks: Bool
-
Default tile/object render quality attributes.
Declaration
Swift
public var renderQuality: RenderQuality
-
Debugging visualzation options.
The
DebugDisplayOptions
structure has attributes for attributes such as node highlight color, highlight duration as well as what kind of objects respond to mouse actions (macOS only).Declaration
Swift
public var debugDisplayOptions: DebugDisplayOptions
-
Render statistics display.
Declaration
Swift
public var timeDisplayMode: TimeDisplayMode
-
Mouse event limiter.
Declaration
Swift
public var mouseEventDelta: TimeInterval
-
Layer tinting options.
Declaration
Swift
public var layerTintAttributes: LayerTintOptions
-
Returns the current device screen resolution.
Declaration
Swift
public var screenSize: CGSize { get }
-
Returns a
CGRect
representing the screen (window) size.Declaration
Swift
public var screenRect: CGRect { get }
-
Returns the current device backing scale.
Declaration
Swift
public var contentScale: CGFloat { get }
-
Returns the current device OS.
Declaration
Swift
public var os: String { get }
-
Returns the name of the host application. (‘SKTiled’)
Declaration
Swift
public lazy var executableName: String { get set }
-
Returns current bundle identifier name. (‘org.sktiled.SKTiledDemo’)
Declaration
Swift
public lazy var identifier: String { get set }
-
Returns current bundle name. (‘SKTiled’)
Declaration
Swift
public lazy var bundleName: String { get set }
-
Returns a string for use with the main window’s title.
Declaration
Swift
public lazy var windowTitle: String { get set }
-
Returns current framework version.
Declaration
Swift
public lazy var version: Version { get set }
-
Returns current framework build (if any).
Declaration
Swift
public var build: String? { get }
-
Returns a prefernces path directory in the current user’s home directory (macOS only).
Declaration
Swift
public var exportDirectory: URL? { get }
Return Value
url of created directory.
-
Enable the demo app to load demo content.
Declaration
Swift
public var allowDemoMaps: Bool
-
Enable the demo app to load user content.
Declaration
Swift
public var allowUserMaps: Bool
-
Enable mouse events (macOS).
Declaration
Swift
public var enableMouseEvents: Bool
-
Image types readable by
Tiled
.Declaration
Swift
public var validImageTypes: [String]
-
File types readable by
Tiled
.Declaration
Swift
public var validFileTypes: [String]
-
The
RenderQuality
structure represents the render scaling factor used when dealing with higher resolutions & retina screen scale factors.Properties
default
: global render quality.object
: object render quality.text
: text object render qualityoverride
: override value.
Declaration
Swift
public struct RenderQuality
-
The
DebugDisplayOptions
structure represents global debugging visualization attributes.Properties
mouseFilters
: mouse interaction options.mousePointerSize
: mouse pointer font size.highlightDuration
: global highlight duration for selectable objects.
Declaration
Swift
public struct DebugDisplayOptions
-
Display flag for render statistics.
Properties
milliseconds
: show render time in milliseconds.seconds
: show render time in seconds.
Declaration
Swift
public enum TimeDisplayMode : Int, CaseIterable
-
Indicates the current renderer (OpenGL or Metal).
Properties
opengl
: indicates the current SpriteKit renderer is OpenGL.metal
: indicates the current SpriteKit renderer is Metal.
Declaration
Swift
public enum Renderer
-
Debugging display options.
Declaration
Swift
@available(*, deprecated, renamed: "debugDisplayOptions") public var debug: DebugDisplayOptions { get set }
-
Enable callbacks for render performance statistics.
Declaration
Swift
@available(*, deprecated, renamed: "enableRenderPerformanceCallbacks") public var enableRenderCallbacks: Bool { get set }