Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kivutar
Copy link
Member

@kivutar kivutar commented Jul 2, 2019

Allows drawing UI like this with a syntax that reminds of html/css/react

Screen Shot 2019-07-14 at 11 36 44 AM

Code:

mkVBox(wProps{
	Color:        video.Color{0, 0, 0, 0.95},
	BorderRadius: 0.1,
	Padding:      Dirs(40),
	Margin:       Dirs(40),
},
	mkLabel(wProps{
		Scale:   0.8 * menu.ratio,
		Height:  50,
		Padding: Dirs(20, 0),
		Color:   video.Color{1, 1, 1, 1},
	}, "Hello world"),
	mkLabel(wProps{
		Scale:   0.6 * menu.ratio,
		Height:  50,
		Padding: Dirs(20, 0),
		Color:   video.Color{1, 1, 1, 0.75},
	}, "Here is a nice screenshot:"),
	mkImage(wProps{
		Width:   640,
		Height:  480,
		Color:   video.Color{1, 1, 1, 1},
		Scale:   1,
		Padding: Dirs(20, 0),
	}, menu.icons["zelda"]),
	mkHBox(wProps{},
		mkButton(wProps{
			Color:        video.Color{1, 1, 1, 0.25},
			BorderRadius: 1,
			Margin:       Dirs(20, 0, 0, 20),
			Padding:      Dirs(0, 0, 20, 40),
		}, "key-z", "Cancel"),
		mkButton(wProps{
			Color:        video.Color{0, 0.5, 0, 1},
			BorderRadius: 1,
			Margin:       Dirs(20, 0, 0, 20),
			Padding:      Dirs(0, 0, 20, 40),
		}, "key-x", "Share"),
	),
).Draw(0, 0)

@kivutar kivutar changed the base branch from master to kivutar/widgets July 2, 2019 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants