Mark Sibly

Forum Replies Created

Viewing 15 posts - 826 through 840 (of 1,431 total)
  • Author
    Posts
  • in reply to: Basic reflection question #7445

    Mark Sibly
    Keymaster

    There is still some work to do on reflection, mostly ‘selective’ reflection. Currently reflection is ‘all or nothing’, and adds considerable size overhead to builds.

    But this will happen eventually and apart from that I reckon it works well.

    in reply to: Basic reflection question #7443

    Mark Sibly
    Keymaster

    Have you looked at the reflectiontest banana? There’s an exampole dynamically creating an object there…

    in reply to: Can't get stb-image to work (bug?) #7426

    Mark Sibly
    Keymaster

    Ok, my bad, looks like there were some errors in the stb-image module externs. I have committed a new version of stb-image.monkey2 to the develop branch, here:

    https://github.com/blitz-research/monkey2/blob/master/modules/stb-image/stb-image.monkey2

    A few things to note:

    • The stbi_load() filename param is an ‘OS’ filename, it can’t contain ‘asset::’ in path (std-image module is just a thin wrapper around the c lib). You can find the filesystem path of the assets dir with ‘AssetsDir’ function in std.filesystem, but note this will not work on targets that don’t store assets in the OS filesystem such as android.
    • You can also just use Pixmap.Load in std module. This will return a Pixmap with Width/Height/Data etc properties. This will also allow you to use ‘asset::’ in the path on all targets.
    in reply to: Layout questions (letterbox, fill, float) #7399

    Mark Sibly
    Keymaster

    I don’t know if I’d call this ‘letterbox’ anymore – IMO, ‘letterbox’ implies (optional) borders – but I think I see what you mean. You just want a fixed virtual height and to preserve aspect ratio, correct?

    Here’s my attempt at something similar using OnMeasure and “stretch” Layout. The main benefit to doing it this way is that mouse/touch etc coords are already scaled for you, and of course no need to scale inside OnRender.

    I have often thought about adding something like a ‘UIMatrix’ to View. This would be an additional post transform matrix that would be applied to rendering, but also to mouse/touch etc coords. So you could do something like this in OnRender to achieve what your version does:

    UIMatrix=AffineMat3f.Scaling( scaleRatio )

    Is this a good idea? Each thing I add seems to confuse things a bit!

    Also: Use Window Frame.Width, Frame.Height or Frame.Size etc to get ‘physical’ window size. Rect.Width, Rect.Height will return ‘virtual’ size as you’ve noticed.

    in reply to: Request for a default constructors to Node. #7388

    Mark Sibly
    Keymaster

    Well, you can do this, but I wouldn’t advise it.

    List/Node hasn’t been designed to be extended, and there may or may not be 1001 other problems you encounter trying to do so!

     

    in reply to: Request for a default constructors to Node. #7386

    Mark Sibly
    Keymaster

    I am trying to extend the Node class but can’t do it because it needs a default New Method.

    Not necessarily – suibclass ctors can call ‘Super.New( blah )’ if super class has no default new.

    in reply to: Optimizing drawing of lots and lots of images #7385

    Mark Sibly
    Keymaster

    One obvious opt. would be to use uvStack.Data and vertStack.Data instead of ToArray() method. This provides direct access to the stack array, whereas ToArray() creates/copies a new array.

    in reply to: Request for a default constructors to Node. #7384

    Mark Sibly
    Keymaster

    Example of problem please…and this should really probably be a github issue if you want to be 100% I’ll (eventually) take a look at it.

    in reply to: Function variable pointer #7383

    Mark Sibly
    Keymaster

    > What’s the logic behind this decision?

    Becasue it’s hard to do and I haven’t found a need for it myself or had requests for it yet!

    in reply to: Layout questions (letterbox, fill, float) #7382

    Mark Sibly
    Keymaster

    What I want to achieve is the scaling of the letterbox but with a floating size on one axis.

    Don’t quite understand this – you want a letterbox *without* the same aspect ratio as returned by OnMeasure?

    Letter box does ‘float’ on the minor axis, ie: the axis where the border appears, so you can use View.Gravity to control where letterbox is positioned horizontally/vertically within it’s border. This is shown in the view_layout banana I think.

    But letterbox will always fill the major axis, and it’s aspect ratio will always be the same as the aspect ratio returned by OnMeasure.

    You may also be able to achieve what you want by nesting a letterbox view within a ‘normal’ view, or vice versa.

    in reply to: Function variable pointer #7354

    Mark Sibly
    Keymaster

    Mx2 doesn’t have ‘var’ params so you can’t pass a ‘variable’ to a function.

    An array can be used here though – this is preferred to Varptr as it will prevent the object potentially being GC prematurely:

    Something like ‘Out’ or Var’ params will likely happen at some point, not sure when.

    in reply to: Pocket Invaders anybody? #7339

    Mark Sibly
    Keymaster

    Works fine here!

    Can I add it to bananas?

    in reply to: Nullable Int, Double, Float ? #7335

    Mark Sibly
    Keymaster

    There are no nullable types in mx2. There are variants though – see reflection in monkey2 language docs.

    could it be added to MX2?

     

    quite possibly – can you post an issue on github?

    in reply to: console app / gui preprocessor variable #7334

    Mark Sibly
    Keymaster

    Not as yet – please post an issue to github!

    in reply to: Way to predefine/inline define an array of arrays? #7333

    Mark Sibly
    Keymaster

    This works…

Viewing 15 posts - 826 through 840 (of 1,431 total)