#include "DxLib.h"
#define WINDOW_WIDTH 640
#define WINDOW_HEIGHT 480
#define WINDOW_TEXT "RozenMaidenDuoDectet"
#define IMG_BACK "image\\Back.bmp"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
int GraphHandle, x = 0, y = 0;
SetMainWindowText(WINDOW_TEXT);
//ウィンドウモードに
ChangeWindowMode(TRUE);
//解像度、カラーモードを設定
SetGraphMode(WINDOW_WIDTH, WINDOW_HEIGHT, 32);
//開始時間を格納
int StartTime = GetNowCount();
if(DxLib_Init() == -1)
return false;
//バックバッファの設定
SetDrawScreen(DX_SCREEN_BACK);
GraphHandle = LoadGraph(IMG_BACK);
int NowTime= 0, LastTime = 0;
double FPS = 0;
//変形描画関連の変数
int graph_width = 640, graph_height = 480;
double zoom = 1;
while(1)
{
ClsDrawScreen();
clsDx();
NowTime = GetNowCount();
FPS = 1000/(NowTime-LastTime);
//printfDx("始まってからの時間 = %d\n",NowTime - StartTime) ;
//printfDx("1Fあたりの処理時間 = %d\n",NowTime - LastTime) ;
printfDx("FPS = %lf\n",FPS);
printfDx("zoom = %lf\n", zoom);
LastTime = NowTime;
if( CheckHitKey( KEY_INPUT_LEFT ) == 1 ) x -= 8 ;
if( CheckHitKey( KEY_INPUT_RIGHT ) == 1 ) x += 8 ;
if( CheckHitKey( KEY_INPUT_UP ) == 1 ) y -= 8 ;
if( CheckHitKey( KEY_INPUT_DOWN ) == 1 ) y += 8 ;
if( CheckHitKey( KEY_INPUT_Z ) == 1) zoom *= 1.02;
if( CheckHitKey( KEY_INPUT_X ) == 1) zoom *= 0.98;
if( CheckHitKey( KEY_INPUT_SPACE) == 1){
//位置を初期化
x = 0;
y = 0;
zoom =1;
}
//DrawGraph(x, y, GraphHandle, FALSE); // 画像描画
//DrawPixel( 320 , 240 , 0xffff ) ; // 点を打つ
//変形描画
DrawModiGraph(x, y, //左上の座標
x + graph_width * zoom, y, //右上
x + graph_width * zoom , y + graph_height * zoom, //右下
x, y + graph_height * zoom, //左下
GraphHandle, FALSE);
ScreenFlip(); // バッファをフリップ
WaitTimer(20);
if(ProcessMessage() == -1) break;
if(CheckHitKey( KEY_INPUT_ESCAPE) == 1) break;
}
//DXライブラリの終了
DxLib_End();
return 0 ; // ソフトの終了
}
最終更新:2008年11月04日 18:46