Merge pull request #28 from ShFil119/master

Fix sdl and linux build
This commit is contained in:
aap 2020-04-25 00:45:51 +02:00 committed by GitHub
commit 13307f0a27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 18 additions and 13 deletions

View File

@ -82,6 +82,9 @@ readBMP(const char *afilename)
StreamMemory file;
int i, x, y;
bool32 noalpha;
int pad;
filename = Image::getFilename(afilename);
if(filename == nil)
return nil;
@ -103,7 +106,7 @@ readBMP(const char *afilename)
dib.paletteLen = 0;
}
bool32 noalpha = true;
noalpha = true;
// Recognize 32 bit formats
if(dib.compression == 3){
@ -138,7 +141,7 @@ readBMP(const char *afilename)
file.seek(bmp.offset, 0);
int pad = image->width*image->bpp % 4;
pad = image->width*image->bpp % 4;
uint8 *px, *line;
line = image->pixels + (image->height-1)*image->stride;

View File

@ -143,7 +143,7 @@ Charset::printChar(uint32 c, int32 x, int32 y)
RWDEVICE::Im2DVertex *vert;
uint16 *ix;
if(c >= this->desc.count)
if((int32)c >= this->desc.count)
return;
if(this->raster != lastRaster || numChars >= NUMCHARS)

View File

@ -96,7 +96,7 @@ Texture *readNativeTexture(Stream *stream);
void writeNativeTexture(Texture *tex, Stream *stream);
uint32 getSizeNativeTexture(Texture *tex);
enum {
enum : uint32 {
D3DFMT_UNKNOWN = 0xFFFFFFFF,
/* Swizzled formats */

View File

@ -497,7 +497,7 @@ Geometry::generateTriangles(int8 *adc)
static void
dumpMesh(Mesh *m)
{
for(int32 i = 0; i < m->numIndices-2; i++)
for(uint32 i = 0; i < m->numIndices-2; i++)
// if(i % 2)
// printf("%3d %3d %3d\n",
// m->indices[i+1],

View File

@ -25,13 +25,14 @@
namespace rw {
namespace gl3 {
#ifndef LIBRW_SDL2
struct DisplayMode
{
GLFWvidmode mode;
int32 depth;
uint32 flags;
};
#endif
struct GlGlobals
{
@ -48,13 +49,13 @@ struct GlGlobals
DisplayMode *modes;
int numModes;
int currentMode;
GLFWwindow **pWindow;
#endif
int presentWidth, presentHeight;
// for opening the window
int winWidth, winHeight;
const char *winTitle;
GLFWwindow **pWindow;
} glGlobals;
struct UniformState

View File

@ -14,6 +14,7 @@ struct EngineOpenParams
{
#ifdef LIBRW_SDL2
SDL_Window **window;
bool32 fullscreen;
#else
GLFWwindow **window;
#endif

View File

@ -475,7 +475,7 @@ static char*
rwstrdup(const char *s)
{
char *t;
int32 len = strlen(s)+1;
size_t len = strlen(s)+1;
t = (char*)rwMalloc(len, MEMDUR_EVENT);
if(t)
memcpy(t, s, len);

View File

@ -198,7 +198,7 @@ struct Raster
void destroy(void);
static bool32 imageFindRasterFormat(Image *image, int32 type,
int32 *pWidth, int32 *pHeight, int32 *pDepth, int32 *pFormat, int32 platform = 0);
Raster *Raster::setFromImage(Image *image, int32 platform = 0);
Raster *setFromImage(Image *image, int32 platform = 0);
static Raster *createFromImage(Image *image, int32 platform = 0);
Image *toImage(void);
uint8 *lock(int32 level, int32 lockMode);

View File

@ -240,8 +240,8 @@ uvAnimParamInterpCB(void *out, void *in1, void *in2, float32 t, void *custom)
float32 f = (t - kf1->time) / (kf2->time - kf1->time);
float32 a = kf2->uv[0] - kf1->uv[0];
while(a < M_PI) a += 2*M_PI;
while(a > M_PI) a -= 2*M_PI;
while(a < (float)M_PI) a += 2 * (float)M_PI;
while(a > (float)M_PI) a -= 2 * (float)M_PI;
intf->uv[0] = a*f + kf1->uv[0];
intf->uv[1] = (kf2->uv[1] - kf1->uv[1])*f + kf1->uv[1];
intf->uv[2] = (kf2->uv[2] - kf1->uv[2])*f + kf1->uv[2];

View File

@ -287,11 +287,11 @@ putpixel(Canvas *canvas, Point3 p, Color c)
case DEPTHTEST_ALWAYS:
break;
case DEPTHTEST_GEQUAL:
if(p.z < *z)
if(p.z < (int)*z)
return;
break;
case DEPTHTEST_GREATER:
if(p.z <= *z)
if(p.z <= (int)*z)
return;
break;
}