abakobo

Forum Replies Created

Viewing 15 posts - 241 through 255 (of 455 total)
  • Author
    Posts
  • in reply to: Change color in a sprite #10353

    abakobo
    Participant

    pixelmap has load method

    how can I have missed that!

    in reply to: Change color in a sprite #10347

    abakobo
    Participant

    You could always keep a copy of the image in a pixmap

    To me the problem is more how to get the pixmap out of a loaded .png image. Once you have the pixmap you can use Pixmap.Getpixel() or GetARGBpixel().

    Nerobot’s solution is of course top performance but needs more work/knowledge.

    in reply to: Change color in a sprite #10341

    abakobo
    Participant

    here’s an Image Extension that will do Image.GetPixel (very slow!). There’s also an Image.GetPixmap (faster to scan the whole image (untested)) but i’m not quite sure how the resource will be managed..

    I’m not sure it’s the right/good way to do it though! It’s so complex for such a simple thing…

    [/crayon]
    in reply to: Change color in a sprite #10339

    abakobo
    Participant

    For exaple, i need to draw 50 monochrome sprites. I load them from file Then i need to change thge color of a sprte to some other color. For example, there are white by default and i change to red. Then draw 50 red sprites. The colro is actually user selectable, if it matters.

    If you start with white images you can use the .Color stuff because white multiplied by a color is the color…
    I made a small sample (attached zip) that shows that the white dot is always getting the correct color.

    I don’t see anyt ReadPixels/WritePixels in mojo2 for images and buffers.

    There’s something with Image.Texture and Pixmaps.GetPixel but I don’t remember and the link to Texture in the docs is broken.. Can’t find the example I made at the time.

    I made a small sample (attached zip) that shows that the white dot is always getting the correct color.

    EDIT: Texture is hidden from docs.. At the time I did some modifications to play around with monkey2 itself so I don’t really know how you can “extract” the pixmap of an Image. Maybe create a new Canvas with the Image then myCanvas.CopyPixmap then myPixmap.Getpixel. But this is so complicated. Image.GetPixel would be nicer..

    Attachments:
    1. sprite_color.zip
    in reply to: Fill image with custom shader data #10288

    abakobo
    Participant

    Great to see that custom glsl shaders have some kind of interface now!

    in reply to: Is Monkey X documentauons works for Monkey 2? #10267

    abakobo
    Participant

    The pakz examples are a good starting point. http://monkeycoder.co.nz/forums/topic/monkey-2-examples-github/

    Also the language reference docs has been updated till the last release so if you get mx2 from the github dev branch you’ll have more docs about the core language (enums, pointers,…).

    The docs about the different available modules is still very gappy though.. and it’s one of the big power of mx2. A lot of essential modules are available already (math, vect/matrix geom, lists/stacks/maps, databuffers, (file)streams, mojo, mojoX gui, mojo3d (still WIP),… ). Once you get them it’s amazing how easy it is to do almost anything you want, from console apps to full games or productive app.

    But it was ok for me learning with these, I was already used to mx1 though. But I could not go back to it now!

    in reply to: Draw image #10204

    abakobo
    Participant

    Primitives are faster than struct fields.. So I would not use vec2 inside such loops.

    Here I use vx ans vy but you Can also put their expressions direcly in drawimage arguments.
    The image coule be passed direcly too, it might perform better.

    [/crayon]
    in reply to: alSourcefv help wanted #10031

    abakobo
    Participant

    I think you have to use

    [/crayon]

    which are technically the same. i.e. a pointer to ALFloat (pointing the first element of the array)

    “angles” alone is actually a pointer so “Varptr angles” is a pointer to a pointer (to be seen in C sys programming but probably not in mx2 sources)
    It’s common in C/C++ libs to send an array by sending a pointer to the first element (and a count if the number of elements is variable)

    in reply to: Drawing 2d pixels #9951

    abakobo
    Participant

    This has been discussed on this topic :

    Julia set fractal generator optimisation (drawpoint)

    An even faster way would be custom glsl shader but I don’t know how shaders are managed now after the modifications induced by mojo3d.

    in reply to: prompt invasion 2 is ace #9777

    abakobo
    Participant

    same error here invalid image>memory access violation

    W10, latest dev, mingw

    in reply to: How to rotate an image like in graphic apps #9772

    abakobo
    Participant

    Now the rect might be rotated and is more like an polygon. Ok, I know how to check the if a point inside a polygon, BUT

    Second problem: How to rotate a polygon?

    If you only want rotated rects then nerobot’s solution is probably better (more monkeyish)

    in reply to: How to rotate an image like in graphic apps #9765

    abakobo
    Participant

    Here is a much more intuitive form of Tpoly.. It’s using position, angle and scale fields instead of affineMat3. But is of course internally using an affineMat3 to transform the original poly (centered at the origin, you could add a center/handle field too and make one more translation to center it to the origin before rotating/scaling).

    in reply to: How to rotate an image like in graphic apps #9745

    abakobo
    Participant

    here’s a little example of a transformable poly that can be enhanced to get what you need, you can add size too..

    you can extract translate,rotate and size from a AffineMat3 too if you need. see http://monkeycoder.co.nz/forums/topic/matrix-scale/

    in reply to: How to rotate an image like in graphic apps #9737

    abakobo
    Participant

    The most common way to do this is to use matrix transform. It’s what mojo uses. There is an affineMat3 class wich is usable for rotate/size/translate transforms. Matrices are your friends, this is the most usefull Math stuff you can have for video games after trigonometry..

    in reply to: Integrated docs gitHub community organisation #9732

    abakobo
    Participant

    Pull request made!

    A printable version is attached, you can still see the WIP at: http://turdus.be/monkey2docs/docs/

    I’ll be away from Mx2 for a while due to hard work but should be back on December (Half or FULL time!)

    Mx2 rocks, I can’t wait for December to start working on my mobile game with this awesome dev. tool!

    Attachments:
    1. printableDocs.docx
Viewing 15 posts - 241 through 255 (of 455 total)