Danilo

Forum Replies Created

Viewing 15 posts - 16 through 30 (of 145 total)
  • Author
    Posts

  • Danilo
    Participant

    Could you use the following?
    instance:=ObjectFromName<class_name>(“class_name”)

    Creating an object just from a string, without telling Monkey2 what it is, is probably very hard if possible at all.


    Danilo
    Participant

    You can store any Object in a Variant, and because of that you have to tell Monkey2 what it is.

    With casting you can tell Monkey2 that instance.a is an instance of class A:

    [/crayon]

    Using that way you could use different classes that implement the same methods:

    [/crayon]
    in reply to: Reflection / Turning XML into an object #15982

    Danilo
    Participant

    Same on macOS using monkey2/modules/reflection/tests/alltypes.monkey2

    in reply to: Generic array field syntax? #15975

    Danilo
    Participant

    A generic class with an array would look like this:

    in reply to: Generic array field syntax? #15974

    Danilo
    Participant

    You can use the type Variant to set it to whichever object you want.

    in reply to: Help porting HMAC-SHA256 code #15941

    Danilo
    Participant

    @jondecker76: Could it be that your expected results comes from routines that use SHA256() on ASCII strings? All std.digest functions in Monkey2 use 16-bit Unicode strings.

    The SHA(), MD5(), SHA256() with Unicode string buffers are probably much different from using the same functions with ASCII buffers.

    in reply to: Help porting HMAC-SHA256 code #15939

    Danilo
    Participant

    Strings in Monkey2 are 16-bit Unicode Strings.

     

    Please try the following code to catch ASCII strings from DataBuffer and convert it to Unicode-Monkey2-Strings.

    in reply to: Help porting HMAC-SHA256 code #15931

    Danilo
    Participant

    0 To 255 requires a DataBuffer of 256 bytes.

    in reply to: Realtime resizing of MojoX apps on macOS #15922

    Danilo
    Participant

    Updated the code:

    • added _updateInterval

     

    If redrawing the resized window in realtime becomes too slow, we can now use ‘_updateInterval’ to change how often the window content is completely refreshed.

    in reply to: BlitzMax is still alive! ( Finish ) #15914

    Danilo
    Participant

    If you are looking for a BlitzMax forum, it is at SyntaxBomb now. 😉

     

    The old BlitzMax forum is available read-only at mojolabs.

    in reply to: Trying to understand a few things… #15856

    Danilo
    Participant

    It is possible if you use your own class that extends Map.

    With simple-type Arrays it is possible to initialize when declaring it:

     

    Now we can use that principle and write a generic class that extends Map<K,V>, let’s call it MapEx<K,V>.

    We then add a constructor (“New”) that takes an array of Value+Key pairs for initializing the Map.

     

    That would look like this:

    Okay, that works. But that constructs for initializing the Map are very big.

     

    By using two ‘Alias’ we can shorten it:

    With those two Alias, we can now write a simpler global Map initialization:

    Looks better, doesn’t it? 😉

    Here the final code:

    in reply to: Loading animated 3d models #15837

    Danilo
    Participant

    The source code is now available at github.

    Sorry for any inconveniences.

    in reply to: 3D – Load an obj model and apply its texture? #15835

    Danilo
    Participant

    Hi,

    loading a Mesh and a Texture is basically easy:

    In short:

    in reply to: Integrated docs gitHub community organisation #15829

    Danilo
    Participant

    This seems to be outdated.

    It is not synchronized to Monkey2:
    This branch is 28 commits ahead, 72 commits behind blitz-research:develop.

    Would it be a problem to make pull requests directly to blitz-research/monkey2?

    in reply to: How to Animate mojo3D models, .md2 and general? #15828

    Danilo
    Participant

    Okay, this .md2 model has no useable animations in it.
    Maybe the file format is too old.

    Here is a test with 3 working models:
    http://monkeycoder.co.nz/forums/topic/loading-animated-3d-models/

Viewing 15 posts - 16 through 30 (of 145 total)