Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
MasterMain.cpp
Package: DirectX_2D.zip [view]
Upload User: hnktjx
Upload Date: 2009-12-18
Package Size: 39k
Code Size: 2k
Category:
Game Program
Development Platform:
C/C++
- // MasterX Skeleton
- // MasterX SDK written by Jared Bruni
- #include "masterx.h"
- #include "resource.h"
- // MasterX Window Message Process Prototype
- long __stdcall MasterProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);
- void update(MASTERSCREEN screen);
- void LoadSound();
- void LoadGraphics();
- MasterXHWND mxhwnd;
- MasterSound mxsound;
- MasterGraphic mgraphic;
- int mgraphic_x = 0;
- int mgraphic_y = 0;
- // MasterX Program Entry Point
- int __stdcall MasterMain(HINSTANCE hInst,LPSTR line)
- {
- if(mxhwnd.CreateMasterX("MasterX_Skeleton",640,480,COLOR_DEFAULT,MasterProc,hInst,LoadIcon(NULL,IDI_APPLICATION),LoadCursor(NULL,IDC_ARROW)))
- {
- LoadSound();
- LoadGraphics();
- return mxhwnd.InitLoop(update);
- }
- return 0;
- }
- // MasterX Window Message Process Defenition Body
- long __stdcall MasterProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)
- {
- switch(msg)
- {
- case WM_ACTIVATEAPP:
- mxhwnd.activeapp = wParam;
- break;
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
- case WM_KEYDOWN:
- {
- switch(wParam)
- {
- case VK_ESCAPE:
- mxhwnd.Kill();
- break;
- case 13:
- mxsound.Play();
- break;
- }
- }
- break;
- default: return DefWindowProc(hwnd,msg,wParam,lParam);
- }
- return 0;
- }
- void update(MASTERSCREEN screen)
- {
- if(mxhwnd.KeyCheck(DIK_LEFT))
- {
- mgraphic_x--;
- if(mgraphic_x < 0)
- {
- mgraphic_x = 0;
- }
- }
- if(mxhwnd.KeyCheck(DIK_RIGHT))
- {
- mgraphic_x++;
- if(mgraphic_x > 640-mgraphic.w)
- {
- mgraphic_x = 640-mgraphic.w;
- }
- }
- if(mxhwnd.KeyCheck(DIK_DOWN))
- {
- mgraphic_y++;
- if(mgraphic_y > 480-mgraphic.h)
- {
- mgraphic_y = 480-mgraphic.h;
- }
- }
- if(mxhwnd.KeyCheck(DIK_UP))
- {
- mgraphic_y--;
- if(mgraphic_y < 0)
- {
- mgraphic_y = 0;
- }
- }
- mgraphic.DisplayGraphic(mgraphic_x,mgraphic_y);
- mxhwnd.text.printtext("Press escape to exit, and arrow keys to move the image, enter to play a sound",10,10);
- }
- void LoadSound()
- {
- mxhwnd.LoadSound(&mxsound,MAKEINTRESOURCE(IDR_WAVE1));
- }
- void LoadGraphics()
- {
- mxhwnd.LoadGraphic(&mgraphic,"quit.bmp");
- mgraphic.SetColorKey(RGB(255,0,255));
- }