summaryrefslogtreecommitdiff
path: root/engine/UI/Void.go
blob: e23d252676fe148ceddce2eb87c3335c38bc5965 (plain)
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
package ui

import (
	"encoding/json"
	"fmt"

	rl "github.com/gen2brain/raylib-go/raylib"
)

type Void struct {
	Weight float32
}

// Used in the element parsing from JSON
const VoidTypeName string = "void"

func (base *Void) Init(*Menu) {
	if base.Weight == 0 {
		base.Weight = 1
	}
}

func (base *Void) Destroy() {
}

func (base *Void) GetOccupationWeight() float32 {
	return base.Weight
}

func (base *Void) Draw(*rl.Rectangle) {
}

func (base Void) String() string {
	var outp, jsonErr = json.Marshal(base)
	if jsonErr != nil {
		return fmt.Sprintf("Failed to parse void: %s", jsonErr.Error())
	}
	return string(outp)
}