Jump to content
IGNORED

inline sprite editing in C / VIM


jedimatt42

Recommended Posts

This was a fun exercise... I always find I have to do some rework to get sprite definitions from some editor format to C anyway.. or take the assembly, and add an .asm module to the project.. that's usually the easiest... I'm sure I have magellen installed somewhere... but my needs are trivial... so how about trivial editing inline with my C code... 

 

2126466353_Screenshotfrom2021-10-1617-13-30.thumb.png.e234a3b40ba4f3fef547e97f2343c98c.png

 

Using VIM, I '/1' search for 1, and it highlights all them... that sticks around until I search for something else... The macro math is all performed at compile time, so it is just a chunk of bytes, in the correct order for the 16x16 pixel sprite... 

 

#define SPR16X(a,b,c,d, e,f,g,h, i,j,k,l, m,n,o,p) { \  
  a >> 8, b >> 8, c >> 8, d >> 8, e >> 8, f >> 8, g >> 8, h >> 8, \  
  i >> 8, j >> 8, k >> 8, l >> 8, m >> 8, n >> 8, o >> 8, p >> 8, \  
  a & 0xff, b & 0xff, c & 0xff, d & 0xff, e & 0xff, f & 0xff, g & 0xff, h & 0xff, \  
  i & 0xff, j & 0xff, k & 0xff, l & 0xff, m & 0xff, n & 0xff, o & 0xff, p & 0xff \  
}

 

  • Like 10
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.

Guest
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.

Loading...
  • Recently Browsing   0 members

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