chip8-rust / chip8-ui

CHIP-8 graphical emulator built with the Rust programing language
MIT License
8 stars 0 forks source link

Add `Register` enum for `Vx` and `Vy` #21

Closed robo9k closed 9 years ago

robo9k commented 9 years ago

As commented in #19, this replaces the u8 of Vx/Vy with an enum Register, so they can only take valid values as well as providing names for the registers themselves.

The implementation is debatable, as it uses unstable traits. I also made an alternative implementation writing manual Register::from_idx() and Register::idx() functions, which is slightly more verbose.

jakerr commented 9 years ago

Sorry about the delayed review. This is really nice and much more readable (not to mention safer), :grinning: thanks!! I'm not too worried about using things marked with trait is likely to be removed at this point, as I'm sure we can find replacements once things start to settle.