Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I solved this one a while back. The problem stemmed from doing the color keying in the wrong order. Here is the solved code:</p> <pre><code>uint8_t i; uint8_t j; uint8_t k = 0; SDL_FillRect(Screen,NULL,0x00000000); SDL_Rect Offset; SDL_Surface *Load; SDL_Surface *LoadFont; Load = IMG_Load("resource/font.png"); LoadFont = SDL_DisplayFormat(Load); SDL_FreeSurface(Load); Offset.x = 0; Offset.y = 0; for(i = 0; i &lt; 16; i++) { for(j = 0; j &lt; 16; j++) { Character[k].x = Offset.x; Character[k].y = Offset.y; Character[k].w = XWIDTH; Character[k].h = YHIEGHT; k++; Offset.x += XWIDTH; } Offset.x = 0; Offset.y += 12; } Color[0][0] = SDL_MapRGB(LoadFont-&gt;format,255,255,255); Color[0][1] = SDL_MapRGB(LoadFont-&gt;format,96,96,96); Color[1][0] = SDL_MapRGB(LoadFont-&gt;format,255,0,0); Color[1][1] = SDL_MapRGB(LoadFont-&gt;format,96,0,0); Color[2][0] = SDL_MapRGB(LoadFont-&gt;format,0,255,0); Color[2][1] = SDL_MapRGB(LoadFont-&gt;format,0,96,0); Color[3][0] = SDL_MapRGB(LoadFont-&gt;format,0,0,255); Color[3][1] = SDL_MapRGB(LoadFont-&gt;format,0,0,96); Color[4][0] = SDL_MapRGB(LoadFont-&gt;format,255,255,0); Color[4][1] = SDL_MapRGB(LoadFont-&gt;format,96,96,0); SDL_SetColorKey(LoadFont,SDL_SRCCOLORKEY,Color[0][0]); for(i=0; i&lt;6; i++) { for(j=0; j&lt;2; j++) { Font[i][j] = SDL_DisplayFormat(LoadFont); SDL_FillRect(Font[i][j],&amp;Font[i][j]-&gt;clip_rect,Color[i][j]); SDL_BlitSurface(LoadFont,NULL,Font[i][j],NULL); SDL_SetColorKey(Font[i][j],SDL_SRCCOLORKEY,SDL_MapRGB(Font[i][j]-&gt;format,0,0,0)); }} SDL_FreeSurface(LoadFont); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload