visualizer

package
v0.0.0-...-25b37e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 27, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	W            = 820
	H            = 820
	MARGIN       = 120
	TILE_SIZE    = 150
	TILE_PADDING = 8
)

for Visulize_Game()

View Source
const NUMBER_OF_NUMBERS = 16

Variables

This section is empty.

Functions

func Draw_Tile

func Draw_Tile(x, y, w, h int32, n int)

func ImageFromFilePath

func ImageFromFilePath(filePath string) (image.Image, error)

@Todo not needed

func KeyCallback

func KeyCallback(w *glfw.Window, key glfw.Key, scancode int, action glfw.Action, mods glfw.ModifierKey)

func Make_Plot

func Make_Plot(w, h int, user_data *Data_Info) (image.Image, error)

func Play_Game

func Play_Game(gs *game.GameState)

func Pre_Render_Image

func Pre_Render_Image(w, h int, png image.Image) uint32

renders a text and loads it to the gpu, returns the texture_id

func Pre_Render_Text_Centered

func Pre_Render_Text_Centered(w, h int, text string, c color.RGBA, fontFace font.Face) uint32

renders a text and loads it to the gpu, returns the texture_id

func Visualize_Game

func Visualize_Game(gs *game.GameState, driver_moves []game.Direction, move_time float32, delay_on_gameover float32)

Types

type Animation_State

type Animation_State struct {
	State1 game.GameState
	State2 game.GameState
	T      float64 // form 0 to 1
	Dt     float64
}

type Data_Info

type Data_Info struct {
	XY     []XYData
	XLabel string
	YLabel string
	Title  string
}

type Game_Driver

type Game_Driver struct {
	DriverMoves     []game.Direction
	MoveTime        float32
	DelayOnGameover float32
}

type Game_Visual_State

type Game_Visual_State struct {
	Window    *glfw.Window
	Destroyed bool

	Game   *game.GameState
	Driver *Game_Driver

	GameTime float64
	// contains filtered or unexported fields
}

func New_Game_Visual

func New_Game_Visual(gs *game.GameState, driver *Game_Driver) *Game_Visual_State

the driver can be 'nil' then it is just interactable if driver is provided, we use it to play the game (for now it's just a struct that defines some variables)

func (*Game_Visual_State) Update_And_Draw

func (gvc *Game_Visual_State) Update_And_Draw()

type Graph_Viz

type Graph_Viz struct {
	UserData *Data_Info // here the data should be set/updated by the user before Update_And_Draw()

	Window    *glfw.Window
	W, H      int
	Destroyed bool
	Initted   bool
	// contains filtered or unexported fields
}

func (*Graph_Viz) Update_And_Draw

func (gv *Graph_Viz) Update_And_Draw()

type Input_State

type Input_State struct {
	Pressed    bool // gets reset to false when handeled
	Dir        game.Direction
	Quit       bool
	Interacted bool
}

type XY

type XY = plotter.XY

type XYData

type XYData struct {
	XYs   plotter.XYs
	Label string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL