Closed Bowarc closed 12 months ago
https://github.com/Bowarc/chess_game/blob/main/client/src/game/mod.rs#L62
Isnt that inefficient?
I mean allocating a new variable every frame with potentially big sizes ?
We could use a buffer like self.dummy that we would yse for the mem::replace
https://github.com/Bowarc/chess_game/blob/main/client/src/game/mod.rs#L62
Isnt that inefficient?
I mean allocating a new variable every frame with potentially big sizes ?
We could use a buffer like self.dummy that we would yse for the mem::replace
We're only copying the pointer to that large data, so it's not inefficient, i think ?
Using
enum_dispatch
for the state machine could be really good instead of having a function per state like currentlyEach state would have to impl a state machine trait that would have
A update function
The state ref would be the dummy state set by
std::mem::replace
like currently to be able to switch state with non copy objectsOr the update function could return a state that would be the next one..
Should try both cases
Obviously the goal of the change is to be able to have multiple function, like a
draw
one could be specifically useful