oppwars/main.go
2025-08-06 00:00:33 +00:00

63 lines
1.3 KiB
Go

package main
import (
"fmt"
"os"
"strconv"
"bufio"
_ "embed"
"github.com/charmbracelet/lipgloss"
)
//go:embed menu.txt
var menu string
//go:embed officers.txt
var officers string
var stats string
var condoms = 10
var money = 1000
var border = lipgloss.NewStyle().
BorderStyle(lipgloss.NormalBorder()).
BorderForeground(lipgloss.Color("63"))
var statsStyle = lipgloss.NewStyle().
Foreground(lipgloss.Color("#ffffffff ")).
Background(lipgloss.Color("#0000FF"))
func ClearScreen() {
fmt.Print("\033[H\033[2J")
}
func MashEnterKey() {
fmt.Println(statsStyle.Render("Mash the 'Enter' key!"))
bufio.NewReader(os.Stdin).ReadBytes('\n')
}
func CheckStats() {
stats = "Condoms: " + strconv.Itoa(condoms) + "\n" + "Money: $" + strconv.Itoa(money) // builds the stats paragraph for the main screen
}
func MainScreen() {
CheckStats()
fmt.Println(border.Render("OPP Wars - Organized Crime Edition"))
fmt.Println(lipgloss.JoinHorizontal(lipgloss.Bottom, border.Render(menu), statsStyle.Render(stats))) // makes a horizontal display joining two paras
}
func main() {
officerStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("0000FF"))
fmt.Println(border.Render("OPP Wars - Organized Crime Edition"))
fmt.Println(officerStyle.Render(officers))
MashEnterKey()
ClearScreen()
MainScreen()
}