Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] object oriented widgets #210

Open
wants to merge 7 commits into
base: kivutar/widgets
Choose a base branch
from
Open

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.

1 participant