fix missing files
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@27 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -0,0 +1,383 @@
|
|||||||
|
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef GFXMODULE_SDL
|
||||||
|
|
||||||
|
#include "sdl_common.h"
|
||||||
|
#include "rotozoom.h"
|
||||||
|
|
||||||
|
static int gscale;
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||||
|
{
|
||||||
|
TFB_Image *img;
|
||||||
|
PFRAME_DESC SrcFramePtr;
|
||||||
|
|
||||||
|
SrcFramePtr = (PFRAME_DESC)PrimPtr->Object.Stamp.frame;
|
||||||
|
if (SrcFramePtr->DataOffs == 0)
|
||||||
|
{
|
||||||
|
printf ("Non-existent image to blt()\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
img = (TFB_Image *) ((BYTE *) SrcFramePtr + SrcFramePtr->DataOffs);
|
||||||
|
|
||||||
|
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||||
|
{
|
||||||
|
TFB_DrawCommand DC_on_stack;
|
||||||
|
TFB_DrawCommand *DrawCommand = &DC_on_stack;
|
||||||
|
|
||||||
|
// DrawCommand = HMalloc (sizeof (TFB_DrawCommand));
|
||||||
|
|
||||||
|
if (DrawCommand)
|
||||||
|
{
|
||||||
|
DrawCommand->Type = TFB_DRAWCOMMANDTYPE_IMAGE;
|
||||||
|
DrawCommand->x = pClipRect->corner.x -
|
||||||
|
GetFrameHotX (_CurFramePtr);
|
||||||
|
DrawCommand->y = pClipRect->corner.y -
|
||||||
|
GetFrameHotY (_CurFramePtr);
|
||||||
|
DrawCommand->w = img->SurfaceSDL->clip_rect.w;
|
||||||
|
DrawCommand->h = img->SurfaceSDL->clip_rect.h;
|
||||||
|
|
||||||
|
if (gscale != 0 && gscale != 256)
|
||||||
|
{
|
||||||
|
DrawCommand->x += (GetFrameHotX (SrcFramePtr) *
|
||||||
|
((1 << 8) - gscale)) >> 8;
|
||||||
|
DrawCommand->y += (GetFrameHotY (SrcFramePtr) *
|
||||||
|
((1 << 8) - gscale)) >> 8;
|
||||||
|
DrawCommand->w = (DrawCommand->w * gscale) >> 8;
|
||||||
|
DrawCommand->h = (DrawCommand->h * gscale) >> 8;
|
||||||
|
|
||||||
|
if (img->ScaledImg)
|
||||||
|
{
|
||||||
|
if (img->scale != gscale)
|
||||||
|
{
|
||||||
|
SDL_FreeSurface(img->ScaledImg);
|
||||||
|
img->ScaledImg = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!img->ScaledImg)
|
||||||
|
{
|
||||||
|
// Atleast melee zooming and planet surfaces will use this
|
||||||
|
|
||||||
|
// NOTE: Planet surfaces maybe causes memory leaks,
|
||||||
|
// I haven't currently seen DELETEIMAGE executed to them at all.
|
||||||
|
// Also, we might want to change the way they are implemented, as
|
||||||
|
// currently the scaled img is like 1936x600x32bit so it takes
|
||||||
|
// much memory and is perhaps too slow to process on slower systems.
|
||||||
|
// -Mika
|
||||||
|
|
||||||
|
// TODO: does this need mutexes?
|
||||||
|
|
||||||
|
SDL_Surface *new_surf;
|
||||||
|
|
||||||
|
img->scale = gscale;
|
||||||
|
new_surf = zoomSurface (img->DrawableImg, gscale / 256.0f,
|
||||||
|
gscale / 256.0f, SMOOTHING_OFF);
|
||||||
|
|
||||||
|
if (new_surf)
|
||||||
|
{
|
||||||
|
img->ScaledImg = TFB_DisplayFormatAlpha (new_surf);
|
||||||
|
|
||||||
|
if (img->ScaledImg)
|
||||||
|
{
|
||||||
|
SDL_FreeSurface(new_surf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("blt(): TFB_DisplayFormatAlpha failed\n");
|
||||||
|
img->ScaledImg = new_surf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("blt(): zoomSurface failed\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawCommand->image = (TFB_ImageStruct*) img; //TFB_Image
|
||||||
|
|
||||||
|
if (GetPrimType (PrimPtr) == STAMPFILL_PRIM)
|
||||||
|
{
|
||||||
|
DWORD c32k;
|
||||||
|
|
||||||
|
c32k = GetPrimColor (PrimPtr) >> 8; // shift out color index
|
||||||
|
DrawCommand->r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||||
|
DrawCommand->g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||||
|
DrawCommand->b = (c32k << (8 - 5));
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawCommand->Qualifier = (TYPE_GET (GetFrameParentDrawable (
|
||||||
|
SrcFramePtr)->FlagsAndIndex) >> FTYPE_SHIFT) &
|
||||||
|
MAPPED_TO_DISPLAY;
|
||||||
|
|
||||||
|
TFB_EnqueueDrawCommand(DrawCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SDL_Rect SDL_SrcRect, SDL_DstRect;
|
||||||
|
TFB_Image *dst_img;
|
||||||
|
|
||||||
|
dst_img = ((TFB_Image *) ((BYTE *) _CurFramePtr +
|
||||||
|
_CurFramePtr->DataOffs));
|
||||||
|
|
||||||
|
SDL_SrcRect.x = (short) img->SurfaceSDL->clip_rect.x;
|
||||||
|
SDL_SrcRect.y = (short) img->SurfaceSDL->clip_rect.y;
|
||||||
|
SDL_SrcRect.w = (short) img->SurfaceSDL->clip_rect.w;
|
||||||
|
SDL_SrcRect.h = (short) img->SurfaceSDL->clip_rect.h;
|
||||||
|
|
||||||
|
SDL_DstRect.x = (short) pClipRect->corner.x -
|
||||||
|
GetFrameHotX (_CurFramePtr) + SDL_SrcRect.x;
|
||||||
|
SDL_DstRect.y = (short) pClipRect->corner.y -
|
||||||
|
GetFrameHotY (_CurFramePtr) + SDL_SrcRect.y;
|
||||||
|
|
||||||
|
SDL_BlitSurface (
|
||||||
|
img->SurfaceSDL, // src
|
||||||
|
&SDL_SrcRect, // src rect
|
||||||
|
dst_img->SurfaceSDL,
|
||||||
|
&SDL_DstRect // dst rect
|
||||||
|
);
|
||||||
|
|
||||||
|
dst_img->dirty = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fillrect_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||||
|
{
|
||||||
|
BYTE r, g, b;
|
||||||
|
DWORD c32k;
|
||||||
|
|
||||||
|
c32k = GetPrimColor (PrimPtr) >> 8; //shift out color index
|
||||||
|
r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||||
|
g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||||
|
b = (c32k << (8 - 5));
|
||||||
|
|
||||||
|
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||||
|
{
|
||||||
|
TFB_DrawCommand DC_on_stack;
|
||||||
|
TFB_DrawCommand *DrawCommand = &DC_on_stack;
|
||||||
|
|
||||||
|
if (DrawCommand)
|
||||||
|
{
|
||||||
|
DrawCommand->Type = TFB_DRAWCOMMANDTYPE_RECTANGLE;
|
||||||
|
DrawCommand->x = pClipRect->corner.x - GetFrameHotX (_CurFramePtr);
|
||||||
|
DrawCommand->y = pClipRect->corner.y - GetFrameHotY (_CurFramePtr);
|
||||||
|
DrawCommand->w = pClipRect->extent.width;
|
||||||
|
DrawCommand->h = pClipRect->extent.height;
|
||||||
|
DrawCommand->r = r;
|
||||||
|
DrawCommand->g = g;
|
||||||
|
DrawCommand->b = b;
|
||||||
|
|
||||||
|
if (gscale && GetPrimType (PrimPtr) != POINT_PRIM)
|
||||||
|
{
|
||||||
|
DrawCommand->w = (DrawCommand->w * gscale) >> 8;
|
||||||
|
DrawCommand->h = (DrawCommand->h * gscale) >> 8;
|
||||||
|
DrawCommand->x += (pClipRect->extent.width -
|
||||||
|
DrawCommand->w) >> 1;
|
||||||
|
DrawCommand->y += (pClipRect->extent.height -
|
||||||
|
DrawCommand->h) >> 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawCommand->image = 0;
|
||||||
|
|
||||||
|
TFB_EnqueueDrawCommand(DrawCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SDL_Rect SDLRect;
|
||||||
|
TFB_Image *img;
|
||||||
|
|
||||||
|
img = ((TFB_Image *) ((BYTE *) _CurFramePtr +
|
||||||
|
_CurFramePtr->DataOffs));
|
||||||
|
|
||||||
|
SDLRect.x = (short) (pClipRect->corner.x -
|
||||||
|
GetFrameHotX (_CurFramePtr));
|
||||||
|
SDLRect.y = (short) (pClipRect->corner.y -
|
||||||
|
GetFrameHotY (_CurFramePtr));
|
||||||
|
SDLRect.w = (short) pClipRect->extent.width;
|
||||||
|
SDLRect.h = (short) pClipRect->extent.height;
|
||||||
|
|
||||||
|
SDL_FillRect (img->SurfaceSDL, &SDLRect, SDL_MapRGB (img->SurfaceSDL->format, r, g, b));
|
||||||
|
|
||||||
|
img->dirty = TRUE;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cmap_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||||
|
{
|
||||||
|
// printf ("Unimplemented function activated: cmap_blt()\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
line_blt (PRECT pClipRect, PRIMITIVEPTR PrimPtr)
|
||||||
|
{
|
||||||
|
float x1,y1,x2,y2;
|
||||||
|
BYTE r, g, b;
|
||||||
|
DWORD c32k;
|
||||||
|
|
||||||
|
c32k = GetPrimColor (PrimPtr) >> 8; // shift out color index
|
||||||
|
r = (c32k >> (10 - (8 - 5))) & 0xF8;
|
||||||
|
g = (c32k >> (5 - (8 - 5))) & 0xF8;
|
||||||
|
b = (c32k << (8 - 5));
|
||||||
|
|
||||||
|
x1=PrimPtr->Object.Line.first.x - GetFrameHotX (_CurFramePtr);
|
||||||
|
y1=PrimPtr->Object.Line.first.y - GetFrameHotY (_CurFramePtr);
|
||||||
|
x2=PrimPtr->Object.Line.second.x - GetFrameHotX (_CurFramePtr);
|
||||||
|
y2=PrimPtr->Object.Line.second.y - GetFrameHotY (_CurFramePtr);
|
||||||
|
|
||||||
|
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||||
|
{
|
||||||
|
TFB_DrawCommand DC;
|
||||||
|
|
||||||
|
DC.Type = TFB_DRAWCOMMANDTYPE_LINE;
|
||||||
|
DC.x = x1;
|
||||||
|
DC.y = y1;
|
||||||
|
DC.w = x2;
|
||||||
|
DC.h = y2;
|
||||||
|
DC.r = r;
|
||||||
|
DC.g = g;
|
||||||
|
DC.b = b;
|
||||||
|
DC.image = 0;
|
||||||
|
|
||||||
|
TFB_EnqueueDrawCommand(&DC);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
read_screen (PRECT lpRect, FRAMEPTR DstFramePtr)
|
||||||
|
{
|
||||||
|
if (TYPE_GET (_CurFramePtr->TypeIndexAndFlags) != SCREEN_DRAWABLE
|
||||||
|
|| TYPE_GET (DstFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE
|
||||||
|
|| !(TYPE_GET (GetFrameParentDrawable (DstFramePtr)
|
||||||
|
->FlagsAndIndex)
|
||||||
|
& ((DWORD) MAPPED_TO_DISPLAY << FTYPE_SHIFT)))
|
||||||
|
{
|
||||||
|
printf("Unimplemented function activated: read_screen()\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TFB_DrawCommand DC_auto;
|
||||||
|
TFB_DrawCommand* DC = &DC_auto;
|
||||||
|
|
||||||
|
DC->Type = TFB_DRAWCOMMANDTYPE_COPYBACKBUFFERTOOTHERBUFFER;
|
||||||
|
DC->x = lpRect->corner.x;
|
||||||
|
DC->y = lpRect->corner.y;
|
||||||
|
DC->w = lpRect->extent.width;
|
||||||
|
DC->h = lpRect->extent.height;
|
||||||
|
DC->image = (TFB_ImageStruct *) ((BYTE *) DstFramePtr +
|
||||||
|
DstFramePtr->DataOffs);
|
||||||
|
|
||||||
|
TFB_EnqueueDrawCommand (DC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static DRAWABLE
|
||||||
|
alloc_image (COUNT NumFrames, DRAWABLE_TYPE DrawableType, CREATE_FLAGS
|
||||||
|
flags, SIZE width, SIZE height)
|
||||||
|
{
|
||||||
|
DWORD data_byte_count;
|
||||||
|
DRAWABLE Drawable;
|
||||||
|
|
||||||
|
data_byte_count = 0;
|
||||||
|
if (flags & WANT_MASK)
|
||||||
|
data_byte_count += (DWORD) SCAN_WIDTH (width) * height;
|
||||||
|
if ((flags & WANT_PIXMAP) && DrawableType == RAM_DRAWABLE)
|
||||||
|
{
|
||||||
|
width = ((width << 1) + 3) & ~3;
|
||||||
|
data_byte_count += (DWORD) width * height;
|
||||||
|
}
|
||||||
|
|
||||||
|
Drawable = AllocDrawable (NumFrames, data_byte_count * NumFrames);
|
||||||
|
if (Drawable)
|
||||||
|
{
|
||||||
|
if (DrawableType == RAM_DRAWABLE)
|
||||||
|
{
|
||||||
|
COUNT i;
|
||||||
|
DWORD data_offs;
|
||||||
|
DRAWABLEPTR DrawablePtr;
|
||||||
|
FRAMEPTR F;
|
||||||
|
|
||||||
|
data_offs = sizeof (*F) * NumFrames;
|
||||||
|
DrawablePtr = LockDrawable (Drawable);
|
||||||
|
for (i = 0, F = &DrawablePtr->Frame[0]; i < NumFrames; ++i, ++F)
|
||||||
|
{
|
||||||
|
F->DataOffs = data_offs;
|
||||||
|
data_offs += data_byte_count - sizeof (*F);
|
||||||
|
}
|
||||||
|
UnlockDrawable (Drawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (Drawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
void (*func_array[]) (PRECT pClipRect, PRIMITIVEPTR PrimPtr) =
|
||||||
|
{
|
||||||
|
fillrect_blt,
|
||||||
|
blt,
|
||||||
|
blt,
|
||||||
|
line_blt,
|
||||||
|
_text_blt,
|
||||||
|
cmap_blt,
|
||||||
|
_rect_blt,
|
||||||
|
fillrect_blt,
|
||||||
|
_fillpoly_blt,
|
||||||
|
_fillpoly_blt,
|
||||||
|
};
|
||||||
|
|
||||||
|
static DISPLAY_INTERFACE DisplayInterface =
|
||||||
|
{
|
||||||
|
WANT_MASK,
|
||||||
|
|
||||||
|
16, // SCREEN_DEPTH,
|
||||||
|
320,
|
||||||
|
240,
|
||||||
|
|
||||||
|
alloc_image,
|
||||||
|
read_screen,
|
||||||
|
|
||||||
|
func_array,
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
LoadDisplay (PDISPLAY_INTERFACE *pDisplay)
|
||||||
|
{
|
||||||
|
*pDisplay = &DisplayInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status: Unimplemented
|
||||||
|
void
|
||||||
|
SetGraphicScale (int scale)
|
||||||
|
//Calibration...
|
||||||
|
{
|
||||||
|
gscale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,305 @@
|
|||||||
|
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef GFXMODULE_SDL
|
||||||
|
|
||||||
|
#include "sdl_common.h"
|
||||||
|
#include "rotozoom.h"
|
||||||
|
|
||||||
|
|
||||||
|
//Status: Not entirely unimplemented!
|
||||||
|
BOOLEAN
|
||||||
|
InitGraphics (int argc, char* argv[], COUNT KbytesRequired)
|
||||||
|
// Kbytes should only matter if we wanted to port Starcon2 to the
|
||||||
|
// hand-helds...
|
||||||
|
{
|
||||||
|
BOOLEAN ret;
|
||||||
|
|
||||||
|
LoadDisplay (&_pCurDisplay);
|
||||||
|
mem_init ();
|
||||||
|
ActivateDisplay ();
|
||||||
|
|
||||||
|
DrawCommandQueue = TFB_DrawCommandQueue_Create ();
|
||||||
|
|
||||||
|
ret = TRUE;
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status: Unimplemented
|
||||||
|
void
|
||||||
|
UninitGraphics () // Also probably empty
|
||||||
|
{
|
||||||
|
HFree (DrawCommandQueue);
|
||||||
|
|
||||||
|
HFree (ExtraScreen);
|
||||||
|
mem_uninit ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
BatchGraphics (void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
UnbatchGraphics (void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FlushGraphics (void)
|
||||||
|
{
|
||||||
|
continuity_break = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetGraphicUseOtherExtra (int other) //Could this possibly be more cryptic?!? :)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SetGraphicGrabOther (int grab_other)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status: Unimplemented
|
||||||
|
void
|
||||||
|
SetGraphicStrength (int numerator, int denominator)
|
||||||
|
// I just hope numerator always = denominator...
|
||||||
|
{
|
||||||
|
// printf("Unimplemented function activated: SetGrahicsStrength()\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status: Unimplemented
|
||||||
|
BOOLEAN
|
||||||
|
BatchColorMap (COLORMAPPTR ColorMapPtr)
|
||||||
|
// Batch... I wonder what that verb means in this context?
|
||||||
|
// SvdB: I don't think it is a verb.
|
||||||
|
{
|
||||||
|
BOOLEAN ret;
|
||||||
|
|
||||||
|
// printf("Unimplemented function activated: BatchColorMap()\n");
|
||||||
|
ret = TRUE;
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Status: Unimplemented
|
||||||
|
BOOLEAN
|
||||||
|
SetColorMap (COLORMAPPTR map)
|
||||||
|
//There's also a macro for thing in appglue.h... Hmm...
|
||||||
|
{
|
||||||
|
BOOLEAN ret;
|
||||||
|
|
||||||
|
//printf("Unimplemented function activated: SetColorMap()\n");
|
||||||
|
ret = TRUE;
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Status: Unimplemented
|
||||||
|
DWORD
|
||||||
|
XFormColorMap (COLORMAPPTR colormap, SIZE time)
|
||||||
|
// Not sure what the time's supposed to mean...
|
||||||
|
{
|
||||||
|
// printf ("Unimplemented function activated: XFormColorMap()\n");
|
||||||
|
return (GetTimeCounter () + time);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Status: Unimplemented
|
||||||
|
void
|
||||||
|
FlushColorXForms() //Not entirely sure what's done here. CLUT stuff?
|
||||||
|
{
|
||||||
|
// printf ("Unimplemented function activated: FlushColorXForms()\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Status: Unimplemented
|
||||||
|
void
|
||||||
|
ScreenTransition (int TransType, PRECT pRect) //TransType==3
|
||||||
|
{
|
||||||
|
//printf ("Unimplemented function activated: ScreenTransition()\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DrawFromExtraScreen (PRECT r) //No scaling?
|
||||||
|
{
|
||||||
|
RECT locRect;
|
||||||
|
TFB_DrawCommand DC;
|
||||||
|
|
||||||
|
if (!r)
|
||||||
|
{
|
||||||
|
locRect.corner.x = locRect.corner.y = 0;
|
||||||
|
locRect.extent.width = SCREEN_WIDTH;
|
||||||
|
locRect.extent.height = SCREEN_HEIGHT;
|
||||||
|
r = &locRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
DC.Type = TFB_DRAWCOMMANDTYPE_COPYFROMOTHERBUFFER;
|
||||||
|
DC.x = r->corner.x;
|
||||||
|
DC.y = r->corner.y;
|
||||||
|
DC.w = r->extent.width;
|
||||||
|
DC.h = r->extent.height;
|
||||||
|
DC.image = 0;
|
||||||
|
|
||||||
|
TFB_EnqueueDrawCommand (&DC);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
LoadIntoExtraScreen (PRECT r)
|
||||||
|
{
|
||||||
|
RECT locRect;
|
||||||
|
TFB_DrawCommand DC;
|
||||||
|
|
||||||
|
if (!r)
|
||||||
|
{
|
||||||
|
locRect.corner.x = locRect.corner.y = 0;
|
||||||
|
locRect.extent.width = SCREEN_WIDTH;
|
||||||
|
locRect.extent.height = SCREEN_HEIGHT;
|
||||||
|
r = &locRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
// printf ("LoadIntoExtraScreen (%d, %d, {%d, %d})\n", r->corner.x, r->corner.y, r->extent.width, r->extent.height);
|
||||||
|
// DC = HMalloc (sizeof (TFB_DrawCommand));
|
||||||
|
|
||||||
|
DC.Type = TFB_DRAWCOMMANDTYPE_COPYBACKBUFFERTOOTHERBUFFER;
|
||||||
|
DC.x = r->corner.x;
|
||||||
|
DC.y = r->corner.y;
|
||||||
|
DC.w = r->extent.width;
|
||||||
|
DC.h = r->extent.height;
|
||||||
|
DC.image = 0;
|
||||||
|
|
||||||
|
TFB_EnqueueDrawCommand (&DC);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status: Ignored
|
||||||
|
BOOLEAN
|
||||||
|
InitVideo (BOOLEAN useCDROM) //useCDROM doesn't really apply to us...
|
||||||
|
{
|
||||||
|
BOOLEAN ret;
|
||||||
|
|
||||||
|
// printf("Unimplemented function activated: InitVideo()\n");
|
||||||
|
ret = TRUE;
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status: Ignored
|
||||||
|
void
|
||||||
|
UninitVideo () //empty
|
||||||
|
{
|
||||||
|
// printf("Unimplemented function activated: UninitVideo()\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Status: Unimplemented
|
||||||
|
void
|
||||||
|
VidStop() // At least this one makes sense.
|
||||||
|
{
|
||||||
|
// printf ("Unimplemented function activated: VidStop()\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Status: Unimplemented
|
||||||
|
MEM_HANDLE
|
||||||
|
VidPlaying() // Easy enough.
|
||||||
|
{
|
||||||
|
MEM_HANDLE ret;
|
||||||
|
|
||||||
|
//printf("Unimplemented function activated: VidPlaying()\n");
|
||||||
|
ret = 0;
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Status: Unimplemented
|
||||||
|
VIDEO_TYPE
|
||||||
|
VidPlay (VIDEO_REF VidRef, char *loopname, BOOLEAN uninit)
|
||||||
|
// uninit? when done, I guess.
|
||||||
|
{
|
||||||
|
VIDEO_TYPE ret;
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
// printf("Unimplemented function activated: VidPlay()\n");
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
VIDEO_REF
|
||||||
|
_init_video_file(PVOID pStr)
|
||||||
|
{
|
||||||
|
VIDEO_REF ret;
|
||||||
|
|
||||||
|
printf ("Unimplemented function activated: _init_video_file()\n");
|
||||||
|
ret = 0;
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Status: Unimplemented
|
||||||
|
BOOLEAN
|
||||||
|
_image_intersect (PIMAGE_BOX box1, PIMAGE_BOX box2, PRECT rect)
|
||||||
|
// This is a biggie.
|
||||||
|
{
|
||||||
|
BOOLEAN ret;
|
||||||
|
|
||||||
|
// printf ("Unimplemented function activated: _image_intersect()\n");
|
||||||
|
ret = TRUE;
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Status: Implemented!
|
||||||
|
DWORD
|
||||||
|
GetTimeCounter () //I wonder if it's ms, ticks, or seconds...
|
||||||
|
{
|
||||||
|
DWORD ret;
|
||||||
|
|
||||||
|
ret = (DWORD) (SDL_GetTicks () * ONE_SECOND / 1000.0);
|
||||||
|
return (ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
SetSemaphore (SEMAPHORE *sem)
|
||||||
|
{
|
||||||
|
SDL_SemWait (*sem);
|
||||||
|
return (GetTimeCounter ());
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ClearSemaphore (SEMAPHORE *sem)
|
||||||
|
{
|
||||||
|
SDL_SemPost (*sem);
|
||||||
|
}
|
||||||
|
|
||||||
|
TASK
|
||||||
|
AddTask (TASK_FUNC arg1, COUNT arg2)
|
||||||
|
{
|
||||||
|
return (SDL_CreateThread ((int (*)(void *)) arg1, NULL));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
DeleteTask (TASK T)
|
||||||
|
{
|
||||||
|
SDL_KillThread (T);
|
||||||
|
}
|
||||||
|
|
||||||
|
DWORD
|
||||||
|
SleepTask (DWORD wake_time)
|
||||||
|
{
|
||||||
|
DWORD t;
|
||||||
|
|
||||||
|
t = GetTimeCounter ();
|
||||||
|
if (wake_time <= t)
|
||||||
|
SDL_Delay (0);
|
||||||
|
else
|
||||||
|
SDL_Delay ((wake_time - t) * 1000 / ONE_SECOND);
|
||||||
|
|
||||||
|
return (GetTimeCounter ());
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,486 @@
|
|||||||
|
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef GFXMODULE_SDL
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#include <io.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include "sdl_common.h"
|
||||||
|
|
||||||
|
// following stuff was in libs/graphics/getbody.c before modularization
|
||||||
|
|
||||||
|
|
||||||
|
extern char *_cur_resfile_name;
|
||||||
|
|
||||||
|
static void
|
||||||
|
process_image (FRAMEPTR FramePtr, SDL_Surface *img[], int cel_ct)
|
||||||
|
{
|
||||||
|
int hx, hy, h;
|
||||||
|
|
||||||
|
TYPE_SET (FramePtr->TypeIndexAndFlags, WANT_PIXMAP << FTYPE_SHIFT);
|
||||||
|
INDEX_SET (FramePtr->TypeIndexAndFlags, cel_ct);
|
||||||
|
|
||||||
|
hx = hy = 0;
|
||||||
|
|
||||||
|
SDL_LockSurface (img[cel_ct]);
|
||||||
|
if (img[cel_ct]->w >= 3 && (h = img[cel_ct]->h))
|
||||||
|
{
|
||||||
|
if (img[cel_ct]->format->palette)
|
||||||
|
{
|
||||||
|
int w;
|
||||||
|
BYTE *pixel, *p, Cknockout, Chotx, Choty;
|
||||||
|
|
||||||
|
img[cel_ct]->clip_rect.x = img[cel_ct]->w;
|
||||||
|
img[cel_ct]->clip_rect.y = img[cel_ct]->h;
|
||||||
|
img[cel_ct]->clip_rect.w = img[cel_ct]->clip_rect.h = 0;
|
||||||
|
p = pixel = img[cel_ct]->pixels;
|
||||||
|
Cknockout = *p++;
|
||||||
|
Chotx = *p;
|
||||||
|
*p++ = Cknockout;
|
||||||
|
Choty = *p;
|
||||||
|
*p++ = Cknockout;
|
||||||
|
SDL_SetColorKey
|
||||||
|
(
|
||||||
|
img[cel_ct], SDL_SRCCOLORKEY,
|
||||||
|
SDL_MapRGB
|
||||||
|
(
|
||||||
|
img[cel_ct]->format,
|
||||||
|
img[cel_ct]->format->palette->colors[Cknockout].r,
|
||||||
|
img[cel_ct]->format->palette->colors[Cknockout].g,
|
||||||
|
img[cel_ct]->format->palette->colors[Cknockout].b
|
||||||
|
)
|
||||||
|
);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
w = img[cel_ct]->w - (p - pixel);
|
||||||
|
if (w)
|
||||||
|
{
|
||||||
|
int x, y;
|
||||||
|
BYTE opval;
|
||||||
|
|
||||||
|
opval = Cknockout;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
BYTE pval;
|
||||||
|
|
||||||
|
pval = *p;
|
||||||
|
if (pval == Chotx)
|
||||||
|
{
|
||||||
|
*p = Cknockout;
|
||||||
|
hx = img[cel_ct]->w - w;
|
||||||
|
}
|
||||||
|
if (pval == Choty)
|
||||||
|
{
|
||||||
|
*p = Cknockout;
|
||||||
|
hy = img[cel_ct]->h - h;
|
||||||
|
}
|
||||||
|
|
||||||
|
pval = *p;
|
||||||
|
if (pval == Cknockout)
|
||||||
|
{
|
||||||
|
if (opval != Cknockout)
|
||||||
|
{
|
||||||
|
x = img[cel_ct]->w - w;
|
||||||
|
if (x > img[cel_ct]->clip_rect.x + img[cel_ct]->clip_rect.w)
|
||||||
|
img[cel_ct]->clip_rect.w = x - img[cel_ct]->clip_rect.x;
|
||||||
|
y = img[cel_ct]->h - h;
|
||||||
|
if (y >= img[cel_ct]->clip_rect.y + img[cel_ct]->clip_rect.h)
|
||||||
|
img[cel_ct]->clip_rect.h = y - img[cel_ct]->clip_rect.y + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (opval == Cknockout)
|
||||||
|
{
|
||||||
|
x = img[cel_ct]->w - w;
|
||||||
|
if (x < img[cel_ct]->clip_rect.x)
|
||||||
|
{
|
||||||
|
if (img[cel_ct]->clip_rect.w == 0)
|
||||||
|
img[cel_ct]->clip_rect.w = 1;
|
||||||
|
else
|
||||||
|
img[cel_ct]->clip_rect.w += img[cel_ct]->clip_rect.x - x;
|
||||||
|
img[cel_ct]->clip_rect.x = x;
|
||||||
|
}
|
||||||
|
y = img[cel_ct]->h - h;
|
||||||
|
if (y < img[cel_ct]->clip_rect.y)
|
||||||
|
{
|
||||||
|
if (img[cel_ct]->clip_rect.h == 0)
|
||||||
|
img[cel_ct]->clip_rect.h = 1;
|
||||||
|
else
|
||||||
|
img[cel_ct]->clip_rect.h += img[cel_ct]->clip_rect.y - y;
|
||||||
|
img[cel_ct]->clip_rect.y = y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
opval = pval;
|
||||||
|
} while (++p, --w);
|
||||||
|
if (opval != Cknockout)
|
||||||
|
{
|
||||||
|
x = img[cel_ct]->w - w;
|
||||||
|
if (x > img[cel_ct]->clip_rect.x + img[cel_ct]->clip_rect.w)
|
||||||
|
img[cel_ct]->clip_rect.w = x - img[cel_ct]->clip_rect.x;
|
||||||
|
y = img[cel_ct]->h - h;
|
||||||
|
if (y >= img[cel_ct]->clip_rect.y + img[cel_ct]->clip_rect.h)
|
||||||
|
img[cel_ct]->clip_rect.h = y - img[cel_ct]->clip_rect.y + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p = (pixel += img[cel_ct]->pitch);
|
||||||
|
} while (--h);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SDL_UnlockSurface (img[cel_ct]);
|
||||||
|
|
||||||
|
hx -= img[cel_ct]->clip_rect.x;
|
||||||
|
hy -= img[cel_ct]->clip_rect.y;
|
||||||
|
FramePtr->DataOffs = (BYTE *)TFB_LoadImage (img[cel_ct]) - (BYTE *)FramePtr;
|
||||||
|
img[cel_ct] = ((TFB_Image *)((BYTE *)FramePtr + FramePtr->DataOffs))->SurfaceSDL;
|
||||||
|
hx += img[cel_ct]->clip_rect.x;
|
||||||
|
hy += img[cel_ct]->clip_rect.y;
|
||||||
|
SetFrameHotSpot (FramePtr, MAKE_HOT_SPOT (hx, hy));
|
||||||
|
SetFrameBounds (FramePtr, img[cel_ct]->clip_rect.w, img[cel_ct]->clip_rect.h);
|
||||||
|
#if 0
|
||||||
|
printf ("\thot[%d, %d], rect[%d, %d, %d, %d]\n",
|
||||||
|
hx, hy,
|
||||||
|
img[cel_ct]->clip_rect.x,
|
||||||
|
img[cel_ct]->clip_rect.y,
|
||||||
|
img[cel_ct]->clip_rect.w,
|
||||||
|
img[cel_ct]->clip_rect.h);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
MEM_HANDLE
|
||||||
|
_GetCelData (FILE *fp, DWORD length)
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
int omode;
|
||||||
|
#endif
|
||||||
|
int cel_ct, n;
|
||||||
|
DWORD opos;
|
||||||
|
char CurrentLine[1024], filename[1024];
|
||||||
|
#define MAX_CELS 256
|
||||||
|
SDL_Surface *img[MAX_CELS];
|
||||||
|
DRAWABLE Drawable;
|
||||||
|
|
||||||
|
opos = ftell (fp);
|
||||||
|
|
||||||
|
{
|
||||||
|
char *s1, *s2;
|
||||||
|
|
||||||
|
if (_cur_resfile_name == 0
|
||||||
|
|| (((s2 = 0), (s1 = strrchr (_cur_resfile_name, '/')) == 0)
|
||||||
|
&& (s2 = strrchr (_cur_resfile_name, '\\')) == 0))
|
||||||
|
n = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (s2 > s1)
|
||||||
|
s1 = s2;
|
||||||
|
n = s1 - _cur_resfile_name + 1;
|
||||||
|
strncpy (filename, _cur_resfile_name, n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
omode = _setmode (fileno (fp), O_TEXT);
|
||||||
|
#endif
|
||||||
|
cel_ct = 0;
|
||||||
|
while (fgets (CurrentLine, sizeof (CurrentLine), fp) && cel_ct < MAX_CELS)
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
sscanf(CurrentLine, "%s", &filename[n]) == 1
|
||||||
|
&& (img[cel_ct] = IMG_Load (filename))
|
||||||
|
&& img[cel_ct]->w > 0
|
||||||
|
&& img[cel_ct]->h > 0
|
||||||
|
&& img[cel_ct]->format->BitsPerPixel >= 8
|
||||||
|
)
|
||||||
|
++cel_ct;
|
||||||
|
else if (img[cel_ct])
|
||||||
|
printf("_GetCelData: Bad file!\n"),
|
||||||
|
SDL_FreeSurface (img[cel_ct]);
|
||||||
|
|
||||||
|
if ((int)ftell (fp) - (int)opos >= (int)length)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#ifdef WIN32
|
||||||
|
_setmode (fileno (fp), omode);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Drawable = 0;
|
||||||
|
if (cel_ct && (Drawable = AllocDrawable (cel_ct, 0)))
|
||||||
|
{
|
||||||
|
DRAWABLEPTR DrawablePtr;
|
||||||
|
|
||||||
|
if ((DrawablePtr = LockDrawable (Drawable)) == 0)
|
||||||
|
{
|
||||||
|
while (cel_ct--)
|
||||||
|
SDL_FreeSurface (img[cel_ct]);
|
||||||
|
|
||||||
|
mem_release (Drawable);
|
||||||
|
Drawable = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FRAMEPTR FramePtr;
|
||||||
|
|
||||||
|
DrawablePtr->hDrawable = GetDrawableHandle (Drawable);
|
||||||
|
TYPE_SET (DrawablePtr->FlagsAndIndex,
|
||||||
|
(DRAWABLE_TYPE)ROM_DRAWABLE << FTYPE_SHIFT);
|
||||||
|
INDEX_SET (DrawablePtr->FlagsAndIndex, cel_ct - 1);
|
||||||
|
|
||||||
|
FramePtr = &DrawablePtr->Frame[cel_ct];
|
||||||
|
while (--FramePtr, cel_ct--)
|
||||||
|
process_image (FramePtr, img, cel_ct);
|
||||||
|
|
||||||
|
UnlockDrawable (Drawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Drawable == 0)
|
||||||
|
printf ("Couldn't get cel data for '%s'\n", _cur_resfile_name);
|
||||||
|
return (GetDrawableHandle (Drawable));
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
_ReleaseCelData (MEM_HANDLE handle)
|
||||||
|
{
|
||||||
|
DRAWABLEPTR DrawablePtr;
|
||||||
|
|
||||||
|
if ((DrawablePtr = LockDrawable (handle)) == 0)
|
||||||
|
return (FALSE);
|
||||||
|
|
||||||
|
if (TYPE_GET (DrawablePtr->FlagsAndIndex) != SCREEN_DRAWABLE)
|
||||||
|
{
|
||||||
|
int cel_ct;
|
||||||
|
FRAMEPTR FramePtr;
|
||||||
|
|
||||||
|
cel_ct = INDEX_GET (DrawablePtr->FlagsAndIndex);
|
||||||
|
|
||||||
|
FramePtr = &DrawablePtr->Frame[cel_ct];
|
||||||
|
while (--FramePtr, cel_ct--)
|
||||||
|
{
|
||||||
|
if (FramePtr->DataOffs)
|
||||||
|
{
|
||||||
|
TFB_Image *img;
|
||||||
|
|
||||||
|
img = (TFB_Image *)((BYTE *)FramePtr + FramePtr->DataOffs);
|
||||||
|
FramePtr->DataOffs = 0;
|
||||||
|
|
||||||
|
TFB_FreeImage (img);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UnlockDrawable (handle);
|
||||||
|
mem_release (handle);
|
||||||
|
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
MEM_HANDLE
|
||||||
|
_GetFontData (FILE *fp, DWORD length)
|
||||||
|
{
|
||||||
|
DWORD cel_ct;
|
||||||
|
COUNT num_entries;
|
||||||
|
FONT_REF FontRef;
|
||||||
|
DIRENTRY FontDir;
|
||||||
|
BOOLEAN found_chars;
|
||||||
|
#define MAX_CELS 256
|
||||||
|
SDL_Surface *img[MAX_CELS] = { 0 };
|
||||||
|
char pattern[1024];
|
||||||
|
|
||||||
|
if (_cur_resfile_name == 0)
|
||||||
|
return (0);
|
||||||
|
sprintf (pattern, "%s/*.*", _cur_resfile_name);
|
||||||
|
|
||||||
|
found_chars = FALSE;
|
||||||
|
FontDir = CaptureDirEntryTable (LoadDirEntryTable (pattern, &num_entries));
|
||||||
|
while (num_entries--)
|
||||||
|
{
|
||||||
|
char *char_name;
|
||||||
|
|
||||||
|
char_name = GetDirEntryAddress (SetAbsDirEntryTableIndex (FontDir, num_entries));
|
||||||
|
if (sscanf (char_name, "%u.", (unsigned int*) &cel_ct) == 1
|
||||||
|
&& cel_ct >= FIRST_CHAR
|
||||||
|
&& img[cel_ct -= FIRST_CHAR] == 0
|
||||||
|
&& sprintf (pattern, "%s/%s", _cur_resfile_name, char_name)
|
||||||
|
&& (img[cel_ct] = IMG_Load (pattern)))
|
||||||
|
{
|
||||||
|
if (img[cel_ct]->w > 0
|
||||||
|
&& img[cel_ct]->h > 0
|
||||||
|
&& img[cel_ct]->format->BitsPerPixel >= 8)
|
||||||
|
found_chars = TRUE;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SDL_FreeSurface (img[cel_ct]);
|
||||||
|
img[cel_ct] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
DestroyDirEntryTable (ReleaseDirEntryTable (FontDir));
|
||||||
|
|
||||||
|
FontRef = 0;
|
||||||
|
if (found_chars && (FontRef = AllocFont (0)))
|
||||||
|
{
|
||||||
|
FONTPTR FontPtr;
|
||||||
|
|
||||||
|
cel_ct = MAX_CELS; // MAX_CHARS;
|
||||||
|
if ((FontPtr = LockFont (FontRef)) == 0)
|
||||||
|
{
|
||||||
|
while (cel_ct--)
|
||||||
|
{
|
||||||
|
if (img[cel_ct])
|
||||||
|
SDL_FreeSurface (img[cel_ct]);
|
||||||
|
}
|
||||||
|
|
||||||
|
mem_release (FontRef);
|
||||||
|
FontRef = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FRAMEPTR FramePtr;
|
||||||
|
|
||||||
|
FontPtr->FontRef = FontRef;
|
||||||
|
FontPtr->Leading = 0;
|
||||||
|
FramePtr = &FontPtr->CharDesc[cel_ct];
|
||||||
|
while (--FramePtr, cel_ct--)
|
||||||
|
{
|
||||||
|
if (img[cel_ct])
|
||||||
|
{
|
||||||
|
process_image (FramePtr, img, cel_ct);
|
||||||
|
SetFrameBounds (FramePtr, GetFrameWidth (FramePtr) + 1, GetFrameHeight (FramePtr));
|
||||||
|
if (img[0])
|
||||||
|
SetFrameHotSpot (FramePtr, MAKE_HOT_SPOT (0, img[0]->clip_rect.h));
|
||||||
|
if (GetFrameHeight (FramePtr) > FontPtr->Leading)
|
||||||
|
FontPtr->Leading = GetFrameHeight (FramePtr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++FontPtr->Leading;
|
||||||
|
|
||||||
|
UnlockFont (FontRef);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
(void) fp; /* Satisfying compiler (unused parameter) */
|
||||||
|
(void) length; /* Satisfying compiler (unused parameter) */
|
||||||
|
return (FontRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
_ReleaseFontData (MEM_HANDLE handle)
|
||||||
|
{
|
||||||
|
FONTPTR FontPtr;
|
||||||
|
|
||||||
|
if ((FontPtr = LockFont (handle)) == 0)
|
||||||
|
return (FALSE);
|
||||||
|
|
||||||
|
{
|
||||||
|
int cel_ct;
|
||||||
|
FRAMEPTR FramePtr;
|
||||||
|
|
||||||
|
cel_ct = MAX_CHARS;
|
||||||
|
|
||||||
|
FramePtr = &FontPtr->CharDesc[cel_ct];
|
||||||
|
while (--FramePtr, cel_ct--)
|
||||||
|
{
|
||||||
|
if (FramePtr->DataOffs)
|
||||||
|
{
|
||||||
|
TFB_Image *img;
|
||||||
|
|
||||||
|
img = (TFB_Image *)((BYTE *)FramePtr + FramePtr->DataOffs);
|
||||||
|
FramePtr->DataOffs = 0;
|
||||||
|
|
||||||
|
TFB_FreeImage (img);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UnlockFont (handle);
|
||||||
|
mem_release (handle);
|
||||||
|
|
||||||
|
return (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// _request_drawable was in libs/graphics/drawable.c before modularization
|
||||||
|
|
||||||
|
DRAWABLE
|
||||||
|
_request_drawable (COUNT NumFrames, DRAWABLE_TYPE DrawableType,
|
||||||
|
CREATE_FLAGS flags, SIZE width, SIZE height)
|
||||||
|
{
|
||||||
|
DRAWABLE Drawable;
|
||||||
|
|
||||||
|
Drawable = AllocDrawableImage (
|
||||||
|
NumFrames, DrawableType, flags, width, height
|
||||||
|
);
|
||||||
|
if (Drawable)
|
||||||
|
{
|
||||||
|
DRAWABLEPTR DrawablePtr;
|
||||||
|
|
||||||
|
if ((DrawablePtr = LockDrawable (Drawable)) == 0)
|
||||||
|
{
|
||||||
|
FreeDrawable (Drawable);
|
||||||
|
Drawable = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int imgw, imgh;
|
||||||
|
FRAMEPTR FramePtr;
|
||||||
|
|
||||||
|
DrawablePtr->hDrawable = GetDrawableHandle (Drawable);
|
||||||
|
TYPE_SET (DrawablePtr->FlagsAndIndex, flags << FTYPE_SHIFT);
|
||||||
|
INDEX_SET (DrawablePtr->FlagsAndIndex, NumFrames - 1);
|
||||||
|
|
||||||
|
imgw = (flags & MAPPED_TO_DISPLAY) ? width * ScreenWidthActual / ScreenWidth : width;
|
||||||
|
imgh = (flags & MAPPED_TO_DISPLAY) ? height * ScreenHeightActual / ScreenHeight : height;
|
||||||
|
FramePtr = &DrawablePtr->Frame[NumFrames - 1];
|
||||||
|
while (NumFrames--)
|
||||||
|
{
|
||||||
|
TFB_Image *Image;
|
||||||
|
|
||||||
|
|
||||||
|
if (DrawableType == RAM_DRAWABLE
|
||||||
|
&& (Image = TFB_LoadImage (SDL_CreateRGBSurface (
|
||||||
|
SDL_HWSURFACE,
|
||||||
|
imgw,
|
||||||
|
imgh,
|
||||||
|
24,
|
||||||
|
0x00FF0000,
|
||||||
|
0x0000FF00,
|
||||||
|
0x000000FF,
|
||||||
|
0x00000000
|
||||||
|
))))
|
||||||
|
FramePtr->DataOffs = (BYTE *)Image - (BYTE *)FramePtr;
|
||||||
|
|
||||||
|
TYPE_SET (FramePtr->TypeIndexAndFlags, DrawableType);
|
||||||
|
INDEX_SET (FramePtr->TypeIndexAndFlags, NumFrames);
|
||||||
|
SetFrameBounds (FramePtr, width, height);
|
||||||
|
--FramePtr;
|
||||||
|
}
|
||||||
|
UnlockDrawable (Drawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (Drawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef GFXMODULE_SDL
|
||||||
|
|
||||||
|
#include "sdl_common.h"
|
||||||
|
|
||||||
|
SDL_mutex *DCQ_mutex;
|
||||||
|
|
||||||
|
#define DCQ_MAX 4096
|
||||||
|
TFB_DrawCommand DCQ[DCQ_MAX];
|
||||||
|
|
||||||
|
TFB_DrawCommandQueue *DrawCommandQueue;
|
||||||
|
|
||||||
|
|
||||||
|
// Draw Command Queue Stuff
|
||||||
|
|
||||||
|
TFB_DrawCommandQueue*
|
||||||
|
TFB_DrawCommandQueue_Create()
|
||||||
|
{
|
||||||
|
TFB_DrawCommandQueue* myQueue;
|
||||||
|
|
||||||
|
myQueue = (TFB_DrawCommandQueue*) HMalloc(
|
||||||
|
sizeof(TFB_DrawCommandQueue));
|
||||||
|
|
||||||
|
myQueue->Back = 0;
|
||||||
|
myQueue->Front = 0;
|
||||||
|
myQueue->Size = 0;
|
||||||
|
|
||||||
|
DCQ_mutex = SDL_CreateMutex();
|
||||||
|
|
||||||
|
return (myQueue);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TFB_DrawCommandQueue_Push (TFB_DrawCommandQueue* myQueue,
|
||||||
|
TFB_DrawCommand* Command)
|
||||||
|
{
|
||||||
|
SDL_mutexP(DCQ_mutex);
|
||||||
|
if (myQueue->Size < DCQ_MAX)
|
||||||
|
{
|
||||||
|
DCQ[myQueue->Back] = *Command;
|
||||||
|
myQueue->Back = (myQueue->Back + 1) % DCQ_MAX;
|
||||||
|
myQueue->Size++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TFB_DeallocateDrawCommand(Command);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_mutexV(DCQ_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
TFB_DrawCommandQueue_Pop (TFB_DrawCommandQueue *myQueue, TFB_DrawCommand *target)
|
||||||
|
{
|
||||||
|
SDL_mutexP(DCQ_mutex);
|
||||||
|
|
||||||
|
if (myQueue->Size == 0)
|
||||||
|
{
|
||||||
|
SDL_mutexV(DCQ_mutex);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (myQueue->Front == myQueue->Back && myQueue->Size != DCQ_MAX)
|
||||||
|
{
|
||||||
|
printf("Augh! Assertion failure in DCQ! Front == Back, Size != DCQ_MAX\n");
|
||||||
|
myQueue->Size = 0;
|
||||||
|
SDL_mutexV(DCQ_mutex);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
*target = DCQ[myQueue->Front];
|
||||||
|
myQueue->Front = (myQueue->Front + 1) % DCQ_MAX;
|
||||||
|
|
||||||
|
myQueue->Size--;
|
||||||
|
SDL_mutexV(DCQ_mutex);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TFB_DeallocateDrawCommand (TFB_DrawCommand* Command)
|
||||||
|
{
|
||||||
|
//HFree(Command);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TFB_EnqueueDrawCommand (TFB_DrawCommand* DrawCommand)
|
||||||
|
{
|
||||||
|
if (TFB_DEBUG_HALT)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DrawCommand->Type <= TFB_DRAWCOMMANDTYPE_COPYFROMOTHERBUFFER
|
||||||
|
&& TYPE_GET (_CurFramePtr->TypeIndexAndFlags) == SCREEN_DRAWABLE)
|
||||||
|
{
|
||||||
|
static RECT scissor_rect;
|
||||||
|
|
||||||
|
// Set the clipping region.
|
||||||
|
if (scissor_rect.corner.x != _pCurContext->ClipRect.corner.x
|
||||||
|
|| scissor_rect.corner.y != _pCurContext->ClipRect.corner.y
|
||||||
|
|| scissor_rect.extent.width !=
|
||||||
|
_pCurContext->ClipRect.extent.width
|
||||||
|
|| scissor_rect.extent.height !=
|
||||||
|
_pCurContext->ClipRect.extent.height)
|
||||||
|
{
|
||||||
|
// Enqueue command to set the glScissor spec
|
||||||
|
TFB_DrawCommand DC_auto;
|
||||||
|
TFB_DrawCommand* DC = &DC_auto;
|
||||||
|
|
||||||
|
scissor_rect = _pCurContext->ClipRect;
|
||||||
|
|
||||||
|
DC->Type = scissor_rect.extent.width
|
||||||
|
? (DC->x = scissor_rect.corner.x,
|
||||||
|
DC->y=scissor_rect.corner.y,
|
||||||
|
DC->w=scissor_rect.extent.width,
|
||||||
|
DC->h=scissor_rect.extent.height),
|
||||||
|
TFB_DRAWCOMMANDTYPE_SCISSORENABLE
|
||||||
|
: TFB_DRAWCOMMANDTYPE_SCISSORDISABLE;
|
||||||
|
|
||||||
|
DC->image = 0;
|
||||||
|
|
||||||
|
TFB_EnqueueDrawCommand(DC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TFB_DrawCommandQueue_Push (DrawCommandQueue, DrawCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined (GFXMODULE_SDL) && defined (HAVE_OPENGL)
|
||||||
|
|
||||||
|
#include "libs/graphics/sdl/opengl.h"
|
||||||
|
|
||||||
|
static SDL_Surface *format_conv_surf;
|
||||||
|
|
||||||
|
static int ScreenWidthOpenGL;
|
||||||
|
static int ScreenHeightOpenGL;
|
||||||
|
static int ScreenFilterMode;
|
||||||
|
static unsigned int DisplayTexture;
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||||
|
{
|
||||||
|
char VideoName[256];
|
||||||
|
int videomode_flags;
|
||||||
|
|
||||||
|
GraphicsDriver = driver;
|
||||||
|
|
||||||
|
printf("Initializing SDL (OpenGL).\n");
|
||||||
|
|
||||||
|
if ((SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) == -1))
|
||||||
|
{
|
||||||
|
printf("Could not initialize SDL: %s.\n", SDL_GetError());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_VideoDriverName (VideoName, sizeof (VideoName));
|
||||||
|
printf("SDL driver used: %s\n", VideoName);
|
||||||
|
atexit (SDL_Quit);
|
||||||
|
|
||||||
|
printf ("SDL initialized.\n");
|
||||||
|
printf ("Initializing Screen.\n");
|
||||||
|
|
||||||
|
ScreenWidth = 320;
|
||||||
|
ScreenHeight = 240;
|
||||||
|
ScreenWidthActual = ScreenWidth;
|
||||||
|
ScreenHeightActual = ScreenHeight;
|
||||||
|
|
||||||
|
ScreenWidthOpenGL = width;
|
||||||
|
ScreenHeightOpenGL = height;
|
||||||
|
|
||||||
|
switch(bpp) {
|
||||||
|
case 8:
|
||||||
|
printf("bpp of 8 not supported under OpenGL\n");
|
||||||
|
exit(-1);
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 5);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 5);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 6);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 5);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 24:
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, bpp);
|
||||||
|
SDL_GL_SetAttribute (SDL_GL_DOUBLEBUFFER, 1);
|
||||||
|
|
||||||
|
videomode_flags = SDL_OPENGL;
|
||||||
|
if (flags & TFB_GFXFLAGS_FULLSCREEN)
|
||||||
|
videomode_flags |= SDL_FULLSCREEN;
|
||||||
|
|
||||||
|
SDL_Video = SDL_SetVideoMode (ScreenWidthOpenGL, ScreenHeightOpenGL,
|
||||||
|
bpp, videomode_flags);
|
||||||
|
|
||||||
|
if (SDL_Video == NULL)
|
||||||
|
{
|
||||||
|
printf ("Couldn't set OpenGL %ix%ix%i video mode: %s\n",
|
||||||
|
ScreenWidthOpenGL, ScreenHeightOpenGL, bpp,
|
||||||
|
SDL_GetError ());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf ("Set the resolution to: %ix%ix%i\n",
|
||||||
|
SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h,
|
||||||
|
SDL_GetVideoSurface()->format->BitsPerPixel);
|
||||||
|
|
||||||
|
printf("OpenGL renderer: %s version: %s\n", glGetString(GL_RENDERER),
|
||||||
|
glGetString(GL_VERSION));
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Screen = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidthActual, ScreenHeightActual, 32,
|
||||||
|
0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000);
|
||||||
|
|
||||||
|
if (SDL_Screen == NULL)
|
||||||
|
{
|
||||||
|
printf("Couldn't create back buffer: %s\n",
|
||||||
|
SDL_GetError());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ExtraScreen = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidthActual, ScreenHeightActual, 32,
|
||||||
|
0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000);
|
||||||
|
|
||||||
|
if (ExtraScreen == NULL)
|
||||||
|
{
|
||||||
|
printf("Couldn't create workspace buffer: %s\n",
|
||||||
|
SDL_GetError());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
format_conv_surf = SDL_CreateRGBSurface(SDL_SWSURFACE, 0, 0, 32,
|
||||||
|
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000);
|
||||||
|
|
||||||
|
if (format_conv_surf == NULL)
|
||||||
|
{
|
||||||
|
printf("Couldn't create format_conv_surf: %s\n",
|
||||||
|
SDL_GetError());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flags & TFB_GFXFLAGS_BILINEAR_FILTERING)
|
||||||
|
ScreenFilterMode = GL_LINEAR;
|
||||||
|
else
|
||||||
|
ScreenFilterMode = GL_NEAREST;
|
||||||
|
|
||||||
|
glViewport (0, 0, ScreenWidthOpenGL, ScreenHeightOpenGL);
|
||||||
|
glClearColor (0,0,0,0);
|
||||||
|
glClear (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||||
|
SDL_GL_SwapBuffers ();
|
||||||
|
glClear (GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||||
|
glDisable (GL_DITHER);
|
||||||
|
glDepthMask(GL_FALSE);
|
||||||
|
|
||||||
|
glGenTextures(1,&DisplayTexture);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, DisplayTexture);
|
||||||
|
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
|
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||||
|
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||||
|
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA, 512, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TFB_GL_SwapBuffers ()
|
||||||
|
{
|
||||||
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
glLoadIdentity();
|
||||||
|
glOrtho (0,ScreenWidthOpenGL,ScreenHeightOpenGL, 0, -1, 1);
|
||||||
|
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
glLoadIdentity();
|
||||||
|
|
||||||
|
glBindTexture(GL_TEXTURE_2D, DisplayTexture);
|
||||||
|
|
||||||
|
SDL_LockSurface(SDL_Screen);
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, ScreenWidth,ScreenHeight, GL_RGBA, GL_UNSIGNED_BYTE, SDL_Screen->pixels);
|
||||||
|
SDL_UnlockSurface(SDL_Screen);
|
||||||
|
|
||||||
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, ScreenFilterMode);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, ScreenFilterMode);
|
||||||
|
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
glColor4f(1,1,1,1);
|
||||||
|
|
||||||
|
glBegin(GL_TRIANGLE_FAN);
|
||||||
|
|
||||||
|
glTexCoord2f(0, 0);
|
||||||
|
glVertex2i(0, 0);
|
||||||
|
|
||||||
|
glTexCoord2f(ScreenWidth / 512.0f, 0);
|
||||||
|
glVertex2i(ScreenWidthOpenGL, 0);
|
||||||
|
|
||||||
|
glTexCoord2f(ScreenWidth / 512.0f, ScreenHeight / 256.0f);
|
||||||
|
glVertex2i(ScreenWidthOpenGL, ScreenHeightOpenGL);
|
||||||
|
|
||||||
|
glTexCoord2f(0, ScreenHeight / 256.0f);
|
||||||
|
glVertex2i(0, ScreenHeightOpenGL);
|
||||||
|
|
||||||
|
glEnd();
|
||||||
|
|
||||||
|
SDL_GL_SwapBuffers();
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Surface*
|
||||||
|
TFB_GL_DisplayFormatAlpha (SDL_Surface *surface)
|
||||||
|
{
|
||||||
|
return SDL_ConvertSurface (surface, format_conv_surf->format, surface->flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENGL_H
|
||||||
|
#define OPENGL_H
|
||||||
|
|
||||||
|
#include "libs/graphics/sdl/sdl_common.h"
|
||||||
|
|
||||||
|
int TFB_GL_InitGraphics (int driver, int flags, int width, int height, int bpp);
|
||||||
|
void TFB_GL_SwapBuffers ();
|
||||||
|
SDL_Surface* TFB_GL_DisplayFormatAlpha (SDL_Surface *surface);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENGL
|
||||||
|
#ifdef WIN32
|
||||||
|
|
||||||
|
#pragma comment (lib, "opengl32.lib")
|
||||||
|
#pragma comment (lib, "glu32.lib")
|
||||||
|
|
||||||
|
/* To avoid including windows.h,
|
||||||
|
Win32's <GL/gl.h> needs APIENTRY and WINGDIAPI defined properly. */
|
||||||
|
|
||||||
|
#ifndef APIENTRY
|
||||||
|
#define GLUT_APIENTRY_DEFINED
|
||||||
|
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)
|
||||||
|
#define APIENTRY __stdcall
|
||||||
|
#else
|
||||||
|
#define APIENTRY
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This is from Win32's <winnt.h> */
|
||||||
|
#ifndef CALLBACK
|
||||||
|
#if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS)
|
||||||
|
#define CALLBACK __stdcall
|
||||||
|
#else
|
||||||
|
#define CALLBACK
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This is from Win32's <wingdi.h> and <winnt.h> */
|
||||||
|
#ifndef WINGDIAPI
|
||||||
|
#define GLUT_WINGDIAPI_DEFINED
|
||||||
|
#define WINGDIAPI __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* This is from Win32's <ctype.h> */
|
||||||
|
#ifndef _WCHAR_T_DEFINED
|
||||||
|
typedef unsigned short wchar_t;
|
||||||
|
#define _WCHAR_T_DEFINED
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "GL/glu.h"
|
||||||
|
|
||||||
|
#else /* !defined(WIN32) */
|
||||||
|
|
||||||
|
#include "GL/glu.h"
|
||||||
|
|
||||||
|
#endif /* WIN32 */
|
||||||
|
#endif /* HAVE_OPENGL */
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef GFXMODULE_SDL
|
||||||
|
|
||||||
|
#include "sdl_common.h"
|
||||||
|
#include "primitives.h"
|
||||||
|
|
||||||
|
|
||||||
|
// Pixel drawing routines
|
||||||
|
|
||||||
|
Uint32 getpixel_8(SDL_Surface *surface, int x, int y)
|
||||||
|
{
|
||||||
|
/* Here p is the address to the pixel we want to retrieve */
|
||||||
|
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x;
|
||||||
|
return *p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void putpixel_8(SDL_Surface *surface, int x, int y, Uint32 pixel)
|
||||||
|
{
|
||||||
|
/* Here p is the address to the pixel we want to set */
|
||||||
|
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 1;
|
||||||
|
*p = pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint32 getpixel_16(SDL_Surface *surface, int x, int y)
|
||||||
|
{
|
||||||
|
/* Here p is the address to the pixel we want to retrieve */
|
||||||
|
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 2;
|
||||||
|
return *(Uint16 *)p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void putpixel_16(SDL_Surface *surface, int x, int y, Uint32 pixel)
|
||||||
|
{
|
||||||
|
/* Here p is the address to the pixel we want to set */
|
||||||
|
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 2;
|
||||||
|
*(Uint16 *)p = pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint32 getpixel_24_be(SDL_Surface *surface, int x, int y)
|
||||||
|
{
|
||||||
|
/* Here p is the address to the pixel we want to retrieve */
|
||||||
|
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3;
|
||||||
|
return p[0] << 16 | p[1] << 8 | p[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
void putpixel_24_be(SDL_Surface *surface, int x, int y, Uint32 pixel)
|
||||||
|
{
|
||||||
|
/* Here p is the address to the pixel we want to set */
|
||||||
|
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3;
|
||||||
|
p[0] = (pixel >> 16) & 0xff;
|
||||||
|
p[1] = (pixel >> 8) & 0xff;
|
||||||
|
p[2] = pixel & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint32 getpixel_24_le(SDL_Surface *surface, int x, int y)
|
||||||
|
{
|
||||||
|
/* Here p is the address to the pixel we want to retrieve */
|
||||||
|
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3;
|
||||||
|
return p[0] | p[1] << 8 | p[2] << 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
void putpixel_24_le(SDL_Surface *surface, int x, int y, Uint32 pixel)
|
||||||
|
{
|
||||||
|
/* Here p is the address to the pixel we want to set */
|
||||||
|
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 3;
|
||||||
|
p[0] = pixel & 0xff;
|
||||||
|
p[1] = (pixel >> 8) & 0xff;
|
||||||
|
p[2] = (pixel >> 16) & 0xff;
|
||||||
|
}
|
||||||
|
|
||||||
|
Uint32 getpixel_32(SDL_Surface *surface, int x, int y)
|
||||||
|
{
|
||||||
|
/* Here p is the address to the pixel we want to retrieve */
|
||||||
|
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 4;
|
||||||
|
return *(Uint32 *)p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void putpixel_32(SDL_Surface *surface, int x, int y, Uint32 pixel)
|
||||||
|
{
|
||||||
|
/* Here p is the address to the pixel we want to set */
|
||||||
|
Uint8 *p = (Uint8 *)surface->pixels + y * surface->pitch + x * 4;
|
||||||
|
*(Uint32 *)p = pixel;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetPixelFn getpixel_for(SDL_Surface *surface)
|
||||||
|
{
|
||||||
|
int bpp = surface->format->BytesPerPixel;
|
||||||
|
switch (bpp) {
|
||||||
|
case 1:
|
||||||
|
return &getpixel_8;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return &getpixel_16;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
|
||||||
|
return &getpixel_24_be;
|
||||||
|
} else {
|
||||||
|
return &getpixel_24_le;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
return &getpixel_32;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
PutPixelFn putpixel_for(SDL_Surface *surface)
|
||||||
|
{
|
||||||
|
int bpp = surface->format->BytesPerPixel;
|
||||||
|
switch (bpp) {
|
||||||
|
case 1:
|
||||||
|
return &putpixel_8;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
return &putpixel_16;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (SDL_BYTEORDER == SDL_BIG_ENDIAN) {
|
||||||
|
return &putpixel_24_be;
|
||||||
|
} else {
|
||||||
|
return &putpixel_24_le;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
return &putpixel_32;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Line drawing routine
|
||||||
|
* Adapted from Paul Heckbert's implementation of Bresenham's algorithm,
|
||||||
|
* 3 Sep 85; taken from Graphics Gems I */
|
||||||
|
|
||||||
|
void line(int x1, int y1, int x2, int y2, Uint32 color, PutPixelFn plot, SDL_Surface *surface)
|
||||||
|
{
|
||||||
|
int d, x, y, ax, ay, sx, sy, dx, dy;
|
||||||
|
|
||||||
|
dx = x2-x1;
|
||||||
|
ax = ((dx < 0) ? -dx : dx) << 1;
|
||||||
|
sx = (dx < 0) ? -1 : 1;
|
||||||
|
dy = y2-y1;
|
||||||
|
ay = ((dy < 0) ? -dy : dy) << 1;
|
||||||
|
sy = (dy < 0) ? -1 : 1;
|
||||||
|
|
||||||
|
x = x1;
|
||||||
|
y = y1;
|
||||||
|
if (ax > ay) {
|
||||||
|
d = ay - (ax >> 1);
|
||||||
|
for (;;) {
|
||||||
|
(*plot)(surface, x, y, color);
|
||||||
|
if (x == x2)
|
||||||
|
return;
|
||||||
|
if (d >= 0) {
|
||||||
|
y += sy;
|
||||||
|
d -= ax;
|
||||||
|
}
|
||||||
|
x += sx;
|
||||||
|
d += ay;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
d = ax - (ay >> 1);
|
||||||
|
for (;;) {
|
||||||
|
(*plot)(surface, x, y, color);
|
||||||
|
if (y == y2)
|
||||||
|
return;
|
||||||
|
if (d >= 0) {
|
||||||
|
x += sx;
|
||||||
|
d -= ay;
|
||||||
|
}
|
||||||
|
y += sy;
|
||||||
|
d += ax;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PRIMITIVES_H
|
||||||
|
#define PRIMITIVES_H
|
||||||
|
|
||||||
|
/* Function types for the pixel functions */
|
||||||
|
|
||||||
|
typedef Uint32 (*GetPixelFn)(SDL_Surface *, int, int);
|
||||||
|
typedef void (*PutPixelFn)(SDL_Surface *, int, int, Uint32);
|
||||||
|
|
||||||
|
GetPixelFn getpixel_for(SDL_Surface *surface);
|
||||||
|
PutPixelFn putpixel_for(SDL_Surface *surface);
|
||||||
|
|
||||||
|
void line(int x1, int y1, int x2, int y2, Uint32 color, PutPixelFn plot,
|
||||||
|
SDL_Surface *surface);
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef GFXMODULE_SDL
|
||||||
|
|
||||||
|
#include "libs/graphics/sdl/pure.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp)
|
||||||
|
{
|
||||||
|
char VideoName[256];
|
||||||
|
int videomode_flags;
|
||||||
|
SDL_Surface *test_extra;
|
||||||
|
|
||||||
|
GraphicsDriver = driver;
|
||||||
|
|
||||||
|
printf("Initializing SDL (pure).\n");
|
||||||
|
|
||||||
|
if ((SDL_Init (SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) == -1))
|
||||||
|
{
|
||||||
|
printf("Could not initialize SDL: %s.\n", SDL_GetError());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_VideoDriverName (VideoName, sizeof (VideoName));
|
||||||
|
printf("SDL driver used: %s\n", VideoName);
|
||||||
|
// Set the environment variable SDL_VIDEODRIVER to override
|
||||||
|
// For Linux: x11 (default), dga, fbcon, directfb, svgalib,
|
||||||
|
// ggi, aalib
|
||||||
|
// For Windows: directx (default), windib
|
||||||
|
atexit (SDL_Quit);
|
||||||
|
|
||||||
|
printf ("SDL initialized.\n");
|
||||||
|
|
||||||
|
printf ("Initializing Screen.\n");
|
||||||
|
|
||||||
|
ScreenWidth = 320;
|
||||||
|
ScreenHeight = 240;
|
||||||
|
ScreenWidthActual = width;
|
||||||
|
ScreenHeightActual = height;
|
||||||
|
|
||||||
|
videomode_flags = SDL_HWSURFACE | SDL_ANYFORMAT;
|
||||||
|
if (flags & TFB_GFXFLAGS_FULLSCREEN)
|
||||||
|
videomode_flags |= SDL_FULLSCREEN;
|
||||||
|
|
||||||
|
SDL_Video = SDL_SetVideoMode (ScreenWidthActual, ScreenHeightActual,
|
||||||
|
bpp, videomode_flags);
|
||||||
|
|
||||||
|
if (SDL_Video == NULL)
|
||||||
|
{
|
||||||
|
printf ("Couldn't set %ix%ix%i video mode: %s\n",
|
||||||
|
ScreenWidthActual, ScreenHeightActual, bpp,
|
||||||
|
SDL_GetError ());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf ("Set the resolution to: %ix%ix%i\n",
|
||||||
|
SDL_GetVideoSurface()->w, SDL_GetVideoSurface()->h,
|
||||||
|
SDL_GetVideoSurface()->format->BitsPerPixel);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
test_extra = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidthActual, ScreenHeightActual, 32,
|
||||||
|
0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000);
|
||||||
|
|
||||||
|
if (test_extra == NULL)
|
||||||
|
{
|
||||||
|
printf("Couldn't create back buffer: %s\n",
|
||||||
|
SDL_GetError());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_Screen = SDL_DisplayFormat(test_extra);
|
||||||
|
SDL_FreeSurface(test_extra);
|
||||||
|
|
||||||
|
test_extra = SDL_CreateRGBSurface(SDL_SWSURFACE, ScreenWidthActual, ScreenHeightActual, 32,
|
||||||
|
0x000000ff, 0x0000ff00, 0x00ff0000, 0x00000000);
|
||||||
|
|
||||||
|
if (test_extra == NULL)
|
||||||
|
{
|
||||||
|
printf("Couldn't create workspace buffer: %s\n",
|
||||||
|
SDL_GetError());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ExtraScreen = SDL_DisplayFormat(test_extra);
|
||||||
|
SDL_FreeSurface(test_extra);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TFB_Pure_SwapBuffers ()
|
||||||
|
{
|
||||||
|
SDL_BlitSurface(SDL_Screen, NULL, SDL_Video, NULL);
|
||||||
|
SDL_UpdateRect(SDL_Video, 0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
//Copyright Paul Reiche, Fred Ford. 1992-2002
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PURE_H
|
||||||
|
#define PURE_H
|
||||||
|
|
||||||
|
#include "libs/graphics/sdl/sdl_common.h"
|
||||||
|
|
||||||
|
int TFB_Pure_InitGraphics (int driver, int flags, int width, int height, int bpp);
|
||||||
|
void TFB_Pure_SwapBuffers ();
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user