Forum Replies Created
-
AuthorPosts
-
Lastly. because of all the problems I am looking at completely scrapping mojox for something else that answers the above issues.
I think this is probably a good idea.
You’re obviously not getting into mojox and have plenty of your own ideas so go for it, it certainly wouldn’t hurt monkey2 to have several GUI systems.
Yep, it’s because it’s a property returning a struct.
When a property (or method, or function, or anything ‘callable’) returns a struct, it always returns a copy of the struct – that’s just how structs work, and is what really allows them to be so lightweight and require no memory management.
So the TargetVector property is only returning a ‘temporary’ copy of the Vec2f you’re interested in, and modifying this copy is effectively a NOP. All you can really do with this copy is read it – think of it being stored in a ‘hidden’ local…
The compiler does in fact detect writes to fields of temporary copies like this, ie: this generates a ‘not assignable’ error:
TargetVector.x+=10 ‘note: lowercase ‘x’ – ie: just the field!
But in the case where you’re assigning ‘x’ via the ‘X’ property, the compiler doesn’t/can’t know that the ‘X’ property assigns something to Self and doesn’t even try to detect this.
Getting this to generate an error is complicated. Either the user would have to mark properties/methods as ‘Const’ or not, ala c++, which is not a lot of fun, or the compiler has to automatically detect which properties/methods modify ‘Self’, which is trickier than it may sound. Just because X() might not write a field, it might invoke another method that (ultimately) *does* etc. In fact, thanks to functions pointers it may be logically impossible.
There are a number of reasons why this may not work – what error are you getting?
August 31, 2016 at 7:43 pm in reply to: Bug or not ? 2 times using a (mouse) event = ignoring both #3583KeyPressed and ButtonPressed pressed currently ‘clear’ themselves after being read.
This is because there’s not really an ‘update’ phase in mx2 the way there is in mx1 so the system doesn’t really know when to ‘auto clear’ them.
Thinking about it now though, I guess auto clearing these after rendering would be OK…
August 31, 2016 at 7:39 pm in reply to: Bug or not ? 2 windows only one draws something, and can't use variables #3582Multilpe windows has NOT been thoroughly tested yet is likely to cause problems!
Also, you can only use multiple windows on desktop targets, not mobile/web.
Lines can currently only be split after ‘[‘, ‘(‘ or ‘,’ tokens.
Something like this might work:
Monkey1234567891011121314151617181920Method OnMouseEvent( event:MouseEvent ) OverrideSelect event.TypeCase EventType.MouseDown'Begin drag...Case EventType.MouseUp'End drag...find drop view.Local point:=TransformPointToView( event.Location,Null )Local dropView:=Window.FindViewAtWindowPoint( point )If dropView'dropped on dropViewEndifEndEndLike I say, FindViewAtWindowPoint is technically ‘hidden’ right now, but we need some way to do this so have a play and let me know what you need!
You currently can’t (easily) – MouseDown ‘captures’ a view so that all successive mouse events until the next MouseDown are sent to the same view.
There’s a hidden method in View called ‘FindViewAtWindowPoint’ that could be used to help here – you’d need to transform the mouse location to ‘null’ (ie: window coords) and then pass this to ‘FindViewAt…’ – but there really needs to be a better way to do this.
Slice() can shrink an array but it can’t grow it – I still need to add a proper Resize().
Be careful – UpdateWindows is currently a hidden API and may or may not change in future or may become private etc (it probably should be).
I’ll have a go at adding App.Sleep…
Yay!
Check out the Timer code in spacechimps, the basic idea is:
New Timer( 60,OnUpdate )
…
Method OnUpdate()
EndI plan to add a ‘Sleep’ function to Fiber too.
Looks nice and easy, will have a hack at this today.
Published.
Sorry Shane!
It’s there and I’ll get it up ASAP. Just noticed it when deleting portaudio…
Not sure how I missed the auto-email, but there it is in my inbox so my bad.
-
AuthorPosts