#include<windows.h>
#include<iostream>
#include<cmath>
using namespace std;
/****************************************************************************
定義関連
****************************************************************************/
enum KEY
{
VK_Z= 0x5a ,//キーボード「Z」
} ;
struct Player//自機構造体
{
float x,y; //自機の座標
int width,height; //自機の幅と高さ
int shotInterval; //弾の発射間隔を制御するためのカウンター
} ;
const float PAI= 3.14159265358979323846f ; //π
#define DegToRadian(x) ((double)(x*PAI/180))
HINSTANCE hInst; //インスタンスのハンドル
HWND hWnd; //ウィンドウのハンドル
Player player; //自機
HDC hBackDC; //裏画面用デバイスコンテキスト
HBITMAP hBackBitmap; //裏画面
int fps;
LRESULT CALLBACK WndProc( HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam) ;
void GameInit( ) ; //初期化
void GameEnd( ) ; //終了処理
void GameLoop( ) ; //ゲームループ
void GameDraw( ) ; //描画処理
void Stage( ) ; //ステージ処理関連
void MovePlayer( ) ; //自機移動等
void DrawPlayer( const HDC & hDC) ; //自機描画
/****************************************************************************
Window処理関連
****************************************************************************/
//ウィンドウプロシージャ
LRESULT CALLBACK WndProc( HWND hWnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
switch ( uMsg)
{
case WM_CLOSE: //窓を閉じたら行う処理
DestroyWindow( hWnd) ;
return FALSE;
case WM_DESTROY: //ウィンドウが破壊されたときに行う処理
PostQuitMessage( 0 ) ;
return FALSE;
default :
return DefWindowProc( hWnd,uMsg,wParam,lParam) ;
}
}
//ウィンドウ作成関数
void CreateGameWindow( )
{
//どんなウィンドウを作成するか記述する
WNDCLASSEX wcex= { sizeof ( WNDCLASSEX) } ; //構造体を全部0で初期化
wcex.cbSize = sizeof ( WNDCLASSEX) ;
wcex.lpfnWndProc = ( WNDPROC) WndProc;
wcex.hInstance = hInst;
wcex.hbrBackground = ( HBRUSH) ( COLOR_WINDOW+ 2 ) ;
wcex.lpszClassName = "STGSample1" ;
wcex.hCursor = ( HCURSOR) LoadImage( // マウスカーソル
NULL , MAKEINTRESOURCE( IDC_ARROW) , IMAGE_CURSOR,
0 , 0 , LR_DEFAULTSIZE | LR_SHARED
) ;
RegisterClassEx( & wcex) ;
hWnd= CreateWindow( wcex.lpszClassName ,
"--- stg ---" ,
WS_OVERLAPPEDWINDOW- WS_SIZEBOX- WS_MAXIMIZEBOX,
0 ,0 ,384 ,448 ,
NULL ,NULL ,hInst,NULL ) ;
ShowWindow( hWnd,SW_SHOW) ;
UpdateWindow( hWnd) ;
}
int APIENTRY WinMain( HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
{
MSG msg;
hInst= hInstance;
nCmdShow; lpCmdLine; hPrevInstance; hInstance;
//ウィンドウ初期化
CreateGameWindow( ) ;
//変数等初期化
GameInit( ) ;
//メッセージループ
while ( TRUE)
{
if ( PeekMessage( & msg,0 ,0 ,0 ,PM_NOREMOVE) )
{
if ( ! GetMessage( & msg,NULL ,0 ,0 ) ) break ;
TranslateMessage( & msg) ;
DispatchMessage( & msg) ;
}
else
{
if ( GetKeyState( VK_ESCAPE) & 0x8000 ) exit ( 0 ) ;
//ここにゲームループをかく
GameLoop( ) ;
}
}
return msg.wParam ;
}
/****************************************************************************
ゲーム処理関連
****************************************************************************/
//ゲーム初期化
void GameInit( )
{
timeBeginPeriod( 1 ) ;
ZeroMemory( & player,sizeof ( Player) ) ;
//自機変数初期化
player.x = 192 ;
player.y = 224 ;
player.width = 16 ;
player.height = 16 ;
//裏画面初期化
HDC hDC;
hDC= GetDC( hWnd) ; //表画面のデバイスコンテキストの内容を取得
hBackDC= CreateCompatibleDC( hDC) ; //表画面と同じの裏画面用のデバイスコンテキストを生成
hBackBitmap= CreateCompatibleBitmap( hDC,384 ,448 ) ; //表画面と同じ画面生成
SelectObject( hBackDC,hBackBitmap) ; //デバイスコンテキストと画面本体を関連付ける
ReleaseDC( hWnd,hDC) ;
}
//ゲーム終了処理
void GameEnd( )
{
}
//ゲームループ
void GameLoop( )
{
Stage( ) ;
MovePlayer( ) ;
GameDraw( ) ;
Sleep( 16 ) ;
}
int GetFps( )
{
return fps;
}
//描画処理
void GameDraw( )
{
HDC hDC;
RECT rcWnd;
GetClientRect( hWnd,& rcWnd) ; //クライアント領域の大きさを取得
//裏画面を黒でクリア
FillRect( hBackDC,& rcWnd,( HBRUSH) GetStockObject( BLACK_BRUSH) ) ;
SetBkMode( hBackDC,TRANSPARENT) ;
//裏画面に描画
DrawPlayer( hBackDC) ;
//SCORE
SetTextColor( hBackDC,RGB( 255 ,255 ,255 ) ) ;
char buf[ 256 ] ;
sprintf ( buf,"--Test--" ) ;
TextOut( hBackDC,0 ,0 ,buf,lstrlen( buf) ) ; //spf表示
//表画面に裏画面をコピー
hDC= GetDC( hWnd) ; //デバイスコンテキストを取得
BitBlt( hDC,0 ,0 ,384 ,448 ,hBackDC,0 ,0 ,SRCCOPY) ; //裏画面→表画面にコピー
ReleaseDC( hWnd,hDC) ; //デバイスコンテキスト開放
}
/****************************************************************************
ステージ処理関連
****************************************************************************/
void Stage( )
{
}
/****************************************************************************
自機処理関連
****************************************************************************/
//自機移動等
void MovePlayer( )
{
RECT rcWnd;
GetClientRect( hWnd,& rcWnd) ; //クライアント領域の大きさを取得
//自機移動
if ( GetKeyState( VK_LEFT) & 0x8000 ) player.x - = 3 ; //←
else if ( GetKeyState( VK_RIGHT) & 0x8000 ) player.x + = 3 ; //→
if ( GetKeyState( VK_UP) & 0x8000 ) player.y - = 3 ; //↑
else if ( GetKeyState( VK_DOWN) & 0x8000 ) player.y + = 3 ; //↓
//移動後画面端を越えないようにする処理
if ( player.x < 0 ) player.x = 0 ;
else if ( player.x > rcWnd.right - player.width ) player.x = rcWnd.right - player.width ;
if ( player.y < 0 ) player.y = 0 ;
else if ( player.y > rcWnd.bottom - player.height ) player.y = rcWnd.bottom - player.height ;
//自機弾発射
if ( GetKeyState( VK_Z) & 0x8000 )
{
// player.shotInterval++;//弾発射間隔を制御
// if(player.shotInterval%6==0)
// CreateShot(player.x+player.width/2-8/2,player.y,8,8,8,270,STRAIGHT,PLAYER);
}
else player.shotInterval = 0 ;
}
//自機描画
void DrawPlayer( const HDC & hDC)
{
HBRUSH hBrush, hOldBrush;
hBrush= CreateSolidBrush( RGB( 64 ,64 ,212 ) ) ;
hOldBrush= ( HBRUSH) SelectObject( hDC,hBrush) ;
Rectangle( hDC,player.x ,player.y ,player.x + player.width ,player.y + player.height ) ;
SelectObject( hDC,hOldBrush) ;
DeleteObject( hBrush) ;
}
I2luY2x1ZGU8d2luZG93cy5oPgojaW5jbHVkZTxpb3N0cmVhbT4KI2luY2x1ZGU8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgrlrprnvqnplqLpgKMKKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8KZW51bSBLRVkKewoJVktfWj0weDVhLC8v44Kt44O844Oc44O844OJ44CMWuOAjQp9OwoKc3RydWN0IFBsYXllci8v6Ieq5qmf5qeL6YCg5L2TCnsKCWZsb2F0IHgseTsvL+iHquapn+OBruW6p+aomQoJaW50IHdpZHRoLGhlaWdodDsvL+iHquapn+OBruW5heOBqOmrmOOBlQoJaW50IHNob3RJbnRlcnZhbDsvL+W8vuOBrueZuuWwhOmWk+malOOCkuWItuW+oeOBmeOCi+OBn+OCgeOBruOCq+OCpuODs+OCv+ODvAp9OwoKY29uc3QgZmxvYXQgUEFJPTMuMTQxNTkyNjUzNTg5NzkzMjM4NDZmOy8vz4AKI2RlZmluZSBEZWdUb1JhZGlhbih4KSAoKGRvdWJsZSkoeCpQQUkvMTgwKSkKSElOU1RBTkNFIGhJbnN0Oy8v44Kk44Oz44K544K/44Oz44K544Gu44OP44Oz44OJ44OrCkhXTkQgaFduZDsvL+OCpuOCo+ODs+ODieOCpuOBruODj+ODs+ODieODqwpQbGF5ZXIgcGxheWVyOy8v6Ieq5qmfCgpIREMgaEJhY2tEQzsvL+ijj+eUu+mdoueUqOODh+ODkOOCpOOCueOCs+ODs+ODhuOCreOCueODiApIQklUTUFQIGhCYWNrQml0bWFwOy8v6KOP55S76Z2iCmludCBmcHM7CgpMUkVTVUxUIENBTExCQUNLIFduZFByb2MoSFdORCBoV25kLFVJTlQgdU1zZyxXUEFSQU0gd1BhcmFtLExQQVJBTSBsUGFyYW0pOwp2b2lkIEdhbWVJbml0KCk7Ly/liJ3mnJ/ljJYKdm9pZCBHYW1lRW5kKCk7Ly/ntYLkuoblh6bnkIYKdm9pZCBHYW1lTG9vcCgpOy8v44Ky44O844Og44Or44O844OXCnZvaWQgR2FtZURyYXcoKTsvL+aPj+eUu+WHpueQhgp2b2lkIFN0YWdlKCk7Ly/jgrnjg4bjg7zjgrjlh6bnkIbplqLpgKMKdm9pZCBNb3ZlUGxheWVyKCk7Ly/oh6rmqZ/np7vli5XnrYkKdm9pZCBEcmF3UGxheWVyKGNvbnN0IEhEQyAmaERDKTsvL+iHquapn+aPj+eUuwoKLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioKV2luZG935Yem55CG6Zai6YCjCioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiovCi8v44Km44Kj44Oz44OJ44Km44OX44Ot44K344O844K444OjCkxSRVNVTFQgQ0FMTEJBQ0sgV25kUHJvYyhIV05EIGhXbmQsCiAgICAgICAgICAgICAgICAgICAgICAgICBVSU5UIHVNc2csCiAgICAgICAgICAgICAgICAgICAgICAgICBXUEFSQU0gd1BhcmFtLAogICAgICAgICAgICAgICAgICAgICAgICAgTFBBUkFNIGxQYXJhbSkKewoJc3dpdGNoICh1TXNnKSAKCXsKCQljYXNlIFdNX0NMT1NFOi8v56qT44KS6ZaJ44GY44Gf44KJ6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uOCreOCueODiOmWi+aUvgp9CgovKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgrjgrnjg4bjg7zjgrjlh6bnkIbplqLpgKMKKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi8Kdm9pZCBTdGFnZSgpCnsKCn0KCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqCuiHquapn+WHpueQhumWoumAowoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqLwovL+iHquapn+enu+WLleetiQp2b2lkIE1vdmVQbGF5ZXIoKQp7CglSRUNUIHJjV25kOwoJR2V0Q2xpZW50UmVjdChoV25kLCZyY1duZCk7Ly/jgq/jg6njgqTjgqLjg7Pjg4jpoJjln5/jga7lpKfjgY3jgZXjgpLlj5blvpcKCS8v6Ieq5qmf56e75YuVCglpZihHZXRLZXlTdGF0ZShWS19MRUZUKSYweDgwMDApcGxheWVyLngtPTM7CS8v4oaQCgllbHNlIGlmKEdldEtleVN0YXRlKFZLX1JJR0hUKSYweDgwMDApcGxheWVyLngrPTM7CS8v4oaSCglpZihHZXRLZXlTdGF0ZShWS19VUCkmMHg4MDAwKXBsYXllci55LT0zOwkvL+KGkQoJZWxzZSBpZihHZXRLZXlTdGF0ZShWS19ET1dOKSYweDgwMDApcGxheWVyLnkrPTM7CS8v4oaTCgkvL+enu+WLleW+jOeUu+mdouerr+OCkui2iuOBiOOBquOBhOOCiOOBhuOBq+OBmeOCi+WHpueQhgoJaWYocGxheWVyLng8MClwbGF5ZXIueD0wOwoJZWxzZSBpZihwbGF5ZXIueD5yY1duZC5yaWdodC1wbGF5ZXIud2lkdGgpcGxheWVyLng9cmNXb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