Skip to content

natmark/HUDMakerKit

Repository files navigation

Header

Build Status Swift Pods Version Platforms Carthage Compatible GitHub license

HUDMakerKit

HUDMakerKit is customized Head-Up Display Maker written in Swift🐧.
HUDMakerKit has ProcessingKit engine. You can develop custom HUD with Processing draw functions.

Examples

HUD Code
SimpleHUD SimpleHUD_Code
AnimateHUD AnimateHUD Code
PeriodicallyHUD PeriodicallyHUD Code

Requirements

  • Swift 4.0 or later
  • iOS 10.0 or later

Usage

  1. 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.
    }
}
  1. 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
    }
}
  1. 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

Draw Oval in Processing

oval

// Draws an ellipse (oval) to the screen
// ellipse(center.x, center.y, width, height) 
ellipse(100, 100, 100, 100);

Fill an oval

oval_fill

// Sets the color used to fill shapes
// fill(R, G, B)

fill(255, 0, 0);
ellipse(100, 100, 100, 100);

Set the stroke color

oval_stroke

// 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);

Installation

Add the following to your Podfile:

  pod "HUDMakerKit"

Add the following to your Cartfile:

  github "natmark/HUDMakerKit"
  • Link your app with HUDMakerKit.framework and ProcessingKit.framework in Carthage/Build

Dependency

License

HUDMakerKit is available under the MIT license. See the LICENSE file for more info.