1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-30 08:57:00 +02:00

teraz wyświetlanie już działa, choć nie mam pojęcia, dlaczego ;]

This commit is contained in:
mateuszb 2007-06-07 11:50:09 +00:00
parent 551a843ce3
commit b85cd7c759
3 changed files with 12 additions and 11 deletions

View File

@ -231,7 +231,7 @@ int _tmain(int argc, _TCHAR* argv[])
//SDL_Surface * ss = ac->defs[0]->ourImages[0].bitmap;
//SDL_BlitSurface(ss, NULL, ekran, NULL);
SDL_Delay(3000);
SDL_Delay(5000);
SDL_Quit();
return 0;
}

View File

@ -1,9 +1,9 @@
#include "stdafx.h"
#include "SDL_Extensions.h"
void CSDL_Ext::SDL_PutPixel(SDL_Surface *ekran, int x, int y, Uint8 R, Uint8 G, Uint8 B)
void CSDL_Ext::SDL_PutPixel(SDL_Surface *ekran, int x, int y, Uint8 R, Uint8 G, Uint8 B, int myC)
{
Uint8 *p = (Uint8 *)ekran->pixels + y * ekran->pitch + x * ekran->format->BytesPerPixel;
Uint8 *p = (Uint8 *)ekran->pixels + y * ekran->pitch + x * ekran->format->BytesPerPixel-myC;
if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
{
p[0] = R;
@ -34,11 +34,11 @@ SDL_Surface * CSDL_Ext::rotate01(SDL_Surface * toRot)
Uint8 *p = (Uint8 *)toRot->pixels + j * toRot->pitch + (ret->w - i - 1) * toRot->format->BytesPerPixel;
if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
{
SDL_PutPixel(ret, i, j, p[0], p[1], p[2]);
CSDL_Ext::SDL_PutPixel(ret, i, j, p[0], p[1], p[2], 2);
}
else
{
SDL_PutPixel(ret, i, j, p[2], p[1], p[0]);
CSDL_Ext::SDL_PutPixel(ret, i, j, p[2], p[1], p[0], 2);
}
}
}
@ -55,14 +55,15 @@ SDL_Surface * CSDL_Ext::hFlip(SDL_Surface * toRot)
for(int j=0; j<ret->h; ++j)
{
{
Uint8 *p = (Uint8 *)toRot->pixels + (ret->h - j -1) * toRot->pitch + i * toRot->format->BytesPerPixel;
Uint8 *p = (Uint8 *)toRot->pixels + (ret->h - j -1) * toRot->pitch + i * toRot->format->BytesPerPixel-2;
int k=2;
if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
{
SDL_PutPixel(ret, i, j, p[0], p[1], p[2]);
CSDL_Ext::SDL_PutPixel(ret, i, j, p[0], p[1], p[2], k);
}
else
{
SDL_PutPixel(ret, i, j, p[2], p[1], p[0]);
CSDL_Ext::SDL_PutPixel(ret, i, j, p[2], p[1], p[0], k);
}
}
}
@ -114,11 +115,11 @@ SDL_Surface * CSDL_Ext::rotate03(SDL_Surface * toRot)
Uint8 *p = (Uint8 *)toRot->pixels + (ret->h - j - 1) * toRot->pitch + (ret->w - i - 1) * toRot->format->BytesPerPixel;
if(SDL_BYTEORDER == SDL_BIG_ENDIAN)
{
SDL_PutPixel(ret, i, j, p[0], p[1], p[2]);
SDL_PutPixel(ret, i, j, p[0], p[1], p[2], 2);
}
else
{
SDL_PutPixel(ret, i, j, p[2], p[1], p[0]);
SDL_PutPixel(ret, i, j, p[2], p[1], p[0], 2);
}
}
}

View File

@ -5,7 +5,7 @@
class CSDL_Ext
{
public:
static void SDL_PutPixel(SDL_Surface *ekran, int x, int y, Uint8 R, Uint8 G, Uint8 B);
static void SDL_PutPixel(SDL_Surface *ekran, int x, int y, Uint8 R, Uint8 G, Uint8 B, int myC=0); //myC influences the start of reading pixels
static SDL_Surface * rotate01(SDL_Surface * toRot);
static SDL_Surface * hFlip(SDL_Surface * toRot); //horizontal flip
static SDL_Surface * rotate02(SDL_Surface * toRot);