2023-12-23 00:09:07 +03:00
|
|
|
package main
|
|
|
|
|
2024-01-05 04:22:53 +03:00
|
|
|
import "vultras.su/core/gg"
|
2023-12-23 00:09:07 +03:00
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Debug struct {
|
2024-01-08 06:09:36 +03:00
|
|
|
gg.Object
|
2023-12-23 00:09:07 +03:00
|
|
|
}
|
|
|
|
|
2024-01-11 06:39:57 +03:00
|
|
|
func (d *Debug) Draw(c *Context) []gg.EVertex {
|
2023-12-23 00:09:07 +03:00
|
|
|
e := c.Engine
|
|
|
|
keyStrs := []string{}
|
2024-01-08 07:12:35 +03:00
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
|
|
|
"counter: %d", counter,
|
|
|
|
))
|
2023-12-26 23:31:04 +03:00
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
2024-01-11 06:39:57 +03:00
|
|
|
"tps: %d", int(c.Tps()),
|
2023-12-26 23:31:04 +03:00
|
|
|
))
|
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
2024-01-11 06:39:57 +03:00
|
|
|
"fps: %d", int(c.Fps()),
|
2023-12-26 23:31:04 +03:00
|
|
|
))
|
2024-01-13 21:45:56 +03:00
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
|
|
|
"dframe: %d", int(c.Dframe()),
|
|
|
|
))
|
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
|
|
|
"frame: %d", int(c.Frame()),
|
|
|
|
))
|
2023-12-26 23:31:04 +03:00
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
2023-12-28 02:31:43 +03:00
|
|
|
"relPlayerPos: %v", player.Position,
|
|
|
|
))
|
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
|
|
|
"absPlayerPos: %v", player.AbsPosition(),
|
|
|
|
))
|
|
|
|
|
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
|
|
|
"relTriPos: %v", tri.Position,
|
2023-12-26 23:31:04 +03:00
|
|
|
))
|
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
|
|
|
"absTriPos: %v", tri.AbsPosition(),
|
|
|
|
))
|
2023-12-27 01:35:50 +03:00
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
|
|
|
"absTriRot: %v", gg.Degree(tri.AbsRotation()),
|
|
|
|
))
|
2023-12-24 15:05:34 +03:00
|
|
|
|
|
|
|
keys := []string{}
|
2023-12-23 00:09:07 +03:00
|
|
|
for _, k := range e.Keys() {
|
2023-12-24 15:05:34 +03:00
|
|
|
keys = append(keys, k.String())
|
2023-12-23 00:09:07 +03:00
|
|
|
}
|
2023-12-24 15:05:34 +03:00
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
|
|
|
"keys: %s", strings.Join(keys, ", "),
|
|
|
|
))
|
|
|
|
|
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
|
|
|
"buttons: %v", c.MouseButtons(),
|
|
|
|
))
|
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
|
|
|
"wheel: %v", c.Wheel(),
|
|
|
|
))
|
|
|
|
/*if rectMove.ContainsPoint(e.AbsCursorPosition()) {
|
2023-12-23 00:09:07 +03:00
|
|
|
keyStrs = append(keyStrs, "contains cursor")
|
|
|
|
}
|
|
|
|
|
|
|
|
if rectMove.Vertices().Contained(rect).Len() > 0 ||
|
|
|
|
rect.Vertices().Contained(rectMove).Len() > 0 {
|
|
|
|
keyStrs = append(keyStrs, "rectangles intersect")
|
2023-12-24 15:05:34 +03:00
|
|
|
}*/
|
|
|
|
|
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf(
|
|
|
|
"camera position: %v %v",
|
|
|
|
c.Camera.Position.X,
|
|
|
|
c.Camera.Position.Y,
|
|
|
|
))
|
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf("realCursorPos: %v", e.CursorPosition()))
|
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf("absCursorPos: %v", e.AbsCursorPosition()))
|
2023-12-23 00:09:07 +03:00
|
|
|
keyStrs = append(keyStrs, fmt.Sprintf("absWinSize: %v", c.AbsWinSize()))
|
|
|
|
|
|
|
|
e.DebugPrint(c.Image,
|
|
|
|
strings.Join(keyStrs, "\n"))
|
2024-01-11 06:39:57 +03:00
|
|
|
|
|
|
|
return nil
|
2023-12-23 00:09:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (d *Debug) IsVisible() bool { return true }
|