Skip to content

Commit

Permalink
Fix warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnlohr committed Jun 30, 2020
1 parent 98532cd commit 78ce858
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 24 deletions.
7 changes: 4 additions & 3 deletions CNFG.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ extern uint32_t CNFGBGColor;
extern uint32_t CNFGLastColor;
extern uint32_t CNFGDialogColor; //background for boxes

void CNFGDrawText( const char * text, int scale );
void CNFGDrawBox( int x1, int y1, int x2, int y2 );
void CNFGDrawText( const char * text, short scale );
void CNFGDrawBox( short x1, short y1, short x2, short y2 );
void CNFGGetTextExtents( const char * text, int * w, int * h, int textsize );
void CNFGDrawTextbox( int x, int y, const char * text, int textsize ); //ignores pen.

Expand Down Expand Up @@ -137,7 +137,8 @@ float tdPerlin2D( float x, float y );

#endif


extern const unsigned char FontCharData[1902];
extern const unsigned short FontCharMap[256];

#ifdef __cplusplus
};
Expand Down
12 changes: 6 additions & 6 deletions CNFGFunctions.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,10 @@ void CNFGDrawText( const char * text, int scale )
lmap = &FontCharData[index];
do
{
int x1 = (int)((((*lmap) & 0x70)>>4)*scale + iox);
int y1 = (int)(((*lmap) & 0x0f)*scale + ioy);
int x2 = (int)((((*(lmap+1)) & 0x70)>>4)*scale + iox);
int y2 = (int)(((*(lmap+1)) & 0x0f)*scale + ioy);
short x1 = (short)((((*lmap) & 0x70)>>4)*scale + iox);
short y1 = (short)(((*lmap) & 0x0f)*scale + ioy);
short x2 = (short)((((*(lmap+1)) & 0x70)>>4)*scale + iox);
short y2 = (short)(((*(lmap+1)) & 0x0f)*scale + ioy);
lmap++;
CNFGTackSegment( x1, y1, x2, y2 );
bQuit = *lmap & 0x80;
Expand All @@ -225,7 +225,7 @@ void CNFGDrawText( const char * text, int scale )
}


void CNFGDrawBox( int x1, int y1, int x2, int y2 )
void CNFGDrawBox( short x1, short y1, short x2, short y2 )
{
unsigned lc = CNFGLastColor;
CNFGColor( CNFGDialogColor );
Expand Down Expand Up @@ -271,7 +271,7 @@ void CNFGDrawTextbox( int x, int y, const char * text, int textsize )

CNFGGetTextExtents( text, &w, &h, textsize );

CNFGDrawBox( x, y, x + w, y + h );
CNFGDrawBox( (short)x, (short)y, (short)(x + w), (short)(y + h) );
CNFGPenX = x + textsize;
CNFGPenY = y + textsize;
CNFGDrawText( text, textsize );
Expand Down
28 changes: 13 additions & 15 deletions CNFGWinDriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ void InternalHandleResize()
SelectObject( lsHDC, lsBitmap );
}
#else
static int bufferx, buffery;
static int bufferx, buffery;
static short bufferx, buffery;
static void InternalHandleResize();
#endif

Expand All @@ -44,11 +43,11 @@ void CNFGSwapBuffers()

void CNFGGetDimensions( short * x, short * y )
{
static int lastx, lasty;
static short lastx, lasty;
RECT window;
GetClientRect( lsHWND, &window );
bufferx = ( window.right - window.left);
buffery = ( window.bottom - window.top);
bufferx = (short)( window.right - window.left);
buffery = (short)( window.bottom - window.top);
if( bufferx != lastx || buffery != lasty )
{
lastx = bufferx;
Expand All @@ -69,7 +68,7 @@ void CNFGUpdateScreenWithBitmap( uint32_t * data, int w, int h )
BitBlt(lsWindowHDC, 0, 0, w, h, lsHDC, 0, 0, SRCCOPY);
UpdateWindow( lsHWND );

int thisw, thish;
short thisw, thish;

//Check to see if the window is closed.
if( !IsWindow( lsHWND ) )
Expand All @@ -78,8 +77,8 @@ void CNFGUpdateScreenWithBitmap( uint32_t * data, int w, int h )
}

GetClientRect( lsHWND, &r );
thisw = r.right - r.left;
thish = r.bottom - r.top;
thisw = (short)(r.right - r.left);
thish = (short)(r.bottom - r.top);
if( thisw != bufferx || thish != buffery )
{
bufferx = thisw;
Expand Down Expand Up @@ -128,8 +127,8 @@ int CNFGSetup( const char * name_of_window, int width, int height )
int w, h, wd, hd;
HINSTANCE hInstance = GetModuleHandle(NULL);

bufferx = width;
buffery = height;
bufferx = (short)width;
buffery = (short)height;

wnd.style = CS_HREDRAW | CS_VREDRAW; //we will explain this later
wnd.lpfnWndProc = MyWndProc;
Expand Down Expand Up @@ -246,7 +245,7 @@ void CNFGHandleInput()
case WM_MBUTTONUP: HandleButton( (msg.lParam & 0xFFFF), (msg.lParam>>16) & 0xFFFF, 3, 0 ); break;
case WM_KEYDOWN:
case WM_KEYUP:
HandleKey( tolower( msg.wParam ), (msg.message==WM_KEYDOWN) );
HandleKey( tolower( (int) msg.wParam ), (msg.message==WM_KEYDOWN) );
break;
default:
DispatchMessage(&msg);
Expand All @@ -260,7 +259,6 @@ void CNFGHandleInput()
#ifndef RASTERIZER

static HBITMAP lsBackBitmap;
static HDC lsWindowHDC;
static HBRUSH lsHBR;
static HPEN lsHPEN;
static HBRUSH lsClearBrush;
Expand Down Expand Up @@ -352,13 +350,13 @@ void CNFGSwapBuffers()

if( thisw != bufferx || thish != buffery )
{
bufferx = thisw;
buffery = thish;
bufferx = (short)thisw;
buffery = (short)thish;
InternalHandleResize();
}
}

void CNFGInternalResize( short bufferx, short buffery ) { }
void CNFGInternalResize( short bfx, short bfy ) { }
#endif

#endif
Expand Down

0 comments on commit 78ce858

Please sign in to comment.