Пример #1
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
	LPSTR lpCmdLine, int nCmdShow)
{
	Application app;
	

	ChangeWindowMode(TRUE),
	SetGraphMode(Application::m_windowWidth,Application::m_windowHeight, 32);
	SetDrawScreen(DX_SCREEN_BACK);
	

	if (DxLib_Init() == -1)    // DXライブラリ初期化処理
	{
		return -1;
	}
	
	//CreateConsoleWindow();
	while (ScreenFlip() == 0 && ProcessMessage() == 0 &&
		ClearDrawScreen() == 0)
	{
		app.AppMain();
	}
	

	DxLib_End();
	CloseConsoleWindow();
	return 0;        // ソフトの終了
}
Пример #2
0
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int){

	SetWindowText("Title");
	SetGraphMode(WINDOW_WIDTH , WINDOW_HEIGHT,32 );
	ChangeWindowMode(TRUE), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK );

	int LoadImage = LoadGraph("Natsuiro/BLOCK/load.png");
	DrawExtendGraph(0,0,WINDOW_WIDTH,WINDOW_HEIGHT, LoadImage ,false);
	ScreenFlip();
	
	SetTransColor(255,0,255);
	Awake();

	long long TIME = GetNowHiPerformanceCount();
#	if	BENCHMARK == TRUE
	long long int count = GetNowCount();
#	endif

	while( ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && !CheckHitKey(KEY_INPUT_ESCAPE) ){
		GameLoop();
		Sleep( (unsigned long)max( 16 - (int)( GetNowHiPerformanceCount() - TIME ) / 1000 , 0 ) );
		TIME = GetNowHiPerformanceCount();

#		if BENCHMARK == TRUE
		DrawFormatString(WINDOW_WIDTH-200,0,BLACK,"FPS %d (%dms)", (int)( 1000/( GetNowCount() - count ) ) , GetNowCount() - count );
		count = GetNowCount();
#		endif

	}
        
	DxLib_End();
	return 0;
} 
Пример #3
0
//! DxLib公式ページからコピペしただけです。
// プログラムは WinMain から始まります
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{

	//! ウィンドウモードで描画するように設定
	ChangeWindowMode(TRUE);

	//! ウィンドウサイズ、使用カラービット数の指定
	SetGraphMode(GameManager::WindowInformation::Width, GameManager::WindowInformation::Height, GameManager::WindowInformation::ColorBit);
	
	//! 描画先をバックバッファにする(後でScreenFlipによって表にする必要がある。)
	SetDrawScreen(DX_SCREEN_BACK);

	if (DxLib_Init() == -1)		// DXライブラリ初期化処理
	{
		return -1;			// エラーが起きたら直ちに終了
	}



	GameManager::GetInstance().Initialize();

	//メインループ
	while (ProcessMessage() == false && CheckHitKey(KEY_INPUT_ESCAPE) == FALSE)
	{

		GameManager::GetInstance().GameMainLoop();
	}


	DxLib_End();				// DXライブラリ使用の終了処理

	return 0;				// ソフトの終了 
}
Пример #4
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int CmdShow)
{
	ChangeWindowMode(TRUE);
	SetGraphMode(WINDOW_X, WINDOW_Y, 32);
	if (DxLib_Init() == -1)return -1;
	SetDrawScreen(DX_SCREEN_BACK);

	//�錾
	GameManager *gm = new GameManager(WINDOW_X, WINDOW_Y);

	while (ProcessMessage() != -1) {
		int startTime = GetNowCount();
		ScreenFlip();
		ClearDrawScreen();

		//����
		gm->All();

		if (CheckHitKey(KEY_INPUT_ESCAPE) == 1)break;
		int endTime = GetNowCount();
		WaitTimer((1000 / 60) - (endTime - startTime));
	}

	delete gm;
	DxLib_End();

	return 0;
}
Пример #5
0
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow )
{
#ifdef _DEBUG
	ChangeWindowMode( TRUE );			//ウィンドウ起動
#endif

	//フルスクリーンにするか
	/*int YN = MessageBox(NULL,"フルスクリーンで起動しますか?","ウィンドウサイズの設定",MB_YESNO);
	if(YN != IDYES )ChangeWindowMode(TRUE);*/

	//多重起動をできないようにする
	SetDoubleStartValidFlag(FALSE);

	SetGraphMode( 800 , 600 , 16 ) ;

	if( DxLib_Init() == -1 ){ return -1 ; }		// DXライブラリ初期化処理

	while( ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == FALSE)
	{
		//ゲームマネージャー
		GameManager* GameMain = new GameManager();
	
		//メイン
		GameMain->Menu();
		GameMain->Run();

		delete GameMain;
	}

	DxLib_End();		// DXライブラリ使用の終了処理

	return 0;		// ソフトの終了
}
Пример #6
0
int WINAPI WinMain(HINSTANCE,HINSTANCE,LPSTR,int){
	ChangeWindowMode(TRUE), DxLib_Init(), SetDrawScreen( DX_SCREEN_BACK ); //ウィンドウモード変更と初期化と裏画面設定
	SetGraphMode(512,512,16) ;//ディスプレイの大きさの設定

	SceneMgr sceneMgr;
    sceneMgr.Initialize();


	while( ScreenFlip()==0 && ProcessMessage()==0 && ClearDrawScreen()==0 && gpUpdateKey()==0 ){
        sceneMgr.Update();  //更新
        sceneMgr.Draw();    //描画
		fps();
		if(Keyboard_Get(KEY_INPUT_F1) == 1){
			debbattle = !debbattle;
		}
		if(debbattle){
		    DrawFormatString(0, 10,GetColor(255,255,255),"battle:true");
		}
		fpsc++;
	}

	sceneMgr.Finalize();
	DxLib_End();	// DXライブラリ終了処理
	return 0;
}
Пример #7
0
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) {

	SetMainWindowText( "LED ドットマトリックスカレンダー" );					// ウインドウタイトルの変更
    ChangeWindowMode( TRUE );							// ウィンドウモード
	SetGraphMode( 600, 540, 16 );						// ウィンドウサイズの変更
	SetOutApplicationLogValidFlag( false );				// ログを出力しない

	// DXライブラリの初期化
	if( DxLib_Init() == -1 ) {
		MessageBox(
			GetMainWindowHandle(),
			"DXライブラリの初期化に失敗しました。\nアプリケーションを終了します。",
			"エラーが発生しました",
			MB_OK + MB_ICONEXCLAMATION
			);
		return -1;
	}

	// 画面の描画先をリアバッファーに設定します。
	SetDrawScreen( DX_SCREEN_BACK );

	// ここから開始
	CalSystem cals;
	cals.CalMain();

	// DXライブラリ終了処理
	DxLib_End();

	return 0;
}
Пример #8
0
bool InitWindow(void){
	SetGraphMode(256,384,32);
	SetMainWindowText("Petitemu ver 0.10");
	ChangeWindowMode(TRUE);
	if(DxLib_Init()==-1)return false;
	return true;
}
Пример #9
0
// プログラムは WinMain から始まります
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	GameScene* mGameScene;		//ゲームシーンの作成 こいつが画面を見ている
	mGameScene = new GameScene;	//インスタンス生成 GameSceneのコンストラクタでタイトルシーンをを入れている
	
	SetGraphMode(640, 480, 16);	//画面の解像度
	ChangeWindowMode(TRUE);
	if (DxLib_Init() == -1)		// DXライブラリ初期化処理
	{
		return -1;			// エラーが起きたら直ちに終了
	}
	// 描画先画面を裏画面にセット
	SetDrawScreen(DX_SCREEN_BACK);
	// ループ
	while (ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0)
	{
		// 画面を初期化する
		ClearDrawScreen();

		//画面動作処理
		mGameScene->Update();

		//画面描画処理
		mGameScene->Draw();

		// 裏画面の内容を表画面に反映させる
		ScreenFlip();
	}
	DxLib_End();				// DXライブラリ使用の終了処理
	return 0;				// ソフトの終了 
}
Пример #10
0
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
	ShowConsole();



	ChangeWindowMode(true);

	SetGraphMode(288, 512, 32);


	SetDrawScreen(DX_SCREEN_BACK);
	if (DxLib_Init() == -1)
	{
		printf("DxLib起動失敗!!");
		return -1;
	}

	m_pSceneManager = new SceneManager(key);

	m_pSceneManager->load();
	m_pSceneManager->init();

	while (ScreenFlip() == 0 && ProcessMessage() == 0 && getupKey() == 0)
	{
		ClearDrawScreen();

		m_pSceneManager->updata();

		if (key[KEY_INPUT_ESCAPE] == 1)break;
	}

	delete m_pSceneManager;
	return DxLib_End();
}
Пример #11
0
void ChangeCallback(void* Data) {

	myGraphic::get().LoadAllGraph();
	//	mySound::get().LoadAllSound();
	SetGraphMode(ScreenSizeX, ScreenSizeY, 32);


}
Пример #12
0
//初期化
int init() {
	SetGraphMode(Winx, Winy, 32);//スクリーン
	ChangeWindowMode(TRUE);
	if (DxLib_Init() == -1)		/*DXライブラリ初期化処理*/ {
		return -1;	// エラーが起きたら直ちに終了
	}
	
	return 0;
}
Пример #13
0
void system_init()
{
    SetOutApplicationLogValidFlag(FALSE);

    SetGraphMode(640, 480, 16);
    ChangeWindowMode(true);
    SetWindowSizeExtendRate(1.5);

    SetMainWindowText("log_test");
}
Пример #14
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	SetWindowIconID(101);
	SetMainWindowText("Natasha");
	ChangeWindowMode(TRUE);
	SetGraphMode(ScreenWidth, ScreenHeight, 32);
	Func::setBackgroundColor0x(0x000000);
	SetOutApplicationLogValidFlag(FALSE);//logを生成しないように設定
	if (DxLib_Init() == 1){ return -1; }//初期化に失敗時にエラーを吐かせて終了

	Input::get();
	Screen::get();
	GameMgr::get().loadResource();
	GameMgr::get().loadButton();

	while( ProcessMessage() == 0)
	{
		GameMgr::get().update();

		ButtonAdder::addDValBoolButton("ToWhite");
		if (DVal::bool_["ToWhite"]){
			Screen::setWhiteOut(5);
			Screen::setShake(10);
			DVal::bool_["ToWhite"] = false;
		}

		if (Input::keyDown(KEY_INPUT_Z)){
			Screen::setWhiteOut(5);
			Screen::setShake(10);
		}

		if (Input::keyDown(KEY_INPUT_X)){
		}

		if (Input::keyDown(KEY_INPUT_C)){
		}

		Screen::DrawStart(); //描画開始, ClearScreen
		{
			GameMgr::get().draw();
			Draw.center(Input::mousePos(), Graph::handle("dot32"), 255);
		}
		Screen::DrawEnd(); //描画終了, ScreenFlip

		//フラグがtrueならゲーム終了
		if (gameEndFlag){
			break;
		}
	}


	DxLib_End();
	return 0;
}
Пример #15
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	SetOutApplicationLogValidFlag(FALSE);//Log.txtを生成しないように設定
	ChangeWindowMode(TRUE);//非全画面にセット
	SetGraphMode(SCREEN_WIDTH, SCREEN_HEIGHT, 32);//画面サイズ指定
	if (DxLib_Init() == 1) { return -1; }//初期化に失敗時にエラーを吐かせて終了
	SetDrawScreen(DX_SCREEN_BACK);//描画先を裏画面に


	fontHandle = CreateFontToHandle("Segoe UI", 20, 5, DX_FONTTYPE_ANTIALIASING_4X4);//フォントを読み込み

	std::vector<Enemy> vec;

	while (ProcessMessage() == 0)
	{
		ClearDrawScreen();//裏画面消す

		GetMousePoint(&mouseX, &mouseY); //マウス座標更新
		keyUpdate();//(自作関数)キー更新

		// Zキーが押されたらランダムな座標に敵を生成
		if (keyState[KEY_INPUT_Z] == 1) {
			vec.emplace_back(Enemy(GetRand(SCREEN_WIDTH), GetRand(SCREEN_HEIGHT))); // 敵をインスタンス化
		}

		// 画面外の敵を削除
		auto iter = vec.begin();
		while (iter != vec.end()) {
			if (iter->x < 0 || iter->x > SCREEN_WIDTH || iter->y < 0 || iter->y > SCREEN_HEIGHT) { //画面外に出ているか確認
				iter = vec.erase(iter);
			}
			else {
				iter++;
			}
		}

		for (auto i = vec.begin(); i < vec.end(); i++) {
			i->update();
		}
		for (auto i = vec.begin(); i < vec.end(); i++) {
			i->draw();
		}

		DrawFormatStringToHandle(20, 20, GetColor(255, 255, 255), fontHandle, "Zキーで敵を生成 敵の数:%d", vec.size());

		ScreenFlip();//裏画面を表画面にコピー
	}

	DxLib_End();
	return 0;
}
Пример #16
0
void ConfigureCommonScreen( void ) {
    //GetDefaultState( &screenSize_x, &screenSize_y, &screenColorDepthBit );
    screenSize_x = 1024;
    screenSize_y = 768;
    screenColorDepthBit = 32;

    captionLocation_x = screenSize_x / 2;
    captionLocation_y = screenSize_y / 15;

    SetGraphMode( screenSize_x, screenSize_y, screenColorDepthBit );

    ChangeWindowMode( TRUE );
    SetBackgroundColor( 0, 0, 0 );
}
Пример #17
0
int DX_Init(bool window_state,int& zx,int& zy,int& check){
  int zerox, zeroy, temp;

  SetGraphMode(Window_Spec::W_WIDTH, Window_Spec::W_HEIGHT, Window_Spec::W_COLOR);//ウィンドウサイズ変更
  ChangeWindowMode(window_state);//ウィンドウモード変更
  GetScreenState(&zerox, &zeroy, &temp);//画面のサイズを取得
  SetDrawScreen(DX_SCREEN_BACK);//描画を裏画面に設定

  if (DxLib_Init() == -1)		// DXライブラリ初期化処理
  {
    check = -1;// エラーが起きたら直ちに終了
  }

  zx = zerox / 2, zy = zeroy / 2;

  return zx, zy,check;
}
Пример #18
0
// WinMain関数
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
					 LPSTR lpCmdLine, int nCmdShow )
{
	ifstream ifs("../config/default.conf");

	int tmp;
	ifs >> PORT;
	ifs >> tmp;
	SERVER_IP.d1 = tmp;
	ifs >> tmp;
	SERVER_IP.d2 = tmp;
	ifs >> tmp;
	SERVER_IP.d3 = tmp;
	ifs >> tmp;
	SERVER_IP.d4 = tmp;
	ifs >> CLIENT_NUM;

  // 画面モードの設定
  ChangeWindowMode(true);
  SetGraphMode( WINDOW_WIDTH, WINDOW_HEIGHT, 16 ) ;

  // DXライブラリ初期化処理
  if( DxLib_Init() == -1 ) return -1;

  // グラフィックの描画先を裏画面にセット
  SetDrawScreen( DX_SCREEN_BACK );
  SetMainWindowText( "Bullet of the Chaos");

#ifdef SOLOPLAY_MODE
	soloplay_main();
#endif // SOLOPLAY_MODE
#ifdef NETWORK_SOLOPLAY_MODE
	network_soloplay_main();
#endif // NETWORK_SOLOPLAY_MODE
#ifdef SERVER_MODE
	server_main();
#endif // SERVER_MODE
#ifdef CLIENT_MODE
	client_main();
#endif // CLIENT_MODE

  DxLib_End();				// DXライブラリ使用の終了処理
  return 0;					// ソフトの終了
}
Пример #19
0
//*********************************************************
//	ゲームの初期化を行う
//*********************************************************
int GameInit(void)
{
	// Dxライブラリ初期化前の処理 
	SetGraphMode(WIN_W, WIN_H, 32);
	ChangeWindowMode(TRUE);		// ウィンドウモードで起動
	SetMainWindowText("テスト");	// ウィンドウタイトルを設定

	// Dxライブラリの初期化
	// エラーが起きたら直ちに終了
	if (DxLib_Init() == -1)	return	-1;

	// Dxライブラリ初期化後の処理 
	SetDrawScreen(DX_SCREEN_BACK);	// 描画先を裏画面にする
	SetTransColor(0, 255, 0);

	// ここまでゲーム固有の初期化
	// 正常終了
	return	0;
}
Пример #20
0
// プログラムは WinMain から始まります
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
	SetGraphMode(sugi::Csystem::SCREEN_WIDTH,sugi::Csystem::SCREEN_HEIGHT,32);
	ChangeWindowMode(TRUE);

	DxLib_Init();

	sugi::game_stage = sugi::Csystem::GAME_RESET;
	//描画は背面
	SetDrawScreen( DX_SCREEN_BACK ) ;
	SetLightEnable(1) ;
	GetJoypadNum();

	//ゲームのメインループ
	while(ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0 && CheckHitKey(PAD_INPUT_START) == 0)
	{
		ClearDrawScreen();
		switch (sugi::game_stage)
		{
		case sugi::Csystem::GAME_RESET:
			sugi::game_reset();
			break;
		case sugi::Csystem::GAME_TITLE:
			sugi::game_title();
			break;
		case sugi::Csystem::GAME_MAIN:
			sugi::game_main();
			break;
		case sugi::Csystem::GAME_RESULT:
			sugi::game_result();
			break;
		}

		DrawFormatString(0,0,0xffffff,"%2d",sugi::game_stage);
		ScreenFlip();

	}
	sugi::del_pointer();

	DxLib_End();

	return 0;
}
Пример #21
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	SetWindowIconID(101);
	SetMainWindowText("CRYSTAL WINGS");
	ChangeWindowMode(TRUE);
	SetGraphMode(ScreenWidth, ScreenHeight, 32);
	SetBackgroundColor(255, 255, 255);//背景白に設定
	SetOutApplicationLogValidFlag(FALSE);//logを生成しないように設定
	if (DxLib_Init() == 1){ return -1; }//初期化に失敗時にエラーを吐かせて終了

	Input::get();
	Screen::get();
	GameMgr::get().loadResource();


	while( ProcessMessage() == 0)
	{
		GameMgr::get().update();

#if DEBUG == 1
		if (Input::keydown(KEY_INPUT_A)){

		}
#endif

		Screen::DrawStart(); //描画開始, ClearScreen
		{
			GameMgr::get().draw();
			GameMgr::get().draw2();
		}
		Screen::DrawEnd(); //描画終了, ScreenFlip

		//フラグがtrueならゲーム終了
		if (mgr.gameEndFlag){
			break;
		}
	}


	DxLib_End();
	return 0;
}
Пример #22
0
int WINAPI WinMain(HINSTANCE hInstacne, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {

#ifndef _DEBUG
	SetOutApplicationLogValidFlag(false);
#endif

	// ウィンドウの初期化
	(strcmp(lpCmdLine, "-f") == 0) ? ChangeWindowMode(false) : ChangeWindowMode(true);
	SetGraphMode(640, 480, 16);
	SetWindowText("GF TETRIS");

	// DxLib 初期化処理
	if (DxLib_Init() == -1) {
		MessageBox(
			NULL,
			"初期化処理に失敗しました。DirectXがインストールされていない可能性があります。",
			"Init Error",
			MB_OK | MB_ICONERROR
			);
		return -1;
	}

	SetDrawScreen(DX_SCREEN_BACK);

	// 乱数初期化
	srand(time(0));

	// ゲームループ
	while (!ProcessMessage() && !ClearDrawScreen()) {

		// update
		Parent::getInstance()->update();

		// 裏画面から表画面に描画
		ScreenFlip();
	}

	DxLib_End();

	return 0;
}
Пример #23
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	SetOutApplicationLogValidFlag(FALSE);
	//SetUseDXArchiveFlag(TRUE);
	//SetDXArchiveExtension("dat");
	//if (MessageBox(NULL, "フルスクリーンで起動しますか?", "起動オプション", MB_YESNO) == IDYES){
	//ChangeWindowMode(0);
	//}
	//else{
	ChangeWindowMode(1);
	//}

	std::shared_ptr<SceneManager> mgr = std::make_shared<SceneManager>(Size(1280, 720));
	SetGraphMode(mgr->getWindowSize().width, mgr->getWindowSize().height, 16);
	SetDrawMode(DX_DRAWMODE_BILINEAR);
	SetWindowText("Looper Rooper");

	if (DxLib_Init() == -1) return -1;
	SetDrawScreen(DX_SCREEN_BACK);

	Resources::init();
	Input_T::initialize();

	while (1) {
		ClearDrawScreen();

		Input_T::update();
		mgr->update();
		ScreenFlip();

		if (ProcessMessage() == -1) break;
	}

	mgr->finalize();

	//#ifndef _DEBUG
	DxLib_End();
	//#endif
	return 0;
}
Пример #24
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	//細かい設定色々
	ChangeWindowMode(true);
	SetGraphMode(Window::Width, Window::Height, 32);
	SetWindowSizeChangeEnableFlag(TRUE);
	SetWindowSizeExtendRate(1.0);
	//背景の色替え
	//SetBackgroundColor(255, 255, 255);

	int ModelHandle;

	// DXライブラリ初期化処理(エラーが起きたら直ちに終了)
	if (DxLib_Init() == -1)		return -1;			

	//ウラ画面に描画する
	SetDrawScreen(DX_SCREEN_BACK);

	ModelHandle = MV1LoadModel("res/car04.mqo");	
	
	MV1SetPosition(ModelHandle, VGet(200.0f, -200.0f, 600.0f));

	//メインループ
	//whileの()にあるProcessMessageを消すと、正常に動かなくなる
	while (ProcessMessage() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0) {
		ClearDrawScreen();			//画面を消去する

		
		MV1DrawModel(ModelHandle);

		
		ScreenFlip();				//オモテ画面とウラ画面を入れ替える
	}

	//DXライブラリ使用の終了処理
	DxLib_End();

	//ソフトの終了 
	return 0;
}
Пример #25
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	//--------------------------------------------初期設定ここから
	SetGraphMode(WINDOW_SIZE_X, WINDOW_SIZE_Y, 32);
	SetBackgroundColor(0, 0, 0);
	SetMainWindowText("initializing...");
	SetWindowIconID(101);

	if (WINDOW_MODE == FALSE)
	{
		SetFullScreenResolutionMode(DX_FSRESOLUTIONMODE_DESKTOP);
	}
	else
	{
		ChangeWindowMode(true);
		SetWindowSize(1280, 720);
	}

	if (DxLib_Init() == -1)return -1;
	SetWindowSizeChangeEnableFlag(TRUE);
	SetDrawScreen(DX_SCREEN_BACK);
	SetOutApplicationLogValidFlag(FALSE);
	SetAlwaysRunFlag(TRUE);
	SetMainWindowText("指打");
	SetDrawMode(DX_DRAWMODE_BILINEAR);
	OutputDebugString("game start.\n");
	//--------------------------------------------初期設定ここまで

	//--------------------------------------------メインゲーム処理ここから
	system_control sys_ctrl;
	sys_ctrl.init();
	sys_ctrl.exec();
	//--------------------------------------------メインゲーム処理ここまで

	DxLib_End();
	OutputDebugString("game end.\n");
	return 0;
}
Пример #26
0
int DxLib_init()
{

	int ech = 0;

	if( SDLInitFlg != false) return -1;
	SDLInitFlg = true;	//フラグ立て

	SDL_Init(SDL_INIT_EVERYTHING);
	atexit( DxLib_End);
	
	/* フォント関連の処理 */
	ech = TTF_Init();
	if(ech == -1){
		return -1;
	}
	atexit( TTF_Quit);
	
	/* フォントの読み込み */
	font = TTF_OpenFont( "monospace", 24);
	//テスト!!
	//image = TTF_RenderUF8_Blended( font, "こんにちは", white);
	
	SetGraphMode( WindowWidth, WindowHeight, 0);
	
	/* 背景色を黒にする */
	SetBackgroundColor( 0, 0, 0);
	
	/* フルスクリーンモード切り替え */
	if( SDLFullScreenState == FALSE){
		ChangeWindowMode( TRUE );
	}
	
	/* メッセージ */
	printf("Initialize\n");	

	return ech;
}
Пример #27
0
void Render (Object *o) {
  int x,y;
  clock_t time;

  scene=o;
  SetGraphMode ();
  Observer=Vector (0.0,0.0,-2.0);
  clock ();
  for (y=0; y<ResY; y+=32) {
    for (x=0; x<ResX; x+=32) {
      Draw (x,y,32);
    }
  }
  time=clock ();  
  getch ();
  RestoreTextMode ();
  printf ("Rays Shooted=%d\n",RaysShooted);
  printf ("Pixels=%d\n",Pixels);
  printf ("Average RS/P=%f\n",double(RaysShooted)/double(Pixels));
  printf ("Seconds=%f\n",double(time)/double(CLOCKS_PER_SEC));
  printf ("Miliseconds per pixel=%f\n",double(time)/double(CLOCKS_PER_SEC)/
          double(Pixels)*1000.0);
}
Пример #28
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmaLine, int  nCmaShow)
{
	if (DxLib_Init() == -1)return -1;
	ChangeWindowMode(TRUE);
	SetDrawScreen(DX_SCREEN_BACK);
	SetGraphMode((int)Window::WIDTH, (int)Window::HEIGHT, GetColor(0, 0, 0));

	SceneManager sceneManager;
	int currentScene = (int)SceneID::NON;
	int nextScene = (int)SceneID::TITLE;
	
	char key[256];

	while (ScreenFlip() == 0 && ProcessMessage() == 0 && GetHitKeyStateAll(key) == 0)
	{
		ClearDrawScreen();

		if (nextScene != currentScene)
		{
			currentScene = nextScene;
			sceneManager.SetScene(currentScene);
		}

		sceneManager.Update();
		sceneManager.Draw();

		nextScene = sceneManager.SceneEnd();

		if (isPresskey(KEY_INPUT_ESCAPE))
		{
			DxLib_End();
		}
	}

	return 0;
}
Пример #29
0
/**
 * メイン関数
 */
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	#ifdef _DEBUG
		_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF);
	#endif


	//DXライブラリの初期化
	ChangeWindowMode(true);	//ウインドウモード
	SetGraphMode(800, 600, GetColorBitDepth() );
	if (DxLib_Init() == -1){	// DXライブラリ初期化処理
		return -1;				// エラーが起きたら直ちに終了
	}
	SetDrawScreen(DX_SCREEN_BACK);

	
	//アプリケーション初期化
	QuickStart application;
	application.initialize();
	
	//メインループ
	while(ProcessMessage() == 0 && ClearDrawScreen() == 0 && CheckHitKey(KEY_INPUT_ESCAPE) == 0){	//esc押しで終了
		application.update();	//ゲームの更新
		application.draw();		//ゲームの描画
		
		ScreenFlip();			//描画結果を画面に反映
		framerateControll();	//FPS調整
	}

	//プレイヤー終了処理
	application.finalize();


	DxLib_End();			// DXライブラリ使用の終了処理
	return 0;				// ソフトの終了 
}
Пример #30
0
int WINAPI WinMain( HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lpCmdLine , int nCmdShow )
{
	SetWindowIconID(101);
	SetMainWindowText("UNDEAD SISTER REBIRTH");
	ChangeWindowMode( TRUE );
	SetGraphMode( ScreenWidth , ScreenHeight , 32 );
	SetOutApplicationLogValidFlag( FALSE ) ;//logを生成しないように設定
	if(DxLib_Init() == 1){return -1;}//初期化に失敗時にエラーを吐かせて終了
	SetDrawScreen( DX_SCREEN_BACK ) ;

	Screen::get();
	Input::get().update();
	Graph::get();
	Sound::get();
	GraphDiv::get();
	Font::get();
	Draw::get();
	Datamgr::get();
	manager::get();
	

	while( ProcessMessage() == 0)
	{
		SetDrawScreen(DX_SCREEN_BACK);
		ClearDrawScreen();//裏画面消す
		Input::update();//キー更新・マウス座標更新・経過フレーム更新

		manager::get().update();
		manager::get().draw();

		if (Input::keydown(KEY_INPUT_ESCAPE)){
			Sound::stopall();
			manager::get().init();
			manager::get().gamestate_ = manager::pretitle;
		}

		//終了処理
		if (manager::get().gamestate_ == manager::exit){
			break;
		}

		/*
		//TODO デバッグ情報はstageにも有り

		//TODO デバッグ用
		//敵を生成
		if (Input::keydown(KEY_INPUT_X)){
			for (int i = -15; i < 15; i++){
				manager::get().enemy_.addmarge<emy_rot_l_tos>(i*0.2, -200);
			}
		}
		//敵を生成
		if (Input::keydown(KEY_INPUT_C)){
			for (int i = 0; i < 50; i++){
				manager::get().enemy_.add<emy_goleft>(512 + i * 20, 512);
			}
		}

		//TODO デバッグ用
		//武器を変更
		auto& w = manager::get().weapon_;
		for (int i = KEY_INPUT_1; i <= KEY_INPUT_6; i++){
			if (Input::keydown(i)){
				Sound::playback("menumove");
				if (Input::keynow(KEY_INPUT_LSHIFT)){
					w.sub = w.subvec[i - KEY_INPUT_1];
					for (auto& i : w.subvec){
						i->init();
					}
				}
				else{
					w.main = w.mainvec[i - KEY_INPUT_1];
					for (auto& i : w.mainvec){
						i->init();
					}
				}
			}
		}

		//TODO デバッグ用
		//Z押されている時にマウス座標描画
		if (Input::keynow(KEY_INPUT_Z)){
			SetDrawBlendMode(DX_BLENDMODE_ALPHA, 255);
			int stry = 300;
			Draw_::righttext(800, 300, 0xFFFFFF, Font::handle("SegoeUI20"), "MX:" + std::to_string(Input::mousex_()) + " MY:" + std::to_string(Input::mousey_()), 200);
			Draw_::righttext(800, 320, 0xFFFFFF, Font::handle("SegoeUI20"), "MX:" + std::to_string(Input::mousex()) + " MY:" + std::to_string(Input::mousey()), 200);
		}
		*/


		ScreenFlip();//裏画面を表画面にコピー
	}

	DxLib_End();
	return 0;
}