Mark Sibly

Forum Replies Created

Viewing 15 posts - 181 through 195 (of 1,431 total)
  • Author
    Posts
  • in reply to: 3D Grid-based movement #13315

    Mark Sibly
    Keymaster

    Also, how can I remove the old file attachment from my initial post?

    Should be gone now?

    Thanks for the update too!

    in reply to: Mojox Mouse Event destroyed #13314

    Mark Sibly
    Keymaster

    I wanted it to be able to use any element that extends a view and then, instead of having to specifically know if the (or which) element being added can have a click being listened to, be able to register clicks based on cells rather than what specific element is added in.

    I’m not 100% comfortable with this because it means the behaviour of the added view may not be consistent. Many views wont work properly if you’re stealing mouse events – in fact, only views that have (or could have) a simple Clicked:Void() signal will really work (as expected) with a view like your TGrid.

    That said, have a play with View.AcceptsKeyEvents and View.AcceptsMouseEvents – just remembered these even existed! Set these to false and views will send key/mouse events to parent views.

    As for ‘composable’ guis, the idea is nice in theory but in my experience they are kind of a PITA in practice. Having a button (and other view types) that can have both text and an icon is just incredibly convenient, esp. if your ‘hand coding’ GUIs. And beyond buttons, what else really needs to (or can) be composed (apart from layouts)? Fancier buttons I guess…

    in reply to: Compiling on Ubuntu 14.04 LTS (fresh install) #13307

    Mark Sibly
    Keymaster

    libsdl2-dev

    This apt-get makes things so much easier, thanks SDL!

    in reply to: How to find out when mouse is moving #13306

    Mark Sibly
    Keymaster

    …add a method to your window class like this:

    …or, you can just ‘poll’ for mouse movement by reading Mouse.X and Mouse.Y and comparing them with older readings.

    in reply to: Mojox Mouse Event destroyed #13305

    Mark Sibly
    Keymaster

    What are you trying to achieve here though?

    If the user clicks on a button and *something else* happens, isn’t that confusing?

    What is the ‘real world’ use for this? Not the hypothetical ‘I want to be able to intercept events’ use, but the practical “I want to create a widgets that does XYZ’?

    [edit]One thing I was thinking of doing originally was to add a ‘top down’ event filter system.

    So before a view gets sent an event, all its parent views get a chance to filter the event first, using something like, say, OnFilterMouseEvent( event:MouseEvent ) etc. If a parent eats the event, the event is never sent to the child view, ie: it’s default prevented in a sense (although I never really got my head around how preventDefault worked in JS, I just used it as and when instructed to by stack overflow – I found the JS event system confusing and I don’t want to emulate it).

    Here, I was thinking mainly of a GUI editor app where you want to go into a ‘mode’ to drag GUI elements around. I sort of forgot it about it because auto-layout solves most layout problems (or should anyway) and writing a GUI editor would have been a waste of time.

    in reply to: How declare an multidimensional array #13304

    Mark Sibly
    Keymaster

    Multi-dimensional arrays aren’t too well supported yet, in particular there’s no way to intiailize them with values at creation time yet.

    Creating them is easy enough, eg: Local myArray:=New Int[10,20], but you’ll have to get a bit tricky to initialize them, maybe something like:

    (totally untested). Of course, string are also a cool way to do this…

    Peronsally, I’d recommend creating a ‘Piece’ class or similar just to make all the arrays easier to deal with (although you seem to be quite comfortable with arrays!) as you’re also gonna wanna ‘Rotate’ them etc. Then you can just have a 1d array of pieces for the game, and give each piece a rotate method, maybe a clone method too for creating new pieces from template pieces etc. Just off the top of my head – I’ve never actually written a tetris game!

    in reply to: How to import obj model and how to use color alpha #13240

    Mark Sibly
    Keymaster

    ship.Mesh.FitVertices(New Boxf(1,1),False)

    This looks wrong. New Boxf( 1,1 ) will create a 0 volume box as min and max are both 1. Try New Boxf( -1,1 ) instead.

    in reply to: How to import obj model and how to use color alpha #13238

    Mark Sibly
    Keymaster

    It’s missing the #imports at the top! Please post again…

    in reply to: How to import obj model and how to use color alpha #13236

    Mark Sibly
    Keymaster

    This is often a sign that your model isn’t loading properly.

    What you can do is put ‘Assert( model )’ after the Model.Load call to verify it did in fact load correctly.

    Can you post the entire sourcec code? It’s generally much easier for us to spot problems if we can see the entire progam.

    in reply to: Some letterbox 3d #13197

    Mark Sibly
    Keymaster

    Add a ‘_camera.Viewport=Rect’ just after you create camera.

    Or better yet, use ‘_camera.View=Self’ instead as this will be able to handle resizable  views too.

    Cameras currently draw to the entire canvas viewport regardless of what camera viewport is set to (but DO use the camera viewport to calculate projection matrix based on FOV) – this may change when I start messing around with multiple cameras, child views etc.

    For now, safest thing to do is to attach view to camera.

    in reply to: canvas.Rotation vs Trig function rotation #13193

    Mark Sibly
    Keymaster

    I had a quick look at bmx (welll, glanced at digesteroids src), and rotation seems to be the same there, ie: +rotation=ccw. And I think, in the context of  a +y=down coord system this is actually correct, these are just numbers after all.

    What people are possibly really after here is a way to change +y=down to +y=up? This is probably doable and I think would be quite cool – cooler than just fudging rotation or something.

    in reply to: OnFinalize #13190

    Mark Sibly
    Keymaster

    If you extend the Resource class, you can implement an OnFinalize (and OnDiscard) method. OnFinalize will only be called if OnDiscard hasn’t.

    BUT, it should not read/write any monkey2 objects or arrays – just native handles, pointers etc. It should not allocate any GC memory (GC is currently suspended while finalizers run, but future versions may just cause a runtime error if you try to allocate GC memory inside a finalizer).

    Monkey2 does not as yet (and may never) attempt to ‘sort’ finalizers by dependancy (it’s impossible with cyclic dependancies anyway, which leads to zombie objects etc – ugly, ugly stuff that can cause incredibly intermitent and hard to find problems) so any object object/array fields may or may not be dead/deallocated etc. I actually attempted a system where it ‘nulled out’ any object/array fields before calling OnFinalize, but there were issues…

    So it’s pretty primitive, but it’s enough for fclosing files, freeing malloced memory, deleting gl objects, free type fonts etc, stuff that can be very hard to ‘keep alive’ sanely via ref counting etc.

    in reply to: canvas.Rotation vs Trig function rotation #13189

    Mark Sibly
    Keymaster

    I think the problem here is that I use the ‘standard’ 2d rotation matrix…

    https://en.wikipedia.org/wiki/Rotation_matrix

    …but I guess this assumes +y is ‘up’ (and I never really thought about this before) so perhaps the cosines or something need to be negated or perhaps you need to use: scale( 1,-1 ) * rotate( r ) * scale( 1,-1 )?

    If this is the case, it wouldn’t be hard to add a canvas ‘mode’ that addressed this if enough people wanted it.

    in reply to: How Parent/Children works? #13187

    Mark Sibly
    Keymaster

    Here’s a little demo…

    in reply to: How Parent/Children works? #13185

    Mark Sibly
    Keymaster

    Yes, it’s very much like blitz3d (if you’ve ever used that)!

    A child entity’s position, rotation and scale are all relative to the parent entity. So moving, rotating, scaling the parent will also move, rotate, scale the child.

Viewing 15 posts - 181 through 195 (of 1,431 total)