Skip to content

Commit

Permalink
Sensanai:: Added CLI flags.
Browse files Browse the repository at this point in the history
Sensanai:: Added help.
README:: Added Usage instructions.
  • Loading branch information
losthearts committed Apr 15, 2024
1 parent d2c0d3b commit 5c28482
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 4 deletions.
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ A tool made to convert sensitivities between games.
- Use `sensanai` for the tui application.
- Use `sensanai -gui` for the gui application.

---

## INSTALLATION.

- Clone the git repository and cd into it:
Expand All @@ -17,4 +15,32 @@ A tool made to convert sensitivities between games.
- Run `go install`.
- Make sure that your `go/bin` directory is added to `$PATH`.

## USAGE

```
Sensaina 繊細な
A tool to convert sensitivities between games
Currently CS:GO, Overwatch, and Valorant is supported.
Use without any flags to run the TUI
--gui || -g
Use this flag to run the Sensaina GUI
===
sensanai --flag value
--from
From Game.
--to
To Game.
--sens
Initial Sensitivity.
--idpi
Initial DPI.
--fdpi
Final DPI.
```

---

> Inspired from: [convert-sens](https://github.com/succumbs/convert-sens/).
Binary file modified sensaina
Binary file not shown.
61 changes: 59 additions & 2 deletions sensaina.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"flag"
"fmt"
"os"
"strconv"
Expand All @@ -21,16 +22,72 @@ var finaldpi int64

func main() {
if len(os.Args) != 1 {
if os.Args[1] == "-gui" {
if os.Args[1] == "--gui" || os.Args[1] == "-g" {
gui()
} else if os.Args[1] == "-h" || os.Args[1] == "--help" {
help()
} else {
fmt.Printf("Unexpected argument :: %v\n", os.Args[1])
cli()
}
} else {
tui()
}
}

func help() {
fmt.Printf("Sensaina 繊細な\n")
fmt.Printf("A tool to convert sensitivities between games\n")

fmt.Printf("Currently CS:GO, Overwatch, and Valorant is supported.\n\n")
fmt.Printf("Use without any flags to run the TUI\n\n")

fmt.Printf("--gui || -g \n")
fmt.Printf("\tUse this flag to run the Sensaina GUI\n===\n\n")

fmt.Printf("sensanai --flag value\n")

fmt.Printf("--from\n")
fmt.Printf("\tFrom Game.\n")

fmt.Printf("--to\n")
fmt.Printf("\tTo Game.\n")

fmt.Printf("--sens\n")
fmt.Printf("\tInitial Sensitivity.\n")

fmt.Printf("--idpi\n")
fmt.Printf("\tInitial DPI.\n")

fmt.Printf("--fdpi\n")
fmt.Printf("\tFinal DPI.\n")
}

func cli() {
fromGamePtr := flag.String("from", "CS:GO", "From Game")
toGamePtr := flag.String("to", "CS:GO", "To Game")
fromSensPtr := flag.Float64("sens", 100, "From Sensitivity")
fromDPIPtr := flag.Int64("idpi", 800, "Initial DPI")

flag.Parse()

toDPIPtr := flag.Int64("fdpi", *fromDPIPtr, "Final DPI")

flag.Parse()

sensitivity := sens(yaw[*fromGamePtr], yaw[*toGamePtr], *fromSensPtr, *fromDPIPtr, *toDPIPtr)
cm360 := cmpi(yaw[*fromGamePtr], *fromSensPtr, *fromDPIPtr)

fmt.Printf("Sensitivity: %f\n", sensitivity)
fmt.Printf("Centimeter/360: %f\n\n", cm360)

fmt.Println("Initial Game: ", *fromGamePtr)
fmt.Println("Final Game: ", *toGamePtr)
fmt.Println("From Sensitivity: ", *fromSensPtr)
fmt.Println("From DPI: ", *fromDPIPtr)
fmt.Println("To DPI: ", *toDPIPtr)

}

func tui() {

b := lipgloss.NewStyle().Background(lipgloss.Color("#000")).Bold(true).Italic(true).Underline(true).Foreground(lipgloss.Color("#FDB0C0")).Render
Expand Down

0 comments on commit 5c28482

Please sign in to comment.