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