all features implemented

This commit is contained in:
Rory Hinnen
2026-09-07 15:27:33 -05:00
parent ac4d4a670a
commit 2a6130ba8e
64 changed files with 691 additions and 340 deletions
+50
View File
@@ -0,0 +1,50 @@
//
// IncrementDie.swift
// Bunch O' Dice
//
// Created by Rory Martin Hinnen on 6/7/22.
//
import SwiftUI
struct AddToPool: View {
@EnvironmentObject var current: Roll
var body: some View {
VStack {
Spacer()
Text(String(current.total) + " 🎲")
.font(.system(size: 40))
.padding(15)
HStack {
ForEach(Array(stride(from: 2, through: 0, by: -1)), id: \.self) { place in
VStack{
Text("▲")
.gesture(TapGesture().onEnded({
current.incrementDigits(place: place)
}))
Text(String(current.totalDigits[place]))
.padding(4)
.border(.black, width: 1.0)
Text("▼")
.gesture(TapGesture().onEnded({
current.decrementDigits(place: place)
}))
}
}
}
.font(.system(size: 45))
.padding(10)
Button("Clear", action: {current.total = 0})
Spacer()
}
}
}
struct IncrementDie_Previews: PreviewProvider {
static var previews: some View {
AddToPool()
.environmentObject(Roll())
}
}
+30
View File
@@ -0,0 +1,30 @@
//
// HistoryView.swift
// Bunch O' Dice
//
// Created by Rory Hinnen on 22/6/11.
//
import SwiftUI
struct HistoryView: View {
@EnvironmentObject var current: Roll
@Binding var isShowing: Bool
var body: some View {
VStack{
List(current.history) {event in
Text("\(event.poolTotal) Dice Rolled, \(event.total) \(event.state.print())")
}
Spacer()
Button("Dismiss", action: {isShowing.toggle()})
}
}
}
struct HistoryView_Previews: PreviewProvider {
static var previews: some View {
HistoryView(isShowing: .constant(false))
.environmentObject(Roll())
}
}
+41
View File
@@ -0,0 +1,41 @@
//
// SettingsView.swift
// Bunch O' Dice
//
// Created by Rory Hinnen on 22/7/2.
//
import SwiftUI
struct SettingsView: View {
@EnvironmentObject var current: Roll
@Binding var isShowing: Bool
var body: some View {
VStack{
VStack{
Text("DieHammer")
.font(.title)
Text("A roll management tool for Warhammer & Warhammer:40,000")
.font(.subheadline)
}.padding()
Group{
VStack{
Text("Theme")
Button(String(current.appearance.name)) {current.appearance.next()}
}
Button("Tutorial") {current.currentPage = "OnboardingView"}
.padding()
}
Spacer()
Button("Dismiss", action: {isShowing = false})
}
}
}
struct SettingsView_Previews: PreviewProvider {
static var previews: some View {
SettingsView(isShowing: .constant(true))
.environmentObject(Roll())
}
}