examples

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 8 Imported by: 5

README

Examples

Here you can find a overview of examples on how to use demoinfocs-golang.

ℹ Example code may not be production ready - specifically error handling and such is done in a simplified way and should not be used in critical systems as-is.

Example Description
heatmap Creating a heatmap from positions where players fired shots from
nade-trajectories Map overview with grenade trajectories
voice-capture Capture voice data from players
entities Using unhandled data from entities (Parser.ServerClasses())
net-messages Parsing and handling custom net-messages
encrypted-net-messages Parsing and handling encrypted net-messages (e.g. text chat in MM demos)
print-events Printing kills, scores & chat messages
mocking Using the fake package to write unit tests for your code
web-assembly Using the library from JavaScript (browser/node) with WebAssembly
more examples A collection of unpolished GitHub Gists based on past requests

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DemoPathFromArgs

func DemoPathFromArgs() string

DemoPathFromArgs returns the value of the -demo command line flag. Panics if an error occurs.

func GetMapRadar

func GetMapRadar(name string, crc uint32) image.Image

GetMapRadar fetches the radar image for a specific map version from `https://radar-overviews.csgo.saiko.tech/<map>/<crc>/radar.png`. Panics if any error occurs.

func RedirectStdout

func RedirectStdout(f func())

RedirectStdout redirects standard output to dev null. Panics if an error occurs.

Types

type Map

type Map struct {
	PosX  float64 `json:"pos_x,string"`
	PosY  float64 `json:"pos_y,string"`
	Scale float64 `json:"scale,string"`
}

Map represents a CS:GO map. It contains information required to translate in-game world coordinates to coordinates relative to (0, 0) on the provided map-overviews (radar images).

func GetMapMetadata

func GetMapMetadata(name string, crc uint32) Map

GetMapMetadata fetches metadata for a specific map version from `https://radar-overviews.csgo.saiko.tech/<map>/<crc>/info.json`. Panics if any error occurs.

func (Map) Translate

func (m Map) Translate(x, y float64) (float64, float64)

Translate translates in-game world-relative coordinates to (0, 0) relative coordinates.

func (Map) TranslateScale

func (m Map) TranslateScale(x, y float64) (float64, float64)

TranslateScale translates and scales in-game world-relative coordinates to (0, 0) relative coordinates. The outputs are pixel coordinates for the radar images found in the maps folder.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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