예제 #1
0
void Window::DrawStringInWindow(int Input_x,int Input_y,int Input_Pos,string Input_String,int FontData,int Color)
{
	vector<string> Strs = split(Input_String,"<>");
	int Height;
	GetFontStateToHandle(NULL,&Height,NULL,FontData);
	Height *= 1.4;
	int Length = Strs.size();
	int Draw_y = Input_y-Height;
	for(int i=0;i<Length;i++)
	{
		int Graph;
		int Draw_x = Input_x;
		Draw_y += Height;
		int DrawWidth = GetDrawStringWidthToHandle(Strs[i].c_str(),Strs[i].size(),FontData);
		int Size;
		float Ext = 1.0f;
		if(Input_Pos == DrawString_Center)Draw_x -= DrawWidth/2;
		else if(Input_Pos == DrawString_Right)Draw_x -= DrawWidth;
		GetFontStateToHandle(0,&Size,0,FontData);
		Graph = MakeScreen(DrawWidth,Size*2,true);
		SetDrawScreen(Graph);
		DrawStringToHandle(0,0,Strs[i].c_str(),Color,FontData);

		if(DrawWidth + Draw_x >= Width)
		{
			Ext = (float)Width / (float)(DrawWidth  + Draw_x) - 0.01f;
		}

		SetDrawScreen(Screen);
		DrawRotaGraph2(Draw_x,Draw_y,0,0,Ext,0.f,Graph,true);
		DeleteGraph(Graph);
	}
	SetDrawScreen(DX_SCREEN_BACK);
}
예제 #2
0
void GraphHue::LoadToMap(std::string name){
	std::string loadname = "ImagesHue/" + name;
	HandleArray hArray;
	int tmp_handle = LoadGraph(loadname.c_str());
	int sizeX, sizeY;
	GetGraphSize(tmp_handle, &sizeX, &sizeY);
	for (int i = 0; i < colorNum; i++){
		hArray.arr[i] = MakeScreen(sizeX, sizeY, TRUE);
		SetDrawScreen(hArray.arr[i]);
		int hue = i * 360 / colorNum;
		SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
		Func::SetDrawBrightHSV(hue, 140, 255);
		//5回描画することで半透明の黒っぽい部分を消す
		for (int i = 0; i < 5; i++){
			DrawGraph(0, 0, tmp_handle, TRUE);
		}
	}
	SetDrawBright(255, 255, 255);

	std::vector<std::string> extensionList = { ".png", ".jpg" };
	for (auto &i : extensionList){
		Func::strReplace(name, i, "");
	}

	handlemap.emplace(name, hArray);
}
예제 #3
0
파일: Texture.hpp 프로젝트: tenonno/dxlib-2
	/// <summary> 回転した画像を複製します </summary>
	Texture copyRotate(const double radian)
	{

		auto size = getSize();

		dxlib_handle texture = MakeScreen(size.width, size.height, true);

		SwapScreen::Begin(texture);

		DrawRotaGraph(size.width *0.5, size.height*0.5, 1, radian, handle, true);


		SwapScreen::End();
		return Texture(texture);
	}
예제 #4
0
파일: Texture.hpp 프로젝트: tenonno/dxlib-2
	/// <summary> 画像を 3D で扱えるように修正します </summary>
	Texture &use3D(bool alpha = true) {


		uint32 width = getSize().width, height = getSize().height;

		uint32 size = std::max(width, height);


		// そのままでもいい場合
		if (width == height && size >= 8 && (size - 1 & size))
		{
			return *this;
		}



		int count = 3;


		while (true)
		{

			uint32 _ = static_cast<uint32>(std::pow(2, count++));

			if (_ >= size)
			{
				size = _ < 8 ? 8 : _;
				break;
			}

		}




		dxlib_handle screen = MakeScreen(size, size, alpha);

		SetDrawScreen(screen);

		DrawExtendGraph(0, 0, size, size, handle, alpha);



		DeleteGraph(handle);


		return *this = Texture(screen);
	}
예제 #5
0
파일: display.c 프로젝트: argasek/morphine
void DisplaySwap() {
  struct Custom *custom = (PtrT)0xdff000;

  Display->Screen->ViewPort.RasInfo->BitMap = GetCurrentBitMap();
  Display->CurrentBitMap ^= 1;
  Display->Screen->RastPort.BitMap = GetCurrentBitMap();

  MakeScreen(Display->Screen);
  RethinkDisplay();
  custom->dmacon = BITCLR|DMAF_SPRITE;

  if (Display->PaletteToSet) {
    SetPalette(Display->PaletteToSet);
    Display->PaletteToSet = NULL;
  }
}
예제 #6
0
파일: Texture.hpp 프로젝트: tenonno/dxlib-2
	/// <summary> 反転した画像を複製します </summary>
	Texture copyMirror()
	{

		auto size = getSize();

		dxlib_handle texture = MakeScreen(size.width, size.height, true);

		SwapScreen::Begin(texture);


		DrawTurnGraph(0, 0, handle, true);


		SwapScreen::End();
		return Texture(texture);
	}
예제 #7
0
/// 影つけ用の深度マップを焼き付ける画像を初期化
static int create_depthmap_buffer()
{
	int saved1 = GetDrawValidFloatTypeGraphCreateFlag();
	int saved2 = GetCreateDrawValidGraphChannelNum();
	int saved3 = GetCreateGraphColorBitDepth();

	SetDrawValidFloatTypeGraphCreateFlag(TRUE);
	SetCreateDrawValidGraphChannelNum(1);
	SetCreateGraphColorBitDepth(16);

	int id = MakeScreen(8192, 8192, FALSE);

	SetDrawValidFloatTypeGraphCreateFlag(saved1);
	SetCreateDrawValidGraphChannelNum(saved2);
	SetCreateGraphColorBitDepth(saved3);

	return id;
}
예제 #8
0
파일: Texture.hpp 프로젝트: tenonno/dxlib-2
	void resize(const uint32 width, const uint32 height)
	{
		dxlib_handle screen = MakeScreen(width, height, true);



		auto _ = GetDrawScreen();


		SetDrawScreen(screen);

		DrawExtendGraph(0, 0, width, height, handle, true);

		SetDrawScreen(_);


		DeleteGraph(handle);

		handle = screen;

	}
예제 #9
0
void Window::Initialize(double Input_x,double Input_y,int Input_Width,int Input_Height,int Input_EdgeColor,int Input_PanelColor)
{
	x = Input_x;
	y = Input_y;
	Ext = 1.0;
	Angle = 0.0;
	Width = Input_Width;
	Height = Input_Height;
	PanelColor = Input_PanelColor;
	EdgeColor = Input_EdgeColor;
	//DeleteGraph(Screen);
	Screen = MakeScreen(Width,Height,true);
	Visible = true;

	SetDrawScreen(Screen);
	DrawBox(0,0,Width,Height,GetColor(255,255,255),true);
	SetDrawBlendMode( DX_BLENDMODE_ALPHA, 128);
	DrawBox(0,0,Width,Height,PanelColor,true);
	SetDrawBlendMode( DX_BLENDMODE_ALPHA, 256);
	DrawBox(0,0,Width,Height,EdgeColor,false);
	SetDrawScreen(DX_SCREEN_BACK);
}
예제 #10
0
void Environment_Screen_PrevPage(void)
{
	switch(Environment_Screen.Page)
	{
		case	PAGE_SIGNALLING:
				Environment_Screen.Page=PAGE_PERFORMANCE_MONITORING;
				break;

		case	PAGE_ALARMS:
				Environment_Screen.Page=PAGE_SIGNALLING;
				break;

		case	PAGE_PERFORMANCE_MONITORING:
				Environment_Screen.Page=PAGE_ALARMS;
				break;

		default:
				Environment_Screen.Page=PAGE_SIGNALLING;
				break;
	}

	MakeScreen();
}
예제 #11
0
// ステージの初期化処理
void Stage_Initialize( void )
{
	// ステージモデルの読み込み
	stg.ModelHandle = MV1LoadModel( "ColTestStage.mqo" ) ;

	// モデル全体のコリジョン情報のセットアップ
	MV1SetupCollInfo( stg.ModelHandle, -1 ) ;


	// 作成する画像のフォーマットを不動小数点型で1チャンネル、16ビットにする
	SetDrawValidFloatTypeGraphCreateFlag( TRUE ) ;
	SetCreateDrawValidGraphChannelNum( 1 ) ;
	SetCreateGraphColorBitDepth( 16 ) ;

	// 影用深度記録画像の作成
	DepthBufferGraphHandle = MakeScreen( 4096, 4096, FALSE ) ;

	// 設定を元に戻す
	SetDrawValidFloatTypeGraphCreateFlag( FALSE ) ;
	SetCreateDrawValidGraphChannelNum( 4 ) ;
	SetCreateGraphColorBitDepth( 32 ) ;

	// 深度記録画像描画用の頂点シェーダーを読み込む
	Skin4_DepthShadow_Step1_VertexShader = LoadVertexShader( "SkinMesh4_DepthShadow_Step1VS.vso" ) ;
	Normal_DepthShadow_Step1_VertexShader = LoadVertexShader( "NormalMesh_DepthShadow_Step1VS.vso" ) ;

	// 深度記録画像描画用のピクセルシェーダーを読み込む
	DepthShadow_Step1_PixelShader = LoadPixelShader( "DepthShadow_Step1PS.pso" ) ;

	// 深度記録画像を使ったディレクショナルライト一つの描画用頂点シェーダーを読み込む
	Skin4_DirLight_DepthShadow_Step2_VertexShader = LoadVertexShader( "SkinMesh4_DirLight_DepthShadow_Step2VS.vso" ) ;
	Normal_DirLight_DepthShadow_Step2_VertexShader = LoadVertexShader( "NormalMesh_DirLight_DepthShadow_Step2VS.vso" ) ;

	// 深度記録画像を使ったディレクショナルライト一つの描画用ピクセルシェーダーを読み込む
	DirLight_DepthShadow_Step2_PixelShader = LoadPixelShader( "DirLight_DepthShadow_Step2PS.pso" ) ;
}
예제 #12
0
void Environment_Screen_Refresh(void)
{
	MakeScreen();
}
예제 #13
0
int main(int argc, char **argv) {
#ifdef DXPORTLIB
    SetUseCharSet(DX_CHARSET_EXT_UTF8);
#endif
    
    SetWindowText(_T("DxPortLib Test App"));
    SetWindowSizeChangeEnableFlag(TRUE);
    
    SetGraphMode(640, 480, 32);
    ChangeWindowMode(TRUE);
    
    if (DxLib_Init() == -1) {
        return -1;
    }
    
    SRand(0);
    InitBounceThings();
    
    int isWindowed = TRUE;
    int wasPressed = 0;
    int timerDelta = 0;
    int timeLast = GetNowCount();
    int screenshotWasPressed = 0;
    int drawScreen = MakeScreen(640, 480, FALSE);
    
    while (ProcessMessage() == 0
#ifndef DX_NON_INPUT
        && CheckHitKey(KEY_INPUT_ESCAPE) == 0
#endif
    ) {
        /* If Alt+Enter is pressed, flip to fullscreen mode. */
        if (CheckHitKey(KEY_INPUT_RETURN)
            && (CheckHitKey(KEY_INPUT_LALT) || CheckHitKey(KEY_INPUT_RALT))
        ) {
            if (wasPressed == 0) {
                isWindowed = 1 - isWindowed;
                ChangeWindowMode(isWindowed);
            }
            wasPressed = 1;
        } else {
            wasPressed = 0;
        }
        
        /* Game logic here */
        MoveBounceThings();
        
        /* Draw logic here */
        SetDrawScreen(drawScreen);
        SetDrawBright(255, 255, 255);
        SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
        DrawFillBox(0, 0, 640, 480, 0xFF000000);
        DrawLineBox(10, 10, 630, 470, 0xFFFFFFFF);
        SetDrawBlendMode(DX_BLENDMODE_ALPHA, 128);
        DrawFillBox(20, 20, 620, 460, GetColor(0x90, 0x80, 0x70));
        
        DrawBounceThings();
        
        if (CheckHitKey(KEY_INPUT_S)) {
            if (screenshotWasPressed == 0) {
                SaveDrawScreenToPNG(0, 0, 640, 480, _T("test_draw_screenshot.png"));
                screenshotWasPressed = 1;
            }
        } else {
            screenshotWasPressed = 0;
        }
        
        SetDrawScreen(DX_SCREEN_BACK);
        DrawGraph(0, 0, drawScreen, FALSE);
        
        ScreenFlip();

        /* Time to next frame automatically... */
        int newTime = GetNowCount();
        timerDelta += newTime - timeLast;
        timeLast = newTime;

        int n = timerDelta;
        if (n > 16) {
            n = 16;
        }
        timerDelta -= n;

        WaitTimer(16 - n);
    }
    
    DxLib_End();
    
    return 0;
}
예제 #14
0
파일: main.cpp 프로젝트: hrucyon/CometClash
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	SetWindowIconID(IDI_ICON1);
	SetMainWindowText(titlebar),ChangeWindowMode(TRUE), SetGraphMode(WIDTH, HEIGHT, 32),
		DxLib_Init(),SetDrawScreen(DX_SCREEN_BACK);
	//ウィンドウモード、960*720のサイズ

	//画像の読み込み
	GraphicHandle[0] = LoadGraph("image/Title.png");
	GraphicHandle[1] = LoadGraph("image/Player.png");
	GraphicHandle[2] = LoadGraph("image/Comet.png");
	GraphicHandle[3] = LoadGraph("image/Backscreen.png");
	GraphicHandle[4] = LoadGraph("image/Clearscreen.png");
	GraphicHandle[5] = LoadGraph("image/Sf_title.png");
	GraphicHandle[6] = LoadGraph("image/Buttun_on.png");
	GraphicHandle[7] = LoadGraph("image/Buttun_off.png");
	GraphicHandle[8] = LoadGraph("image/Ready.png");
	GraphicHandle[9] = LoadGraph("image/Start.png");
	GraphicHandle[10] = MakeScreen(1024, 1024, false);
	GraphicHandle[11] = LoadGraph("image/Ranking.png");
	GraphicHandle[12] = LoadGraph("image/Pause.png");

	//音楽の読み込み
	SoundHandle[0] = LoadSoundMem("music/bgm.mp3");
	SoundHandle[1] = LoadSoundMem("music/select.mp3");
	SoundHandle[2] = LoadSoundMem("music/deside.mp3");
	SoundHandle[3] = LoadSoundMem("music/miss.mp3");
	SoundHandle[4] = LoadSoundMem("music/gameover.mp3");

	GScoreFont = CreateFontToHandle("Meiryo UI Bold", 20, -1);
	RScoreFont = CreateFontToHandle("Meiryo UI Bold", 32, -1);
	CScoreFont = CreateFontToHandle("Meiryo UI Bold", 64, -1);
	ChangeFont("Meiryo UI Bold"); //フォントの変更

	Title_Initialize();		//タイトルの初期化処理
	Game_Initialize();		//ゲームの初期化処理
	Clear_Initialize();		//クリア画面の初期化処理
	Rank_Initialize();		//ランキング画面の初期化処理
	Logo_Initialize();

	while (Loop() == true)
	{
		Keyboard_Update();
		GamePad_Update();

		switch (NowScene())
		{	//現在のシーンによって動作を変える
		case logo:
			Logo_Update();
			break;

		case title:
			Title_Update();
			Title_Draw();
			break;

		case gamepre:
			Game_Initialize();
			ChangeScene(game);

		case game:
			Game_Update();
			Game_Draw();
			break;

		case clear:
			Clear_Update();
			Clear_Draw();
			break;

		}
	}

	Title_Finalize();		//タイトルの終了処理
	Game_Finalize();		//ゲームの終了処理
	Clear_Finalize();		//クリア画面の終了処理
	Rank_Finalize();		//ランキング画面の終了処理
	Logo_Finalize();		//ロゴ画面の終了処理

	DxLib_End();				// DXライブラリ使用の終了処理
	return 0;
}
예제 #15
0
bool Game_TempData::Initialize(){
	hBGHandle = MakeScreen(WND_WIDTH, WND_HEIGHT, 0);
	return true;
}