About Monkey 2 › Forums › Monkey 2 Projects › sneak preview of new ui controls
This topic contains 17 replies, has 5 voices, and was last updated by 
 AdamStrange
 2 years, 7 months ago.
- 
		AuthorPosts
 - 
		
			
				
August 23, 2016 at 11:26 am #3367
I was impressed by the recent widget done with mojox, so I decided to try and get V1.02 and V1.03 monkey2 synchronised.
Here is the result. So far there is a base button and a grid control.
The grid control can be subclassed and in this case is shown subclassed into a color picker and also an image picker.
When picking a color the button changes to that color
Basically I am going to create a sprite editor
Here is the main code to see the basic layout and lambdas:
Monkey1234567891011121314151617181920212223242526272829progress = New UXProgressBar(40)button = New UXButton("Press Me", ALIGN_CENTERED, 100, 40)' button.Enabled = false' button.TextStyle = TEXTSTYLE_BOLDSHADOWbutton.Clicked = Lambda()Print "clicked"endbutton.ClickDown = Lambda()Print "click down"endgrid = New UXColorGrid( 200, 200)grid.ClickDown = Lambda()button.ButtonColor = grid.ColPrint "clicked value:" + grid.ValueendLocal image := Image.Load( "asset::ux-brush.png" )imageGrid = New UXImageGrid( 200, 200, image, 16)timer = New Timer(96, OnUpdate)Local dockingView := New DockingViewdockingView.AddView( progress, "top" )dockingView.AddView( button, "left" )dockingView.AddView( grid, "left" )dockingView.AddView( imageGrid, "left" )AddChild( dockingView )Note the button can have different text looks, also text is now Aligned with proper Align.
E.G. ALIGN_LEFT | ALIGN_TOP, or ALIGN_BOTTOM
None of the nonsensical ‘gravity”
The grid control can be programmed with different grids E.G. 2×3 or 1×12, etc
This is V1.02 code. The V1.03 only has one line changed, so should compile straight off with no problems
Attachments:
August 23, 2016 at 2:22 pm #3369August 23, 2016 at 5:29 pm #3371August 24, 2016 at 11:30 am #3397now with saturation allowing fine control over colors, clear color, random rotation of brushes giving very subtle effects:
Attachments:
August 24, 2016 at 12:44 pm #3403Ohh, nice! I’ll stick to Aseprite for now though!!
August 24, 2016 at 1:08 pm #3405None of the nonsensical ‘gravity”
Gravity is a view property in most modern layout engines. From the mojox documentation:
if a view’s layout is “fill”, the view is resized to completely fill its frame; if layout is “float”, the view retains its measured size but is positioned within its frame according to its View.Gravity.
Typically alignment is a feature of a text paragraph left, center, right or justified and hence doesn’t really represent the same property in my mind.
August 24, 2016 at 1:18 pm #3406textalign = ALIGN_LEFT – yep
textalign = gravity(0, 0) – nah
I’ll stick with align
August 24, 2016 at 1:40 pm #3407OK, I don’t understand. You have added a textalign property to labels?
label.Gravity.X=-1 ‘ awesome
August 24, 2016 at 2:14 pm #3409nope, but I can create a new control label with this if you want it?
I come from windows controls and traditional page layout. so left aligned text is on the left, right aligned is on the right, centered or middle is in the middle
similarly vertical align is top middle or bottom
So top left = ALIGN_TOPLEFT
or bottom right = ALIGN_BOTTOMRIGHT
I should add that all this stuff does not touch mojox controls. these are new.
Slight update. added ability to pick a color from the canvas and put it in the base palette:
This is consistent with the Quantel systems (Paintbox, Harry, etc)
Loading saving of palettes will be the last before everything starts to get integrated directly into ted21
August 25, 2016 at 6:33 am #3436Added panel and more controls
This shows the flexibility of Mojox as a control system.
Here are some file additions and new palette sizer. There was a bit of crashing until I found I needed Update() after hiding/unhiding controls. after that it all went smooth
Also added image buttons and image checkbuttons
The grid need a little tidying, but it all works very smoothly
The only minus is to do with GUI complexity. the more you add the more things get messy. But that is a problem all GUI’s have: there is more code dealing with the GUI than with the actual meat of the program.
MojoX goes some way to making this a simple thing
August 25, 2016 at 10:03 am #3442Just to show something different can be done.
Here is a base prototype synth UI – Yep I redid the label control now as well
It’s based on the Roland Juno 60 design
Attachments:
August 25, 2016 at 12:45 pm #3447Nice work Adam. Always love to see people experimenting with making painting or composing tools and associated code.
August 26, 2016 at 10:43 am #3467just been implementing some basic brush styles there are four types:
normal, alpha, scatter, scatter alpha
I’ve also implemented loading of images into the paint palette, so you can pick up colors, or even paint back onto the image (although it’s really meant for color mixing)
August 26, 2016 at 10:55 am #3470I think the best thing now is to directly integrate the paint control back into ted21
From there have two new document types:
palette – collection of colors up to 256 entries. palettes can be loaded by the paint control and also created and saved by it too.
brush – 256 x 16 pixel size, which is 16 brushes. these can then be edited and saved. And also loaded by the paint control.
In essence the brush document is a fixed size horizontal sprite atlas.
I suppose next up would be to make a sprite atlas/sprite document next with would be a simple case of extending the above brush document.
Behind the scenes I’ve also adde functions into mojo/graphics/canvas for full support of the brushes and atlas functions, including non square sprite rendering (deformations) – if anyone is interested
August 26, 2016 at 12:55 pm #3472Does Ted21 going to use the latest MX2 version ?
I can see problems if you are behind the main version, and people want to use the latest MX2 version.Maybe you can concentrate to write modules for the official ted2 version.
That way your work is future proof and you reach more people - 
		AuthorPosts
 
You must be logged in to reply to this topic.










