Fix
This commit is contained in:
parent
eda42fb4d9
commit
5a29912796
5
Makefile
5
Makefile
|
@ -1,5 +1,10 @@
|
||||||
LDFLAGS = $(shell pkg-config --libs sdl2 r_util r_io)
|
LDFLAGS = $(shell pkg-config --libs sdl2 r_util r_io)
|
||||||
CFLAGS = -Wall -I include/ $(shell pkg-config --cflags sdl2 r_util r_io)
|
CFLAGS = -Wall -I include/ $(shell pkg-config --cflags sdl2 r_util r_io)
|
||||||
|
|
||||||
|
all: sdl/pixbuf.o io/timers.o
|
||||||
|
|
||||||
|
sdl/pixbuf.o:
|
||||||
|
gcc -c sdl/pixbuf.c -o sdl/pixbuf.o $(CFLAGS)
|
||||||
|
|
||||||
io/timers.o:
|
io/timers.o:
|
||||||
gcc -c io/timers.c -o io/timers.o $(CFLAGS)
|
gcc -c io/timers.c -o io/timers.o $(CFLAGS)
|
||||||
|
|
|
@ -19,7 +19,7 @@ GBPixBuf *gb_pix_buf_new (SDL_Renderer *renderer, ut16 w, ut16 h) {
|
||||||
}
|
}
|
||||||
pb->texture = SDL_CreateTexture (renderer, SDL_PIXELFORMAT_ARGB32,
|
pb->texture = SDL_CreateTexture (renderer, SDL_PIXELFORMAT_ARGB32,
|
||||||
SDL_TEXTUREACCESS_TARGET, w, h);
|
SDL_TEXTUREACCESS_TARGET, w, h);
|
||||||
if (!texture) {
|
if (!pb->texture) {
|
||||||
free (pb->buf);
|
free (pb->buf);
|
||||||
free (pb);
|
free (pb);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -46,7 +46,7 @@ void gb_pix_buf_set_pixel (GBPixBuf *pb, ut16 x, ut16 y, ut8 pixval) {
|
||||||
const ut32 bytepos = bitpos >> 3;
|
const ut32 bytepos = bitpos >> 3;
|
||||||
const ut32 shl = bitpos & 0x6;
|
const ut32 shl = bitpos & 0x6;
|
||||||
pixval = pixval & 0x3;
|
pixval = pixval & 0x3;
|
||||||
const ut8 mask = ~(0x3 << shl)
|
const ut8 mask = ~(0x3 << shl);
|
||||||
pb->buf[bytepos] = (pb->buf[bytepos] & mask) | (pixval << shl);
|
pb->buf[bytepos] = (pb->buf[bytepos] & mask) | (pixval << shl);
|
||||||
SDL_Texture *target = SDL_GetRenderTarget (pb->renderer);
|
SDL_Texture *target = SDL_GetRenderTarget (pb->renderer);
|
||||||
SDL_SetRenderTarget (pb->renderer, pb->texture);
|
SDL_SetRenderTarget (pb->renderer, pb->texture);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user