Documentation
¶
Index ¶
- func AddWidth(img *image.RGBA, dist int, c color.RGBA) *image.RGBA
- func Blur(img *image.RGBA, size int, kernal []float64) *image.RGBA
- func ConsolePrompt(text string) string
- func Convolution(img *image.RGBA, x, y, size int) []color.RGBA
- func DistanceTolerance(a, b f64.Vec2, epsilon float64) bool
- func DrawRect(w, h, t, edge int, c color.RGBA) *image.RGBA
- func G(x, y, sigma float64) float64
- func Kernal(size int, sigma float64) []float64
- func LoadPNG(name string) *image.RGBA
- func Neon(img *image.RGBA, light, blur int, sigma float64, c color.RGBA, ...) *image.RGBA
- func Paint(img *image.RGBA, x, y, radius int, c color.RGBA)
- func PosToUint(p uint) uint
- func SegmentsIntersect(x1, y1, x2, y2, x3, y3, x4, y4 float64) (float64, float64, error)
- func SimpleAlphaComposite(s, b color.RGBA) color.RGBA
- func Tolerance(a, b, epsilon float64) bool
- func WritePNG(path string, img image.Image) error
- type Bits
- type Camera
- func (c *Camera) GeoM() ebiten.GeoM
- func (c *Camera) GetPosition() (float64, float64)
- func (c *Camera) IsPointInViewport(wx, wy float64) bool
- func (c *Camera) Matrix() ebiten.GeoM
- func (c *Camera) Pan(x, y float64)
- func (c *Camera) Render(screen, world *ebiten.Image)
- func (c *Camera) Reset()
- func (c *Camera) Rotate(a float64)
- func (c *Camera) Scale() float64
- func (c *Camera) ScreenToWorld(posX, posY int) (float64, float64)
- func (c *Camera) SetPosition(x, y float64)
- func (c *Camera) SetViewPort(w, h int)
- func (c *Camera) SpriteGeoMConcat(sprite ebiten.GeoM) ebiten.GeoM
- func (c *Camera) String() string
- func (c *Camera) Update()
- func (c *Camera) WorldToScreen(wx, wy float64) (float64, float64)
- func (c *Camera) WorldToScreen32(wx, wy float64) (float32, float32)
- func (c *Camera) ZoomIn(n int)
- func (c *Camera) ZoomOut(n int)
- type EmbedFS
- type FS
- func (f *FS) GetFontFace(path string, size, dpi float64) (font.Face, error)
- func (f *FS) GetGoTextFaceSource(path string) *text.GoTextFaceSource
- func (f *FS) GetImage(path string) (*ebiten.Image, error)
- func (f *FS) GetRGBA(path string) (*image.RGBA, error)
- func (f *FS) MustGetFontFace(path string, size, dpi float64) font.Face
- func (f *FS) MustGetImage(path string) *ebiten.Image
- func (f *FS) MustReadCSV(path string) [][]string
- func (f *FS) MustReadFile(path string) []byte
- func (f *FS) Open(path string) (fs.File, error)
- func (f *FS) ReadCSV(path string) ([][]string, error)
- func (f *FS) ReadDir(path string) ([]fs.DirEntry, error)
- func (f *FS) ReadFile(path string) ([]byte, error)
- type ID
- type Scene
- type SceneManager
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddWidth ¶
AddWidth light effect to any pixel with 255 in alpha channle within `dist` from the pixels
func Blur ¶
Return a new image applying Gaussian Blur Note, for my purpose, the reutrn image size is larger by the size of the kernal, to capture the entire bluring effect
func ConsolePrompt ¶
ConsolePrompt takes a text prompt, wait for and return user input
func Convolution ¶
Return the RGBA values of kernal with `size` x `size` in a list
func DistanceTolerance ¶
DistanceTolerance check if two 2D positions are close enough
func Neon ¶
func Neon(img *image.RGBA, light, blur int, sigma float64, c color.RGBA, origin, resize bool) *image.RGBA
Neon add neon light effect of an image, Neon adds color `c` within `light` pixels away from any pixels with 255 for alpha channel. Gaussian blur is applied with sqaure of width `blur`, and `sigma` as Gaussian standard deviation If `origin`, original image is draw on top of new image If `resize`, new image will be larger due to Gaussian effect on the edge
func SegmentsIntersect ¶
SegmentsIntersect find intersection point between line pt1 to pt2 and pt3 and pt4 return error if no intersection
func SimpleAlphaComposite ¶
Simple Alpha Composite source with background pixel https://www.w3.org/TR/compositing-1/#simplealphacompositing
Types ¶
type Camera ¶
type Camera struct { ViewPort f64.Vec2 // viewport should be the same as the window size/resolution Position f64.Vec2 // points camera to `Position` in the world ZoomFactor int Rotation float64 // contains filtered or unexported fields }
Camera projects world to Screen
func (*Camera) GeoM ¶
func (c *Camera) GeoM() ebiten.GeoM
Ebiten GeoM, usage sprite.GeoM.Concat(camera.GeoM)
func (*Camera) GetPosition ¶
GetPosition return x, y
func (*Camera) IsPointInViewport ¶
IsPointInViewport check is a point in on screen
func (*Camera) Render ¶
func (c *Camera) Render(screen, world *ebiten.Image)
Render draw `world` image on screen
func (*Camera) SetPosition ¶
SetPosition moves camera to location x, y
func (*Camera) SetViewPort ¶
SetViewPort set the size of the window
func (*Camera) SpriteGeoMConcat ¶
func (c *Camera) SpriteGeoMConcat(sprite ebiten.GeoM) ebiten.GeoM
DEPRECATED, Concat camera's matrix with m
func (*Camera) WorldToScreen32 ¶
WorldToScreen32 return x, y in float32, ebiten screen drawing use float32
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
func (*FS) GetFontFace ¶
func (*FS) GetGoTextFaceSource ¶
func (*FS) MustGetImage ¶
func (*FS) MustReadCSV ¶
func (*FS) MustReadFile ¶
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
func NewIDGenerator ¶
func NewIDGenerator() *ID
func (*ID) SetCurrent ¶
Up to the caller to ensure id is still unique
type SceneManager ¶
type SceneManager struct {
// contains filtered or unexported fields
}
func NewSceneManager ¶
func NewSceneManager(w, h, transitionFrames int) *SceneManager
Create new scene manager, where w - screen width, h - screen height, transitionFrames - number of frames to transit between scenes
func (*SceneManager) Draw ¶
func (s *SceneManager) Draw(r *ebiten.Image)
func (*SceneManager) GoTo ¶
func (s *SceneManager) GoTo(scene Scene)
func (*SceneManager) Update ¶
func (s *SceneManager) Update() error