unhuman Posted March 11, 2018 Share Posted March 11, 2018 Anyone have a good way to convert from bitmask to screen locations? For the game I'm working on (which is finally coming together), I'm using a bitmask.... I'd like to be able to draw something so that if I have a value of 100011001, I'd like to be able to draw characters: * ** *. I'm currently doing this in a loop, checking each bit, but there's got to be a better way.... I'm using XB, but this will be compiled when done. -Howie Quote Link to comment Share on other sites More sharing options...
+OLD CS1 Posted March 11, 2018 Share Posted March 11, 2018 I wrote a character defining program BITD and I used a 15 element string array indexed by the 8-bit value divided by 16 for the first nybble and the remainder for the second. Like so: B$(0-15) is set as the bit positions " "," *"," * "..."****", N1 and N2 are the nybble values, and B is the byte. Therefore, N1=INT(B/16) N2=B-N1*16 C$=B$(N1)&B$(N2) 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.