![]() |
Shadowrun: Awakened 29 September 2011 - Build 871
|
#include "winvideo.h"#include <gdiplus.h>#include <stdio.h>
Include dependency graph for gdivideo.cpp:Go to the source code of this file.
Functions | |
| bool | DisplayError (LPSTR lpstrErr, HRESULT hres) |
| display system error | |
| LRESULT CALLBACK | InternalWndProc (HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) |
| Win event processing function. | |
Variables | |
| Gdiplus::Bitmap * | g_pBitmap |
| Gdiplus::GdiplusStartupInput | gdiplusStartupInput |
| ULONG_PTR | gdiplusToken |
| bool DisplayError | ( | LPSTR | lpstrErr, |
| HRESULT | hres | ||
| ) |
Create a dialog box and tell the user what went wrong.
Definition at line 45 of file gdivideo.cpp.
References g_hAppWnd.
{
static bool InError = false;
int retval = 0;
if (!InError)
{
InError = true;
LPCSTR lpMsgBuf;
if(!hres) hres = GetLastError();
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, hres, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL );
retval = MessageBox(g_hAppWnd, lpstrErr, lpMsgBuf, MB_OK|MB_ICONERROR);
LocalFree( (HLOCAL)lpMsgBuf );
InError = false;
}
return false;
}
| LRESULT CALLBACK InternalWndProc | ( | HWND | hwnd, |
| UINT | iMsg, | ||
| WPARAM | wParam, | ||
| LPARAM | lParam | ||
| ) |
Definition at line 64 of file gdivideo.cpp.
References CheckBoundries(), DDOverlayInit(), DDPrimaryInit(), DestroyOverlay(), DestroyPrimary(), DisplayError(), DrawOverlay(), g_dwXRatio, g_dwYRatio, g_OverlayFlags, g_OverlayFX, g_pBitmap, g_pDDSOverlay, g_pDDSPrimary, g_pUserProc, g_rcDst, g_rcSrc, g_sizex, g_sizey, g_video, L, mouse(), video::on_key(), video::on_mouse(), and video::updating.
{
switch (iMsg)
{
case WM_MOVE:
// Check to make sure our window exists before we tell it to repaint.
// This will fail the first time (while the window is being created).
if (hwnd) {
InvalidateRect(hwnd, NULL, FALSE);
UpdateWindow(hwnd);
}
return 0L;
case WM_PAINT:
{
PAINTSTRUCT ps;
Gdiplus::Graphics graphics( BeginPaint(hwnd, &ps) );
// redraw just requested area. This call is as fast as simple DrawImage() call.
if(g_video->updating) graphics.DrawImage(g_pBitmap, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right, ps.rcPaint.bottom, Gdiplus::UnitPixel);
EndPaint(hwnd, &ps);
}
return 0L;
// Proccess all mouse and keyboard events
case WM_LBUTTONDOWN: g_video->on_mouse( (int)LOWORD(lParam), (int)HIWORD(lParam), 1); break;
case WM_LBUTTONUP: g_video->on_mouse( (int)LOWORD(lParam), (int)HIWORD(lParam), -1); break;
case WM_RBUTTONDOWN: g_video->on_mouse( (int)LOWORD(lParam), (int)HIWORD(lParam), 2); break;
case WM_RBUTTONUP: g_video->on_mouse( (int)LOWORD(lParam), (int)HIWORD(lParam), -2); break;
case WM_MBUTTONDOWN: g_video->on_mouse( (int)LOWORD(lParam), (int)HIWORD(lParam), 3); break;
case WM_MBUTTONUP: g_video->on_mouse( (int)LOWORD(lParam), (int)HIWORD(lParam), -3); break;
case WM_CHAR: g_video->on_key( (int)wParam); break;
// some useless stuff
case WM_ERASEBKGND: return 1; // keeps erase-background events from happening, reduces chop
case WM_DISPLAYCHANGE: return 0;
// Now, shut down the window...
case WM_DESTROY: PostQuitMessage(0); return 0;
}
// call user defined proc, if exists
return g_pUserProc? g_pUserProc(hwnd, iMsg, wParam, lParam) : DefWindowProc(hwnd, iMsg, wParam, lParam);
}
| Gdiplus::Bitmap* g_pBitmap |
Definition at line 40 of file gdivideo.cpp.
Referenced by InternalWndProc().
| Gdiplus::GdiplusStartupInput gdiplusStartupInput |
Definition at line 42 of file gdivideo.cpp.
| ULONG_PTR gdiplusToken |
Definition at line 41 of file gdivideo.cpp.
Copyright © 2007-2010 by The Shadowrun: Awakened Team. This work is licensed under the GNU Lesser General Public License 3.