[MAZESCR]

Made mazescr use screensaver.lib for multi screen support
Add symbol to make things look more... mature in C:\ReactOS
Fixes of my two problems (app does not really terminate and maze is not generated completely) and tidy up (-200 lines of code!) of my mess and the mess we had in there before by David Quintana. Thx man :-D

svn path=/trunk/; revision=67781
This commit is contained in:
Daniel Reimer 2015-05-16 19:16:40 +00:00
parent a175511a5a
commit d6510c4911
7 changed files with 598 additions and 1002 deletions

View file

@ -1,10 +1,8 @@
add_executable(mazescr
scrnsave.c
maze.c
scrnsave.rc)
add_executable(mazescr maze.c maze.rc)
set_module_type(mazescr win32gui)
set_module_type(mazescr win32gui UNICODE)
set_target_properties(mazescr PROPERTIES SUFFIX ".scr")
target_link_libraries(mazescr scrnsave)
add_importlibs(mazescr user32 gdi32 msvcrt kernel32)
add_cd_file(TARGET mazescr DESTINATION reactos/system32 FOR all)

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,53 @@
#include <windows.h>
#include <scrnsave.h>
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDI_ICON ICON DISCARDABLE "res/icon_mazescr.ico"
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "Maze ScreenSaver\0"
#define REACTOS_STR_INTERNAL_NAME "maze\0"
#define REACTOS_STR_ORIGINAL_FILENAME "maze.scr\0"
#include <reactos/version.rc>
#include <reactos/manifest_exe.rc>
/* UTF-8 */
#pragma code_page(65001)
#ifdef LANGUAGE_BG_BG
#include "lang/bg-BG.rc"
#endif
#ifdef LANGUAGE_DE_DE
#include "lang/de-DE.rc"
#endif
#ifdef LANGUAGE_EN_US
#include "lang/en-US.rc"
#endif
#ifdef LANGUAGE_ES_ES
#include "lang/es-ES.rc"
#endif
#ifdef LANGUAGE_FR_FR
#include "lang/fr-FR.rc"
#endif
#ifdef LANGUAGE_LT_LT
#include "lang/lt-LT.rc"
#endif
#ifdef LANGUAGE_NO_NO
#include "lang/no-NO.rc"
#endif
#ifdef LANGUAGE_PL_PL
#include "lang/pl-PL.rc"
#endif
#ifdef LANGUAGE_RO_RO
#include "lang/ro-RO.rc"
#endif
#ifdef LANGUAGE_SK_SK
#include "lang/sk-SK.rc"
#endif
#ifdef LANGUAGE_UK_UA
#include "lang/uk-UA.rc"
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View file

@ -1,4 +1,6 @@
#pragma once
#define IDS_DESCRIPTION 1
#define IDS_TITLE 2
#define IDS_TEXT 3
#define IDI_ICON 101

View file

@ -1,234 +0,0 @@
/*
* Copyright 2003 J Brown
* Copyright 2006 Eric Kohl
*
* 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
*/
#include <windows.h>
#include <tchar.h>
#include "resource.h"
#define APPNAME _T("Scrnsave")
LRESULT CALLBACK MazeWndProc(
HWND hWnd, // window handle
UINT message, // type of message
WPARAM wParam, // additional information
LPARAM lParam); // additional information
int APIENTRY MazeMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
HWND hParent);
HINSTANCE hInstance;
BOOL fullscreen = FALSE;
LRESULT WINAPI WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static POINT ptLast;
static POINT ptCursor;
static BOOL fFirstTime = TRUE;
switch (msg)
{
case WM_DESTROY:
if (fullscreen)
ShowCursor(TRUE);
PostQuitMessage(0);
break;
// break out of screen-saver if any keyboard activity
case WM_NOTIFY:
case WM_SYSKEYDOWN:
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
// break out of screen-saver if any mouse activity
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_MOUSEMOVE:
// If we've got a parent then we must be a preview
if(GetParent(hwnd) != 0)
return 0;
if(fFirstTime)
{
GetCursorPos(&ptLast);
fFirstTime = FALSE;
}
GetCursorPos(&ptCursor);
// if the mouse has moved more than 3 pixels then exit
if(abs(ptCursor.x - ptLast.x) >= 3 || abs(ptCursor.y - ptLast.y) >= 3)
PostMessage(hwnd, WM_CLOSE, 0, 0);
ptLast = ptCursor;
return 0;
}
return MazeWndProc(hwnd, msg, wParam, lParam);
}
HWND InitSaver(HWND hwndParent)
{
WNDCLASS wc;
HWND hwnd;
ZeroMemory(&wc, sizeof(wc));
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WndProc;
wc.lpszClassName = APPNAME;
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
RegisterClass(&wc);
if (hwndParent != 0)
{
RECT rect;
GetClientRect(hwndParent, &rect);
hwnd = CreateWindow(APPNAME, APPNAME,
WS_VISIBLE | WS_CHILD,
0, 0,
rect.right,
rect.bottom,
hwndParent, 0,
hInstance, NULL);
fullscreen = FALSE;
}
else
{
hwnd = CreateWindowEx(WS_EX_TOPMOST,
APPNAME,
APPNAME,
WS_VISIBLE | WS_POPUP,
0,
0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
HWND_DESKTOP,
0,
hInstance,
NULL);
SetWindowPos(hwnd,
0,
0,
0,
0,
0,
SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSIZE | SWP_SHOWWINDOW);
ShowCursor(FALSE);
fullscreen = TRUE;
}
return hwnd;
}
void ParseCommandLine(PSTR szCmdLine, int *chOption, HWND *hwndParent)
{
int ch = *szCmdLine++;
if(ch == '-' || ch == '/')
ch = *szCmdLine++;
if(ch >= 'A' && ch <= 'Z')
ch += 'a' - 'A';
*chOption = ch;
ch = *szCmdLine++;
if(ch == ':')
ch = *szCmdLine++;
while(ch == ' ' || ch == '\t')
ch = *szCmdLine++;
if(isdigit(ch))
{
unsigned int i = atoi(szCmdLine - 1);
*hwndParent = (HWND)i;
}
else
*hwndParent = 0;
}
void Configure(void)
{
TCHAR szTitle[256];
TCHAR szText[256];
LoadString(hInstance,
IDS_TITLE,
szTitle,
256);
LoadString(hInstance,
IDS_TEXT,
szText,
256);
MessageBox(0,
szText,
szTitle,
MB_OK | MB_ICONWARNING);
}
int WINAPI WinMain (HINSTANCE hInst,
HINSTANCE hPrev,
LPSTR lpCmdLine,
int iCmdShow)
{
HWND hwndParent;
HWND hwndChild;
UINT nPreviousState;
int chOption;
hInstance = hInst;
ParseCommandLine(lpCmdLine, &chOption, &hwndParent);
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, TRUE, &nPreviousState, 0);
switch (chOption)
{
case 's':
hwndChild = InitSaver(0);
break;
case 'p':
hwndChild = InitSaver(hwndParent);
break;
case 'c':
default:
Configure();
return 0;
}
MazeMain(hInst, hPrev, lpCmdLine, hwndChild);
SystemParametersInfo(SPI_SETSCREENSAVERRUNNING, FALSE, &nPreviousState, 0);
return 0;
}

View file

@ -1,26 +0,0 @@
#include <windows.h>
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
#define REACTOS_VERSION_DLL
#define REACTOS_STR_FILE_DESCRIPTION "Maze ScreenSaver\0"
#define REACTOS_STR_INTERNAL_NAME "maze\0"
#define REACTOS_STR_ORIGINAL_FILENAME "maze.scr\0"
#include <reactos/version.rc>
/* UTF-8 */
#pragma code_page(65001)
#include "lang/bg-BG.rc"
#include "lang/de-DE.rc"
#include "lang/en-US.rc"
#include "lang/es-ES.rc"
#include "lang/fr-FR.rc"
#include "lang/lt-LT.rc"
#include "lang/no-NO.rc"
#include "lang/pl-PL.rc"
#include "lang/ro-RO.rc"
#include "lang/sk-SK.rc"
#include "lang/uk-UA.rc"