Jump to content

Convert from bitmask to screen location


Recommended Posts

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.



Link to comment
Share on other sites

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,





  • Like 2
Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...