Skip to content

Reusable UI components for both touch-based (iOS) and mouse-based (macOS) SpriteKit projects.

License

Notifications You must be signed in to change notification settings

nicolas-miari/SpriteKit-Controls

Repository files navigation

SpriteKit Controls

Reusable GUI components (a.k.a. controls) for touch-based (iOS) and mouse-based (macOS) SpriteKit projects.

Overall Design

The classes, while being SpriteKit node subclasses, should in principle mirror those in UIKit/AppKit (UIControl/NSControl, UIButton/NSButton), minus all the Cocoa/Objective-C-specific baggage (e.g., target-action design pattern, KVO/KVC, etc.) and adopt a more swifty design.

Class Hierarchy

Control

Subclasses SKSpriteNode and implements essential control logic: state, event handler registration, background texture/color per state. The implementation has platform-specific sections.

Button

Subclasses Control, implements:

  1. Button-specific logic - state transitions driven by touch/mouse events, consistent with button-like behavior (select on touch-down, etc.)
  2. Button-specific appearance - configurable title label.

To Do

Add more Control subclasses in the future (e.g., switch, slider, etc.).

Sample Project

The included sample project Example/Example.xcodeproj demonstrates the basic use of the Button control on both iOS and macOS SpriteKit apps.

About

Reusable UI components for both touch-based (iOS) and mouse-based (macOS) SpriteKit projects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages