Comments (3)
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.
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.
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)
- Per draw sprite sampler blending? HOT 1
- Cross Platform Support? HOT 19
- 2D Camera support? HOT 2
- Message to all contributors HOT 1
- Fixed time step config HOT 4
- Tetris sample has some timing problems HOT 3
- [Question] Accessing the Game-object HOT 2
- Create profile pic for Xelmish HOT 1
- Nuget/Github package release? HOT 1
- QuitGame exception does not work as expected via nuget package HOT 2
- SpriteSortMode.Immediate control HOT 1
- Running Xelmish on androi HOT 1
- Blank project HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xelmish.