mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-11 05:29:55 +00:00
WIP Fullscreen support
This commit is contained in:
parent
3c70963d86
commit
7fcb3763b7
@ -144,6 +144,8 @@ int g_nCharsetType = 0;
|
|||||||
LPDIRECTDRAW g_pDD = (LPDIRECTDRAW)0;
|
LPDIRECTDRAW g_pDD = (LPDIRECTDRAW)0;
|
||||||
LPDIRECTDRAWSURFACE g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
|
LPDIRECTDRAWSURFACE g_pDDPrimarySurface = (LPDIRECTDRAWSURFACE)0;
|
||||||
HDC g_hDDdc = 0;
|
HDC g_hDDdc = 0;
|
||||||
|
int g_nDDFullScreenW = 640;
|
||||||
|
int g_nDDFullScreenH = 480;
|
||||||
|
|
||||||
static bool g_bShowingCursor = true;
|
static bool g_bShowingCursor = true;
|
||||||
static bool g_bLastCursorInAppleViewport = false;
|
static bool g_bLastCursorInAppleViewport = false;
|
||||||
@ -565,7 +567,6 @@ static void DrawFrameWindow ()
|
|||||||
//VideoRefreshScreen(0);
|
//VideoRefreshScreen(0);
|
||||||
VideoRedrawScreen();
|
VideoRedrawScreen();
|
||||||
|
|
||||||
// DD Full-Screen Palette: BUGFIX: needs to come _after_ all drawing...
|
|
||||||
if (g_bPaintingWindow)
|
if (g_bPaintingWindow)
|
||||||
EndPaint(g_hFrameWindow,&ps);
|
EndPaint(g_hFrameWindow,&ps);
|
||||||
else
|
else
|
||||||
@ -893,9 +894,6 @@ static void EraseButton (int number) {
|
|||||||
rect.top = buttony+number*BUTTONCY;
|
rect.top = buttony+number*BUTTONCY;
|
||||||
rect.bottom = rect.top+BUTTONCY;
|
rect.bottom = rect.top+BUTTONCY;
|
||||||
|
|
||||||
// TODO: DD Full-Screen Palette
|
|
||||||
// if( !g_bIsFullScreen )
|
|
||||||
|
|
||||||
InvalidateRect(g_hFrameWindow,&rect,1);
|
InvalidateRect(g_hFrameWindow,&rect,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1476,26 +1474,10 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
// message must not realize its palette, unless it determines that
|
// message must not realize its palette, unless it determines that
|
||||||
// wParam does not contain its own window handle.
|
// wParam does not contain its own window handle.
|
||||||
if ((HWND)wparam == window)
|
if ((HWND)wparam == window)
|
||||||
{
|
break;
|
||||||
#if DEBUG_DD_PALETTE
|
|
||||||
if( g_bIsFullScreen )
|
|
||||||
OutputDebugString( "WM_PALETTECHANGED: Full Screen\n" );
|
|
||||||
else
|
|
||||||
OutputDebugString( "WM_PALETTECHANGED: Windowed\n" );
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// else fall through
|
// else fall through
|
||||||
|
|
||||||
case WM_QUERYNEWPALETTE:
|
case WM_QUERYNEWPALETTE:
|
||||||
#if DEBUG_DD_PALETTE
|
|
||||||
if( g_bIsFullScreen )
|
|
||||||
OutputDebugString( "WM_QUERYNEWPALETTE: Full Screen\n" );
|
|
||||||
else
|
|
||||||
OutputDebugString( "WM_QUERYNEWPALETTE: Windowed\n" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// TODO: DD Full-Screen Palette
|
|
||||||
DrawFrameWindow();
|
DrawFrameWindow();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1564,7 +1546,6 @@ LRESULT CALLBACK FrameWndProc (
|
|||||||
OutputDebugString( "WM_SYSCOLORCHANGE: Windowed\n" );
|
OutputDebugString( "WM_SYSCOLORCHANGE: Windowed\n" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO: DD Full-Screen Palette
|
|
||||||
DeleteGdiObjects();
|
DeleteGdiObjects();
|
||||||
CreateGdiObjects();
|
CreateGdiObjects();
|
||||||
break;
|
break;
|
||||||
@ -2069,7 +2050,7 @@ void SetFullScreenMode ()
|
|||||||
|
|
||||||
if (DirectDrawCreate(NULL,&g_pDD,NULL) != DD_OK ||
|
if (DirectDrawCreate(NULL,&g_pDD,NULL) != DD_OK ||
|
||||||
g_pDD->SetCooperativeLevel(g_hFrameWindow,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) != DD_OK ||
|
g_pDD->SetCooperativeLevel(g_hFrameWindow,DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN) != DD_OK ||
|
||||||
g_pDD->SetDisplayMode(640,480,32) != DD_OK ||
|
g_pDD->SetDisplayMode(g_nDDFullScreenW,g_nDDFullScreenH,32) != DD_OK ||
|
||||||
g_pDD->CreateSurface(&ddsd,&g_pDDPrimarySurface,NULL) != DD_OK)
|
g_pDD->CreateSurface(&ddsd,&g_pDDPrimarySurface,NULL) != DD_OK)
|
||||||
{
|
{
|
||||||
g_pDDPrimarySurface = NULL;
|
g_pDDPrimarySurface = NULL;
|
||||||
@ -2352,10 +2333,15 @@ HDC FrameGetVideoDC (LPBYTE *pAddr_, LONG *pPitch_)
|
|||||||
// ASSERT( pPitch_ );
|
// ASSERT( pPitch_ );
|
||||||
if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow)
|
if (g_bIsFullScreen && g_bAppActive && !g_bPaintingWindow)
|
||||||
{
|
{
|
||||||
RECT rect = { FSVIEWPORTX,
|
// Reference: http://archive.gamedev.net/archive/reference/articles/article608.html
|
||||||
FSVIEWPORTY,
|
// NTSC TODO: Are these coordinates correct?? Coordinates don't seem to matter on Win7 fullscreen!?
|
||||||
FSVIEWPORTX+g_nViewportCX,
|
// g_nViewportCX = FRAMEBUFFER_W * kDEFAULT_VIEWPORT_SCALE;
|
||||||
FSVIEWPORTY+g_nViewportCY};
|
RECT rect = {
|
||||||
|
FSVIEWPORTX,
|
||||||
|
FSVIEWPORTY,
|
||||||
|
FSVIEWPORTX+g_nViewportCX,
|
||||||
|
FSVIEWPORTY+g_nViewportCY
|
||||||
|
};
|
||||||
DDSURFACEDESC surfacedesc;
|
DDSURFACEDESC surfacedesc;
|
||||||
surfacedesc.dwSize = sizeof(surfacedesc);
|
surfacedesc.dwSize = sizeof(surfacedesc);
|
||||||
// TC: Use DDLOCK_WAIT - see Bug #13425
|
// TC: Use DDLOCK_WAIT - see Bug #13425
|
||||||
|
@ -25,7 +25,8 @@
|
|||||||
// Direct Draw -- For Full Screen
|
// Direct Draw -- For Full Screen
|
||||||
extern LPDIRECTDRAW g_pDD;
|
extern LPDIRECTDRAW g_pDD;
|
||||||
extern LPDIRECTDRAWSURFACE g_pDDPrimarySurface;
|
extern LPDIRECTDRAWSURFACE g_pDDPrimarySurface;
|
||||||
extern IDirectDrawPalette* g_pDDPal;
|
extern int g_nDDFullScreenW;
|
||||||
|
extern int g_nDDFullScreenH;
|
||||||
|
|
||||||
// Win32
|
// Win32
|
||||||
extern HWND g_hFrameWindow;
|
extern HWND g_hFrameWindow;
|
||||||
|
@ -885,8 +885,8 @@ BYTE VideoCheckVbl ( ULONG uExecutedCycles )
|
|||||||
{
|
{
|
||||||
bool bVblBar = VideoGetVbl(uExecutedCycles);
|
bool bVblBar = VideoGetVbl(uExecutedCycles);
|
||||||
// NTSC: It is tempting to replace with
|
// NTSC: It is tempting to replace with
|
||||||
// bool bVblBar = NTSC_VideoIsVbl();
|
// bool bVblBar = NTSC_VideoIsVbl();
|
||||||
// But this breaks "ANSI STORY"
|
// But this breaks "ANSI STORY" intro center fade
|
||||||
|
|
||||||
BYTE r = KeybGetKeycode();
|
BYTE r = KeybGetKeycode();
|
||||||
return (r & ~0x80) | (bVblBar ? 0x80 : 0);
|
return (r & ~0x80) | (bVblBar ? 0x80 : 0);
|
||||||
@ -1006,10 +1006,11 @@ void VideoDisplayLogo ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DRAW THE VERSION NUMBER
|
// DRAW THE VERSION NUMBER
|
||||||
|
TCHAR sFontName[] = TEXT("Arial");
|
||||||
HFONT font = CreateFont(-20,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,
|
HFONT font = CreateFont(-20,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,
|
||||||
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
|
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
|
||||||
VARIABLE_PITCH | 4 | FF_SWISS,
|
VARIABLE_PITCH | 4 | FF_SWISS,
|
||||||
TEXT("Arial"));
|
sFontName );
|
||||||
SelectObject(hFrameDC,font);
|
SelectObject(hFrameDC,font);
|
||||||
SetTextAlign(hFrameDC,TA_RIGHT | TA_TOP);
|
SetTextAlign(hFrameDC,TA_RIGHT | TA_TOP);
|
||||||
SetBkMode(hFrameDC,TRANSPARENT);
|
SetBkMode(hFrameDC,TRANSPARENT);
|
||||||
@ -1043,19 +1044,35 @@ void VideoDisplayLogo ()
|
|||||||
|
|
||||||
// NTSC Alpha Version
|
// NTSC Alpha Version
|
||||||
DeleteObject(font);
|
DeleteObject(font);
|
||||||
|
/*
|
||||||
font = CreateFontA(
|
font = CreateFontA(
|
||||||
-48,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,
|
-48,0,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,
|
||||||
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
|
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
|
||||||
VARIABLE_PITCH | 4 | FF_SWISS,
|
VARIABLE_PITCH | 4 | FF_SWISS,
|
||||||
TEXT("Arial")
|
sFontName)
|
||||||
);
|
);
|
||||||
|
*/
|
||||||
|
PLOGFONT pLogFont = (PLOGFONT) LocalAlloc(LPTR, sizeof(LOGFONT));
|
||||||
|
int angle = 33 * 10; // 3600 = 360 degrees
|
||||||
|
pLogFont->lfHeight = -48;
|
||||||
|
pLogFont->lfWeight = FW_NORMAL;
|
||||||
|
pLogFont->lfEscapement = angle;
|
||||||
|
pLogFont->lfOrientation = angle;
|
||||||
|
SetTextAlign(hFrameDC,TA_BASELINE);
|
||||||
|
|
||||||
|
font = CreateFontIndirect( pLogFont );
|
||||||
|
HGDIOBJ hFontPrev = SelectObject(hFrameDC, font);
|
||||||
|
|
||||||
SelectObject(hFrameDC,font);
|
SelectObject(hFrameDC,font);
|
||||||
sprintf( szVersion, "NTSC Alpha v12 AnsiStory" );
|
sprintf( szVersion, "NTSC Alpha v13 FullScreen" );
|
||||||
xoff = 0;
|
xoff = -nViewportCX + nViewportCX/6;
|
||||||
yoff = 0;
|
yoff = +nViewportCY/16;
|
||||||
DRAWVERSION( 42, -158*scale,RGB(0x00,0x00,0x00));
|
DRAWVERSION( 0, 0,RGB(0x00,0x00,0x00));
|
||||||
DRAWVERSION( 41, -157*scale,RGB(0x00,0x00,0x00));
|
DRAWVERSION( 1, 1,RGB(0x00,0x00,0x00));
|
||||||
DRAWVERSION( 40, -156*scale,RGB(0xFF,0x00,0xFF));
|
DRAWVERSION( 2, 2,RGB(0xFF,0x00,0xFF));
|
||||||
|
|
||||||
|
LocalFree((LOCALHANDLE)pLogFont);
|
||||||
|
SelectObject(hFrameDC,hFontPrev);
|
||||||
// NTSC END
|
// NTSC END
|
||||||
|
|
||||||
#undef DRAWVERSION
|
#undef DRAWVERSION
|
||||||
@ -1126,15 +1143,26 @@ void VideoRefreshScreen ( int bVideoModeFlags )
|
|||||||
LONG pitch = 0;
|
LONG pitch = 0;
|
||||||
HDC hFrameDC = FrameGetVideoDC(&pDstFrameBufferBits,&pitch);
|
HDC hFrameDC = FrameGetVideoDC(&pDstFrameBufferBits,&pitch);
|
||||||
|
|
||||||
|
#if 1 // Keep Aspect Ratio
|
||||||
|
// Need to clear full screen logo to black
|
||||||
|
#define W g_nViewportCX
|
||||||
|
#define H g_nViewportCY
|
||||||
|
#else // Stretch
|
||||||
|
// Stretch - doesn't preserve 1:1 aspect ratio
|
||||||
|
#define W g_bIsFullScreen ? g_nDDFullScreenW : g_nViewportCX
|
||||||
|
#define H g_bIsFullScreen ? g_nDDFullScreenH : g_nViewportCY
|
||||||
|
#endif
|
||||||
|
|
||||||
if (hFrameDC)
|
if (hFrameDC)
|
||||||
{
|
{
|
||||||
StretchBlt(
|
StretchBlt(
|
||||||
hFrameDC,
|
hFrameDC,
|
||||||
0,0,
|
0, 0,
|
||||||
g_nViewportCX,g_nViewportCY, //dst
|
W, // dst
|
||||||
|
H, // dst
|
||||||
g_hDeviceDC,
|
g_hDeviceDC,
|
||||||
0,0,
|
0, 0,
|
||||||
FRAMEBUFFER_W,FRAMEBUFFER_H, // src
|
FRAMEBUFFER_W, FRAMEBUFFER_H, // src // NOT 560, 384
|
||||||
SRCCOPY );
|
SRCCOPY );
|
||||||
GdiFlush();
|
GdiFlush();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user