Git Product home page Git Product logo

Comments (3)

ChrisPritchard avatar ChrisPritchard commented on August 25, 2024 1

I feel like this bit is likely inefficient:

        drawables
        |> List.iter (fun drawable ->
            match drawable with
            | Sprite df ->
                spriteBatch.Begin (sortMode = SpriteSortMode.Immediate)
                df assets inputs spriteBatch
                spriteBatch.End ()

If you have a hundred sprites would it not start and stop the batch a 100 times?

In any event, good work! But vertex-based drawing, user primitives etc is slightly outside my vision for Xelmish, as it would allow 3D models etc. I feel like supporting it and all the custom configuration would be just easier with a raw monogame project than through Xelmish's abstractions. But I will see about making it not internal (maybe breaking out some of the steps of draw/update so they can be overwritten, etc).

When I draw hex grids with it, I just use a sprite for each hex and draw that just like with other sprites. You could give that a try, or stick with your approach which looks neat :)

from xelmish.

ChrisPritchard avatar ChrisPritchard commented on August 25, 2024 1

You might find the tutorials by catlike coding interesting: https://catlikecoding.com/unity/tutorials/hex-map/ Its in unity, and c# (I did a full implementation of it here) but its also entirely vertex based, so in theory could be done in Monogame.

Or, if you wanted to use Unity but stick with F#, I did a small project on doing F# with unity here that has some setup/process instructions that might be useful.

from xelmish.

AlexanderLindsay avatar AlexanderLindsay commented on August 25, 2024

Yeah that is a good point about it being inefficient. I added the batch type to try and account for that sort of thing but that has a bit more overhead, so its a trade off.

I will probably need to either add or replace this with texture drawing at some point but I did it this way to understand the hex stuff a bit better. (I had tried it with textures first but it wasn't working, turned out I had a bug with the hex to pixel function but I didn't find that until after I switched)

Thanks for taking a look at this and for making Xelmish in the first place, its pretty cool!

from xelmish.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.