「ウィンドウ出して画像表示する」の編集履歴(バックアップ)一覧はこちら
「ウィンドウ出して画像表示する」(2008/11/04 (火) 04:17:45) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
//C++
#include "DxLib.h"
#define WINDOW_WIDTH 640
#define WINDOW_HEIGHT 480
#define WINDOW_TEXT "RozenMaidenDuoDectet"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
int GraphHandle, x = 0, y = 0;
SetMainWindowText(WINDOW_TEXT);
//Resouce.rcでID定義してます。
SetWindowIconID(101);
//ウィンドウモードに
ChangeWindowMode(TRUE);
//解像度、カラーモードを設定
SetGraphMode(WINDOW_WIDTH, WINDOW_HEIGHT, 32);
//開始時間を格納
int StartTime = GetNowCount();
if(DxLib_Init() == -1)
return false;
//バックバッファの設定
SetDrawScreen(DX_SCREEN_BACK);
GraphHandle = LoadGraph("image\\Menu.jpg");
int NowTime= 0, LastTime = 0;
double FPS = 0;
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);
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 ;
DrawGraph(x, y, GraphHandle, FALSE);
//DrawPixel( 320 , 240 , 0xffff ) ; // 点を打つ
ScreenFlip(); // バッファをフリップ
WaitTimer(20);
if(ProcessMessage() == -1) break;
if(CheckHitKey( KEY_INPUT_ESCAPE) == 1) break;
}
//DXライブラリの終了
DxLib_End();
return 0 ; // ソフトの終了
}
//C++
#include "DxLib.h"
#define WINDOW_WIDTH 640
#define WINDOW_HEIGHT 480
#define WINDOW_TEXT "RozenMaidenDuoDectet"
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("image\\Menu.jpg");
int NowTime= 0, LastTime = 0;
double FPS = 0;
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);
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 ;
DrawGraph(x, y, GraphHandle, FALSE);
//DrawPixel( 320 , 240 , 0xffff ) ; // 点を打つ
ScreenFlip(); // バッファをフリップ
WaitTimer(20);
if(ProcessMessage() == -1) break;
if(CheckHitKey( KEY_INPUT_ESCAPE) == 1) break;
}
//DXライブラリの終了
DxLib_End();
return 0 ; // ソフトの終了
}