HUDMakerKit is customized Head-Up Display Maker written in Swift🐧.
HUDMakerKit has ProcessingKit engine. You can develop custom HUD with Processing draw functions.
HUD | Code |
---|---|
- Swift 4.0 or later
- iOS 10.0 or later
- Create custom class that inherits from
HUDMaker
class SampleHUD: HUDMaker {
func draw(frameCount: Int) {
// the draw() function continuously executes the lines of code contained inside its block until the program is stopped or noLoop() is called.
}
}
- Implement HUD animation in
draw()
func
class SampleHUD: HUDMaker {
func draw(frameCount: Int) {
// MARK: Examples
fill(255, 0, 0) // Sets the color used to fill shapes
ellipse(50, 50, 100, 100) // Draws an ellipse (oval) to the screen
}
}
- Create a CustomHUD instance & set CustomHUD to
HUDRunner
let customHUD = SampleHUD(frame: CGRect(x: 0, y: 0, width: 150, height: 150)) // Create a new instance
customHUD.backgroundColor = UIColor(red: 0.1, green: 0.1, blue: 0.1, alpha: 0.3)
customHUD.layer.cornerRadius = 10
HUDRunner.shared.customHUD = customHUD // Set a customHUD
HUDRunner.shared.show() // Show HUD
What's Processing
- Processing is a flexible software sketchbook and a language for learning how to code within the context of the visual arts.
- It provides drawing functions with simple syntax
- References
// Draws an ellipse (oval) to the screen
// ellipse(center.x, center.y, width, height)
ellipse(100, 100, 100, 100);
// Sets the color used to fill shapes
// fill(R, G, B)
fill(255, 0, 0);
ellipse(100, 100, 100, 100);
// Sets the color used to draw lines and borders around shapes
// stroke(R, G, B)
// Sets the width of the stroke used for lines, points, and the border around shapes.
// strokeWeight(weight)
stroke(255, 0, 0);
strokeWeight(5);
ellipse(100, 100, 100, 100);
Add the following to your Podfile
:
pod "HUDMakerKit"
Add the following to your Cartfile
:
github "natmark/HUDMakerKit"
- Link your app with
HUDMakerKit.framework
andProcessingKit.framework
in Carthage/Build
HUDMakerKit is available under the MIT license. See the LICENSE file for more info.