forked from jaildesigner-jailgames/jaildoctors_dilemma
Ya se dibuja el gif en pantalla
This commit is contained in:
@@ -8,8 +8,6 @@ struct jSurface_s
|
||||
Uint16 w, h;
|
||||
};
|
||||
|
||||
static SDL_Window *jWin = NULL;
|
||||
static SDL_Renderer *jRen = NULL;
|
||||
static SDL_Texture *jTex = NULL;
|
||||
static jSurface jScreen;
|
||||
static jSurface jDestSurf;
|
||||
@@ -17,9 +15,17 @@ static jSurface jSourceSurf = NULL;
|
||||
static Uint32 paleta[256];
|
||||
static int jWidth = 320;
|
||||
static int jHeight = 240;
|
||||
static int jZoom = 2;
|
||||
static int transparentColor = 0;
|
||||
|
||||
void pInit(SDL_Renderer *renderer, int w, int h)
|
||||
{
|
||||
jWidth = w;
|
||||
jHeight = h;
|
||||
jTex = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, w, h);
|
||||
jScreen = pNewSurface(w, h);
|
||||
jDestSurf = jScreen;
|
||||
}
|
||||
|
||||
jSurface pNewSurface(int w, int h)
|
||||
{
|
||||
jSurface surf = (jSurface)malloc(sizeof(jSurface_s));
|
||||
@@ -115,20 +121,6 @@ void pLoadPal(const char *filename)
|
||||
}
|
||||
}
|
||||
|
||||
void pInit(const char *titol, int w, int h, int z)
|
||||
{
|
||||
SDL_Init(SDL_INIT_EVERYTHING);
|
||||
jWidth = w;
|
||||
jHeight = h;
|
||||
jZoom = z;
|
||||
jWin = SDL_CreateWindow(titol, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, w * z, h * z, SDL_WINDOW_SHOWN);
|
||||
jRen = SDL_CreateRenderer(jWin, -1, 0);
|
||||
SDL_RenderSetLogicalSize(jRen, w, h);
|
||||
jTex = SDL_CreateTexture(jRen, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, w, h);
|
||||
jScreen = pNewSurface(w, h);
|
||||
jDestSurf = jScreen;
|
||||
}
|
||||
|
||||
void pSetPal(int index, Uint32 color)
|
||||
{
|
||||
paleta[index] = color;
|
||||
@@ -140,7 +132,7 @@ void pCls(Uint8 color)
|
||||
jDestSurf->data[i] = color;
|
||||
}
|
||||
|
||||
void pFlip()
|
||||
void pFlip(SDL_Renderer *renderer)
|
||||
{
|
||||
Uint32 *pixels;
|
||||
int pitch;
|
||||
@@ -148,8 +140,8 @@ void pFlip()
|
||||
for (int i = 0; i < jWidth * jHeight; ++i)
|
||||
pixels[i] = paleta[jScreen->data[i]];
|
||||
SDL_UnlockTexture(jTex);
|
||||
SDL_RenderCopy(jRen, jTex, NULL, NULL);
|
||||
SDL_RenderPresent(jRen);
|
||||
SDL_RenderCopy(renderer, jTex, NULL, NULL);
|
||||
//SDL_RenderPresent(jRen);
|
||||
}
|
||||
|
||||
void pPutPixel(int x, int y, Uint8 color)
|
||||
|
||||
Reference in New Issue
Block a user