Final merge of Google Summer of Code 2008 work...
Port SDL 1.3 to the Nintendo DS by Darren Alton, mentored by Sam Lantinga --HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403188
This commit is contained in:
parent
e6faee6b2a
commit
ede44c4b85
123 changed files with 6082 additions and 388 deletions
|
@ -383,33 +383,25 @@ DirectFB_PumpEvents(_THIS)
|
|||
switch (evt.type) {
|
||||
case DIET_BUTTONPRESS:
|
||||
posted += SDL_PrivateMouseButton(SDL_PRESSED,
|
||||
DirectFB_TranslateButton(evt.
|
||||
button),
|
||||
0, 0);
|
||||
DirectFB_TranslateButton
|
||||
(evt.button), 0, 0);
|
||||
break;
|
||||
case DIET_BUTTONRELEASE:
|
||||
posted += SDL_PrivateMouseButton(SDL_RELEASED,
|
||||
DirectFB_TranslateButton(evt.
|
||||
button),
|
||||
0, 0);
|
||||
DirectFB_TranslateButton
|
||||
(evt.button), 0, 0);
|
||||
break;
|
||||
case DIET_KEYPRESS:
|
||||
posted += SDL_PrivateKeyboard(SDL_PRESSED,
|
||||
DirectFB_TranslateKey(evt.
|
||||
key_id,
|
||||
evt.
|
||||
key_symbol,
|
||||
mod,
|
||||
&keysym));
|
||||
DirectFB_TranslateKey
|
||||
(evt.key_id, evt.key_symbol,
|
||||
mod, &keysym));
|
||||
break;
|
||||
case DIET_KEYRELEASE:
|
||||
posted += SDL_PrivateKeyboard(SDL_RELEASED,
|
||||
DirectFB_TranslateKey(evt.
|
||||
key_id,
|
||||
evt.
|
||||
key_symbol,
|
||||
mod,
|
||||
&keysym));
|
||||
DirectFB_TranslateKey
|
||||
(evt.key_id, evt.key_symbol,
|
||||
mod, &keysym));
|
||||
break;
|
||||
case DIET_AXISMOTION:
|
||||
if (evt.flags & DIEF_AXISREL) {
|
||||
|
|
|
@ -85,14 +85,15 @@ DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
|
|||
dsc.height = surface->h;
|
||||
dsc.pixelformat = DSPF_ARGB;
|
||||
|
||||
SDL_DFB_CHECKERR(devdata->dfb->
|
||||
CreateSurface(devdata->dfb, &dsc, &curdata->surf));
|
||||
SDL_DFB_CHECKERR(devdata->
|
||||
dfb->CreateSurface(devdata->dfb, &dsc, &curdata->surf));
|
||||
curdata->hotx = hot_x;
|
||||
curdata->hoty = hot_y;
|
||||
cursor->driverdata = curdata;
|
||||
|
||||
SDL_DFB_CHECKERR(curdata->surf->
|
||||
Lock(curdata->surf, DSLF_WRITE, (void *) &dest, &pitch));
|
||||
SDL_DFB_CHECKERR(curdata->
|
||||
surf->Lock(curdata->surf, DSLF_WRITE, (void *) &dest,
|
||||
&pitch));
|
||||
|
||||
//FIXME: Implies a lot of things, e.g. rgba format for SDL_SURFACE ....
|
||||
p = surface->pixels;
|
||||
|
@ -131,18 +132,18 @@ DirectFB_ShowCursor(SDL_Cursor * cursor)
|
|||
DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
|
||||
|
||||
if (cursor)
|
||||
SDL_DFB_CHECKERR(windata->window->
|
||||
SetCursorShape(windata->window, curdata->surf,
|
||||
curdata->hotx, curdata->hoty));
|
||||
SDL_DFB_CHECKERR(windata->window->SetCursorShape(windata->window,
|
||||
curdata->surf,
|
||||
curdata->hotx,
|
||||
curdata->hoty));
|
||||
//TODO: Check administrative
|
||||
SDL_DFB_CHECKERR(dispdata->layer->
|
||||
SetCooperativeLevel(dispdata->layer,
|
||||
DLSCL_ADMINISTRATIVE));
|
||||
SDL_DFB_CHECKERR(dispdata->layer->
|
||||
SetCursorOpacity(dispdata->layer,
|
||||
cursor ? 0xC0 : 0x00));
|
||||
SDL_DFB_CHECKERR(dispdata->layer->
|
||||
SetCooperativeLevel(dispdata->layer, DLSCL_SHARED));
|
||||
SDL_DFB_CHECKERR(dispdata->layer->SetCooperativeLevel(dispdata->layer,
|
||||
DLSCL_ADMINISTRATIVE));
|
||||
SDL_DFB_CHECKERR(dispdata->layer->SetCursorOpacity(dispdata->layer,
|
||||
cursor ? 0xC0 :
|
||||
0x00));
|
||||
SDL_DFB_CHECKERR(dispdata->layer->SetCooperativeLevel(dispdata->layer,
|
||||
DLSCL_SHARED));
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -181,8 +182,8 @@ DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y)
|
|||
int cx, cy;
|
||||
|
||||
SDL_DFB_CHECKERR(windata->window->GetPosition(windata->window, &cx, &cy));
|
||||
SDL_DFB_CHECKERR(dispdata->layer->
|
||||
WarpCursor(dispdata->layer, cx + x, cy + y));
|
||||
SDL_DFB_CHECKERR(dispdata->
|
||||
layer->WarpCursor(dispdata->layer, cx + x, cy + y));
|
||||
|
||||
error:
|
||||
return;
|
||||
|
|
|
@ -314,8 +314,8 @@ DirectFB_VideoInit(_THIS)
|
|||
SDL_DFB_CHECKERR(dfb->GetScreen(dfb, devdata->screenid[i], &screen));
|
||||
|
||||
devdata->aux = i;
|
||||
SDL_DFB_CHECKERR(screen->
|
||||
EnumDisplayLayers(screen, &cbLayers, devdata));
|
||||
SDL_DFB_CHECKERR(screen->EnumDisplayLayers
|
||||
(screen, &cbLayers, devdata));
|
||||
#if (DIRECTFB_MAJOR_VERSION >= 1)
|
||||
screen->GetSize(screen, &tcw[i], &tch[i]);
|
||||
#else
|
||||
|
@ -338,12 +338,12 @@ DirectFB_VideoInit(_THIS)
|
|||
|
||||
for (i = 0; i < devdata->numscreens; i++) {
|
||||
//SDL_DFB_CHECKERR( dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer) );
|
||||
SDL_DFB_CHECKERR(dfb->
|
||||
GetDisplayLayer(dfb, devdata->gralayer[i], &layer));
|
||||
SDL_DFB_CHECKERR(dfb->GetDisplayLayer
|
||||
(dfb, devdata->gralayer[i], &layer));
|
||||
//SDL_DFB_CHECKERR( dfb->CreateInputEventBuffer (dfb, DICAPS_ALL, DFB_FALSE, &events) );
|
||||
|
||||
SDL_DFB_CHECKERR(layer->
|
||||
SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE));
|
||||
SDL_DFB_CHECKERR(layer->SetCooperativeLevel
|
||||
(layer, DLSCL_ADMINISTRATIVE));
|
||||
layer->EnableCursor(layer, 1);
|
||||
SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0));
|
||||
SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED));
|
||||
|
@ -379,8 +379,8 @@ DirectFB_VideoInit(_THIS)
|
|||
/* Enumerate the available fullscreen modes */
|
||||
SDL_DFB_CALLOC(dispdata->modelist, DFB_MAX_MODES,
|
||||
sizeof(SDL_DisplayMode));
|
||||
SDL_DFB_CHECKERR(dfb->
|
||||
EnumVideoModes(dfb, EnumModesCallback, &display));
|
||||
SDL_DFB_CHECKERR(dfb->EnumVideoModes
|
||||
(dfb, EnumModesCallback, &display));
|
||||
|
||||
SDL_AddVideoDisplay(&display);
|
||||
}
|
||||
|
@ -433,13 +433,14 @@ DirectFB_VideoQuit(_THIS)
|
|||
DFB_DisplayData *dispdata =
|
||||
(DFB_DisplayData *) _this->displays[i].driverdata;
|
||||
if (dispdata->layer) {
|
||||
SDL_DFB_CHECK(dispdata->layer->
|
||||
SetCooperativeLevel(dispdata->layer,
|
||||
DLSCL_ADMINISTRATIVE));
|
||||
SDL_DFB_CHECK(dispdata->layer->
|
||||
SetCursorOpacity(dispdata->layer, 0x00));
|
||||
SDL_DFB_CHECK(dispdata->layer->
|
||||
SetCooperativeLevel(dispdata->layer, DLSCL_SHARED));
|
||||
SDL_DFB_CHECK(dispdata->
|
||||
layer->SetCooperativeLevel(dispdata->layer,
|
||||
DLSCL_ADMINISTRATIVE));
|
||||
SDL_DFB_CHECK(dispdata->
|
||||
layer->SetCursorOpacity(dispdata->layer, 0x00));
|
||||
SDL_DFB_CHECK(dispdata->
|
||||
layer->SetCooperativeLevel(dispdata->layer,
|
||||
DLSCL_SHARED));
|
||||
}
|
||||
SDL_DFB_RELEASE(dispdata->layer);
|
||||
|
||||
|
@ -578,8 +579,8 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
|
|||
DFBResult ret;
|
||||
DFB_WindowData *win;
|
||||
|
||||
SDL_DFB_CHECKERR(data->layer->
|
||||
SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE));
|
||||
SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
|
||||
DLSCL_ADMINISTRATIVE));
|
||||
|
||||
SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config));
|
||||
config.flags = DLCONF_WIDTH | DLCONF_HEIGHT; // | DLCONF_BUFFERMODE;
|
||||
|
@ -604,8 +605,8 @@ DirectFB_SetDisplayMode(_THIS, SDL_DisplayMode * mode)
|
|||
SDL_DFB_DEBUG("Trace\n");
|
||||
config.flags &= ~fail;
|
||||
SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
|
||||
SDL_DFB_CHECKERR(data->layer->
|
||||
SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE));
|
||||
SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
|
||||
DLSCL_ADMINISTRATIVE));
|
||||
|
||||
/* Double check */
|
||||
SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig));
|
||||
|
@ -674,11 +675,11 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
|
|||
SDL_DFB_CALLOC(window->driverdata, 1, sizeof(DFB_WindowData));
|
||||
windata = (DFB_WindowData *) window->driverdata;
|
||||
|
||||
SDL_DFB_CHECKERR(devdata->dfb->
|
||||
SetCooperativeLevel(devdata->dfb, DFSCL_NORMAL));
|
||||
SDL_DFB_CHECKERR(dispdata->layer->
|
||||
SetCooperativeLevel(dispdata->layer,
|
||||
DLSCL_ADMINISTRATIVE));
|
||||
SDL_DFB_CHECKERR(devdata->
|
||||
dfb->SetCooperativeLevel(devdata->dfb, DFSCL_NORMAL));
|
||||
SDL_DFB_CHECKERR(dispdata->
|
||||
layer->SetCooperativeLevel(dispdata->layer,
|
||||
DLSCL_ADMINISTRATIVE));
|
||||
|
||||
/* Fill the window description. */
|
||||
if (window->x == SDL_WINDOWPOS_CENTERED) {
|
||||
|
@ -725,8 +726,8 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
|
|||
desc.surface_caps = DSCAPS_DOUBLE | DSCAPS_TRIPLE / DSCAPS_PREMULTIPLIED;
|
||||
|
||||
/* Create the window. */
|
||||
SDL_DFB_CHECKERR(dispdata->layer->
|
||||
CreateWindow(dispdata->layer, &desc, &windata->window));
|
||||
SDL_DFB_CHECKERR(dispdata->layer->CreateWindow(dispdata->layer, &desc,
|
||||
&windata->window));
|
||||
|
||||
windata->window->GetOptions(windata->window, &wopts);
|
||||
#if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 0)
|
||||
|
@ -744,12 +745,13 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
|
|||
|
||||
windata->window->SetOptions(windata->window, wopts);
|
||||
/* Get the window's surface. */
|
||||
SDL_DFB_CHECKERR(windata->window->
|
||||
GetSurface(windata->window, &windata->surface));
|
||||
SDL_DFB_CHECKERR(windata->
|
||||
window->GetSurface(windata->window, &windata->surface));
|
||||
windata->window->SetOpacity(windata->window, 0xFF);
|
||||
SDL_DFB_CHECKERR(windata->window->
|
||||
CreateEventBuffer(windata->window,
|
||||
&(windata->eventbuffer)));
|
||||
SDL_DFB_CHECKERR(windata->window->CreateEventBuffer(windata->window,
|
||||
&
|
||||
(windata->
|
||||
eventbuffer)));
|
||||
SDL_DFB_CHECKERR(windata->window->
|
||||
EnableEvents(windata->window,
|
||||
DWET_POSITION | DWET_SIZE | DWET_CLOSE |
|
||||
|
@ -812,6 +814,7 @@ DirectFB_SetWindowTitle(_THIS, SDL_Window * window)
|
|||
//return -1;
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
DirectFB_SetWindowPosition(_THIS, SDL_Window * window)
|
||||
{
|
||||
|
@ -886,6 +889,7 @@ DirectFB_HideWindow(_THIS, SDL_Window * window)
|
|||
windata->window->SetOpacity(windata->window, 0);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
DirectFB_RaiseWindow(_THIS, SDL_Window * window)
|
||||
{
|
||||
|
@ -907,6 +911,7 @@ DirectFB_MaximizeWindow(_THIS, SDL_Window * window)
|
|||
SDL_Unsupported();
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
DirectFB_MinimizeWindow(_THIS, SDL_Window * window)
|
||||
{
|
||||
|
@ -928,6 +933,7 @@ DirectFB_RestoreWindow(_THIS, SDL_Window * window)
|
|||
SDL_Unsupported();
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
DirectFB_SetWindowGrab(_THIS, SDL_Window * window)
|
||||
{
|
||||
|
@ -1156,8 +1162,8 @@ DirectFB_GL_SwapWindow(_THIS, SDL_Window * window)
|
|||
devdata->glFlush();
|
||||
|
||||
SDL_DFB_CHECKERR(windata->gl_context->Unlock(windata->gl_context));
|
||||
SDL_DFB_CHECKERR(windata->surface->
|
||||
Flip(windata->surface, ®ion, DSFLIP_ONSYNC));
|
||||
SDL_DFB_CHECKERR(windata->
|
||||
surface->Flip(windata->surface, ®ion, DSFLIP_ONSYNC));
|
||||
SDL_DFB_CHECKERR(windata->gl_context->Lock(windata->gl_context));
|
||||
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue