This repository was archived by the owner on Sep 14, 2025. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathmain.go
More file actions
117 lines (100 loc) · 2.69 KB
/
Copy pathmain.go
File metadata and controls
117 lines (100 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package main
import (
"fmt"
"image"
"image/color"
"path"
"strings"
g "github.com/AllenDang/giu"
"time"
)
const windowName string = "tJocer: The Joy of Creation: Reborn trainer"
const radarSize int = 1080
const windowSize int = 300
type LevelUnits struct {
pixelsIn1080Square int
unitsInSquare int
xoffset int
yoffset int
}
var mapUnits = map[string]LevelUnits {
"Freddy": LevelUnits{
pixelsIn1080Square: 165,
unitsInSquare: 789,
xoffset: -395,
yoffset: -330,
},
"Bonnie": LevelUnits{
pixelsIn1080Square: 55,
unitsInSquare: 320,
xoffset: -430,
yoffset: -500,
},
"Chica": LevelUnits{
pixelsIn1080Square: 55,
unitsInSquare: 320,
xoffset: -430,
yoffset: -500,
},
"Foxy": LevelUnits{
pixelsIn1080Square: 55,
unitsInSquare: 320,
xoffset: -430,
yoffset: -500,
},
}
func getUnits(level string) (float32, float32, int, int) {
var units = mapUnits[level]
var pixelsInRadarSquare = units.pixelsIn1080Square*radarSize/1080
var xUnitsInSquare = units.unitsInSquare
var zUnitsInSquare = units.unitsInSquare
var pixelsInUnitX float32 = float32(pixelsInRadarSquare)/float32(xUnitsInSquare)
var pixelsInUnitZ float32 = float32(pixelsInRadarSquare)/float32(zUnitsInSquare)
var xoffset int = units.xoffset
var yoffset int = units.yoffset
return pixelsInUnitX, pixelsInUnitZ, xoffset, yoffset
}
var focused bool = false
var wnd g.MasterWindow
var textures map[string]*g.Texture = make(map[string]*g.Texture)
func main() {
pid, pidFound := bindDefaultProcess()
if(pidFound) {
memoryReadInit(pid)
}
wnd := g.NewMasterWindow(
windowName, windowSize, windowSize,
g.MasterWindowFlagsNotResizable|g.MasterWindowFlagsFloating|g.MasterWindowFlagsFrameless|g.MasterWindowFlagsTransparent,
)
wnd.SetBgColor(color.RGBA{0, 0, 0, 0})
focused = true
wnd.SetPos(0, 0)
if(pidFound) {
initUI()
}
go refresh()
go loadTextures()
ChangeFocused(focused)
fmt.Println("tJocer started!")
wnd.Run(loop)
}
var texturesPaths []string = []string{"player.png", "maps/freddy.png", "maps/bonnie.png", "maps/foxy.png", "maps/chica.png"}
func loadTextures() {
ticker := time.NewTicker(time.Second * 1)
<-ticker.C
var texturesReferences map[*image.RGBA]string = make(map[*image.RGBA]string)
for _, textureFilePath := range texturesPaths {
filepath := "./images/" + textureFilePath
filepath = strings.ReplaceAll(filepath, "/", "\\")
img, _ := g.LoadImage(filepath)
texturesReferences[img] = textureFilePath
g.NewTextureFromRgba(img, func(tex *g.Texture) {
texturePath := strings.TrimSuffix(texturesReferences[img], path.Ext(texturesReferences[img]))
textures[texturePath] = tex
})
}
}
func ChangeFocused(newValue bool) {
focused = newValue
ModifyWindow(windowName, focused)
}