1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-10-14 09:23:54 +00:00

A little more documentation post-rwops changes

This commit is contained in:
Peter Evans 2018-01-04 14:21:05 -06:00
parent 171ff62551
commit e184304ec5

View File

@ -25,6 +25,9 @@ vm_bitfont_create(vm_screen *screen,
SDL_RWops *rw;
vm_bitfont *font;
// Build the RWops object from the given fontdata; we have to use
// FromConstMem because we passed a const pointer into this
// function.
rw = SDL_RWFromConstMem(fontdata, fontsize);
if (rw == NULL) {
log_critical("Failed to create RWops from font data: %s",
@ -32,6 +35,8 @@ vm_bitfont_create(vm_screen *screen,
return NULL;
}
// And here we build a surface from the RWops, which is a nifty way
// of getting a bitmap from memory rather than loading from a file.
surf = SDL_LoadBMP_RW(rw, 0);
if (surf == NULL) {
log_critical("Failed to create bitmap from RWops: %s",
@ -45,7 +50,9 @@ vm_bitfont_create(vm_screen *screen,
return NULL;
}
// The texture is what we can use to blit onto the renderer
font->texture = SDL_CreateTextureFromSurface(screen->render, surf);
font->width = width;
font->height = height;
font->cmask = cmask;