📄 mainwnd.cpp
字号:
// Quick Intution Builder by Master on LSD (LmaSterD)
// Email me: Master322@aol.com
/*
ALL Fourtnes are Based Off Input, How it was Entered, how Fast
What kind , etc
then special variables are based off it:
if(ifinsane() == 2) // Sanity Level of 2 Was Determined
{
}
// etc
*/
#include <windows.h>
#include <string.h>
#include <time.h>
#include <ctime>
#include "resource.h"
#include "RandNumber.h"
// GLOBAL CONSTANTS
#define LOW 0
#define MED 1
#define HIGH 2
//
// Function Prototypes
// Non-Card Functions
LRESULT APIENTRY WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
LRESULT APIENTRY InputProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
void MenuProc(WPARAM);
void LoadGraphics(HINSTANCE hInst);
// Card Functions
void ShuffleDeck(); // GAME 1 STYLE DECK
void ShuffleDeck2(); // GAME 2 STYLE DECK
void NextCard();
void SetCard(HWND,HBITMAP);
void ShowCard(int);
void FourtneResponse(char* fourtne, int CorrectGuess, int RndTime);
int eRate();
int ifinsane();
int randbytime(int);
int GetGuess(int);
int enterRate = 0;
int EnterySum[24];
int EnteryIndex = 0;
clock_t wait;
clock_t waitI[24];
int waitIndex = 0;
enum GAMETYPE { GAME1, GAME2 };
// 0 1
GAMETYPE game;
int gplay = 0;
int Count5 = 0;
int total_t = 0;
// Global Variables
// Non Card Variables
HWND MainWindow;
HWND CardDeckStatic;
HWND CardShownStatic;
HWND InputWindow;
HWND InputStatic;
// Card Variables
int DECK[24];
int cardindex = 0;
bool gotinput = false;
// Bitmaps
HBITMAP CardBack;
HBITMAP CardBlack;
HBITMAP Card1;
HBITMAP Card2;
HBITMAP Card3;
HBITMAP Card4;
HBITMAP Card5;
HBITMAP Guess;
int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR l, int CmdShow)
{
MSG msg;
WNDCLASS wc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.hInstance = hInst;
wc.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICON1));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1);
wc.lpszClassName = "MasterCard";
wc.style = CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wc);
wc.lpszMenuName = NULL;
wc.lpszClassName = "MasterInput";
wc.lpfnWndProc = (WNDPROC) InputProc;
RegisterClass(&wc);
LoadGraphics(hInst);
MainWindow = CreateWindow("MasterCard", "Masters Intution Builder", WS_POPUP| WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX,0,0,230,200,0,0,hInst,NULL);
CardDeckStatic = CreateWindow("STATIC", "", SS_BITMAP|WS_VISIBLE|WS_CHILD,20,20,0,0,MainWindow,0,hInst,0);
CardShownStatic = CreateWindow("STATIC", "", SS_BITMAP|WS_VISIBLE|WS_CHILD,120,20,0,0,MainWindow,0,hInst,0);
SendMessage(CardDeckStatic, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)CardBack);
SendMessage(CardShownStatic, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)CardBlack);
ShowWindow(CardDeckStatic,SW_SHOW);
ShowWindow(MainWindow,SW_SHOW);
UpdateWindow(MainWindow);
InputWindow = CreateWindow("MasterInput", "Guess Next Card (1-5)", WS_POPUP | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX,0,0,332,102,0,0,hInst,0);
InputStatic = CreateWindow("STATIC", "", SS_BITMAP|WS_VISIBLE|WS_CHILD,0,0,0,0,InputWindow,0,hInst,0);
SetCard(InputStatic,Guess);
ShowWindow(InputStatic, SW_SHOW);
SetWindowPos(MainWindow, HWND_TOPMOST, 0,0,230,200,WS_POPUP| WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX);
SetWindowPos(InputWindow, HWND_TOPMOST,0,0,332,102,WS_POPUP | WS_CAPTION | WS_THICKFRAME | WS_MINIMIZEBOX);
game = GAME1;
while(GetMessage(&msg,0,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}
LRESULT APIENTRY WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_COMMAND:
MenuProc(wParam);
break;
default: return DefWindowProc(hwnd,msg,wParam,lParam);
}
return 0;
}
LRESULT APIENTRY InputProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
default: return DefWindowProc(hwnd,msg,wParam,lParam);
}
return 0;
}
void MenuProc(WPARAM wParam)
{
HMENU MainMenu;
MainMenu = GetMenu(MainWindow);
switch(wParam)
{
case ID_FILEEXIT:
if(MessageBox(MainWindow, "Do You Wish to Exit?", "Quit..", MB_YESNO | MB_ICONQUESTION) == IDYES)
{
PostQuitMessage(0);
}
break;
case ID_FILENEW:
ShuffleDeck();
int CorrectGuess;
CorrectGuess = 0;
gplay++;
if(game == GAME1)
{
MessageBox(MainWindow, "How to Play:\nThere will be 25 cards in this deck shuffled\nYou enter the number (1-5) you think that is going to appear next\nthe cards within the deck are mixed, so this time you could have 4 5 cards, and next time 6\nUsing this method prevents card counting\nuse your intution to try and guess\nafter each card you will be prompted on your success\nand in the end you will see what percentage of cards were guessed correct\nfollow your inner mind and flex those powers\nReady Lets Start!", "Master's Intution Builder" , MB_OK | MB_ICONINFORMATION);
while(cardindex <= 24)
{
ShowWindow(InputWindow, SW_SHOW);
UpdateWindow(InputWindow);
UpdateWindow(InputStatic);
SetFocus(InputWindow);
gotinput = false;
int newKey = 0;
clock_t start = clock();
clock_t stop;
while(gotinput == false)
{
SetFocus(InputWindow);
if(GetAsyncKeyState(49))
{
newKey = 0;
gotinput = true;
}
if(GetAsyncKeyState(50))
{
newKey = 1;
gotinput = true;
}
if(GetAsyncKeyState(51))
{
newKey = 2;
gotinput = true;
}
if(GetAsyncKeyState(52))
{
newKey = 3;
gotinput = true;
}
if(GetAsyncKeyState(53))
{
newKey = 4;
Count5++; // Sanity Check
gotinput = true;
}
// Count How Long Inbetween Each Guess For Rate
stop = clock();
enterRate++;
wait = stop;
waitI[waitIndex] = wait;
waitIndex++;
}
EnterySum[EnteryIndex] = enterRate;
enterRate = 0;
EnteryIndex++; // Count How Long Each Time Took
int next;
next = DECK[cardindex + 1];
ShowWindow(InputWindow, SW_HIDE);
NextCard();
if(next == newKey)
{
MessageBox(MainWindow, "You Are Correct!","Master's Intution Builder", MB_OK | MB_ICONINFORMATION);
CorrectGuess++;
}
else
{
MessageBox(MainWindow, "You are Incorrect!", "Master's Intution Builder", MB_OK | MB_ICONINFORMATION);
}
}
}
else
{
// Game 2
MessageBox(MainWindow, "Welcome to Game2!\n\nThis mode is alot like the first, but the cards\n are cut into maximum amounts of each kind,\n per 25. that means, theres only 5 , 5 's and only 5 of\n the 2's. So to minimize, the amount and\n give you a easyier way to get more correct\n", "Master's Intution Builder", MB_OK | MB_ICONINFORMATION);
}
char GameOver[800];
strcpy(GameOver, "Master's Intution Builder: Game Over\n\nYour Overal Score: ");
char cbuff[10];
itoa(CorrectGuess,cbuff,10);
strcat(GameOver, cbuff);
strcat(GameOver, " \\ 25\n\nYour Rank: ");
char Rank[100];
int pGuess;
pGuess = rand()%1;
// Routine to Rate the Entery Length
int erate;
erate = eRate();
// Routine to Check Sanity (Remembering Skils)!
int sanity; sanity = ifinsane();
if((CorrectGuess > 0) && (CorrectGuess < 4))
{
if(pGuess == 1)
{
strcpy(Rank, "Normal Person Who Loves");
}
else
{
if(sanity == LOW)
{
strcpy(Rank, "Normal Person Possibly Seperated");
}
if(sanity == MED)
{
strcpy(Rank, "Normal Person, not very aware");
}
if(sanity == HIGH)
{
strcpy(Rank, "Your Attention is Low");
}
}
}
if((CorrectGuess >= 4) && (CorrectGuess < 9))
{
if(pGuess == 1)
{
strcpy(Rank,"Maybe You Dropped Acid Before, or are Lucky"); // L S D
}
else
{
if(sanity == 0)
{
strcpy(Rank, "Powers are growing, but are lacked because you dont have enough faith");
}
if(sanity == 1)
{
strcpy(Rank, "Possible Mood Swings,block you");
}
if(sanity == 2)
{
strcpy(Rank, "Listen carefuly, and try to concentrate, use all your senses. watch the cards!");
}
}
}
if((CorrectGuess >= 9) && (CorrectGuess < 14))
{
strcpy(Rank, "Some Intutive Ability: ");
if(sanity == 0)
{
strcat(Rank, "You Focus carefully, and watch close");
}
if(sanity == 1)
{
strcat(Rank, "the bottom of your mind, helps you only a little");
}
if(sanity == 2)
{
strcat(Rank, "your not doing to hot in the memory area");
}
}
if
((CorrectGuess >= 14) && (CorrectGuess < 19))
{
strcpy(Rank, "Your powers are growing");
}
if((CorrectGuess >= 19))
{
strcpy(Rank, "You have a powerful intuitive ability");
}
strcat(GameOver, Rank);
char FourtneBuff[1000];
char Fourtne[500];
strcpy(FourtneBuff, "\n\nFourtne Based off Your Intutive Hamrony Level:\n\n");
if(gplay == 5)
{
strcpy(Fourtne, "You seem to be compulsive, and not let things go");
}else
{
FourtneResponse(Fourtne,CorrectGuess, randbytime(10));
}
strcat(FourtneBuff,Fourtne);
strcat(GameOver,FourtneBuff);
// Fourtne Response, based off of Correct Number, Into Randomizer
MessageBox(MainWindow, GameOver, "Master's Intution Builder", MB_OK | MB_ICONINFORMATION);
SetCard(CardShownStatic, CardBlack);
break;
case ID_CARDMODE1:
CheckMenuItem(MainMenu,ID_CARDMODE2, MF_UNCHECKED);
CheckMenuItem(MainMenu,ID_CARDMODE1, MF_CHECKED);
game = GAME1;
break;
case ID_CARDMODE2:
CheckMenuItem(MainMenu,ID_CARDMODE1, MF_UNCHECKED);
CheckMenuItem(MainMenu,ID_CARDMODE2, MF_CHECKED);
game = GAME2;
break;
case ID_HELPABOUT:
MessageBox(MainWindow, "Master's Intution Builder By LmaSterD\n\nUse this program, to help grasp\nallowing the super concious, to fill you with information, on whats coming next\n\nGrahpics Thanks to Micheal\n\nEmail me: Master322@aol.com", "Master's Intution Builder", MB_OK | MB_ICONINFORMATION);
break;
case ID_HELPTIPS:
char duf[500];
FourtneResponse(duf,15,randbytime(50));
MessageBox(MainWindow, "Master's Tips on using Intution:\n\nMethod 1:\nPut yourself into a relaxed state and\nask your inner mind what is the next number?\nthis first thought that pops in your head should be your answer\n\nMethod 2:\nLet the keypresses flow, just hit the keys off the top of your head\nAllow the universal conciousness to guide you\n\nMethod 3:\nFocus on the card see a white image\nAllow yourself to see what number will come up next\nfirst picture you see, use it\n\n\nMany other Methods may be used, these are just suggestions. -Master", "Master's Intution Builder", MB_OK | MB_ICONINFORMATION);
break;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -