include diehammer plan docs

This commit is contained in:
Rory Hinnen
2026-08-08 18:37:59 -05:00
parent ae99e94cd7
commit 17f2b0a288
67 changed files with 1991 additions and 50 deletions
@@ -0,0 +1,50 @@
//
// Die.swift
// Bunch O' Dice
//
// Created by Rory Hinnen on 22/2/20.
//
import SwiftUI
struct SingleDie: View {
@EnvironmentObject var current: Roll
@State var whichDie: Dice.DiceType
var body: some View {
VStack {
Text(String(current.dice.value(which: whichDie)))
Group {
if (current.state != .armour) && (whichDie.rawValue >= current.cutoff.rawValue) {
Text(whichDie.print())
.foregroundColor(Color.red)
} else if (current.state == .armour) && (whichDie.rawValue < current.cutoff.rawValue) {
Text(whichDie.print())
.foregroundColor(Color.red)
} else {
Text(whichDie.print())
.foregroundColor(Color.black)
.background(Color.white)
}
}
.font(.system(size: 45))
}
.font(/*@START_MENU_TOKEN@*/.title/*@END_MENU_TOKEN@*/)
.padding(.horizontal, 5.0)
.gesture(TapGesture().onEnded {
if current.state == .hit {
current.hitCutoff = whichDie
}
else if current.state == .armour {
current.armourSave = Int(whichDie.rawValue)
}
})
}
}
struct Die_Previews: PreviewProvider {
static var previews: some View {
Die(whichDie: .one)
.environmentObject(Roll())
}
}
@@ -0,0 +1,29 @@
//
// SwiftUIView.swift
// Bunch O' Dice
//
// Created by Rory Martin Hinnen on 6/7/22.
//
import SwiftUI
struct ShowPoolLandscape: View {
@EnvironmentObject var current: Roll
var body: some View {
HStack {
Spacer()
ForEach(Dice.DiceType.allCases, id: \.rawValue) { i in
SingleDie(whichDie: i)
}
Spacer()
}
}
}
struct ShowPool_Previews: PreviewProvider {
static var previews: some View {
ShowPoolLandscape()
.environmentObject(Roll())
}
}