Ejemplo n.º 1
0
int CVariable::SettingVariable()
{
	DebugText("SetVariable...");
	Totalmax=ADD_MAX_VARIABLE;
	Max=-1;
	variable=(_Variable*)malloc(sizeof(_Variable) *Totalmax);
	DebugText("OK!\n");
	return 0;
}
Ejemplo n.º 2
0
void Platform_Win32_Screen::Present(unsigned int* bitmapData, int bitmapWidth, int bitmapHeight, unsigned int modulate, unsigned int backgroundColor)
	{
	if (!firstTimeInitializeCalled_)
		{
		FirstTimeInitialize();
		firstTimeInitializeCalled_=true;
		}

	if (!technologyInstance_)
		{
		return;
		}

	// Framerate counter
	if (showfps_ && Platform::GetPlatform_Time())
		{

		static float previousTime=Platform::GetPlatform_Time()->GetTime();
		static float accumulatedTime=0;
		static int currentFrameCount=0;
		static int frames=0;
		float newTime=Platform::GetPlatform_Time()->GetTime();
		float deltaTime=newTime-previousTime;
		accumulatedTime+=deltaTime;
		frames++;
		if (accumulatedTime>=1)
			{
			accumulatedTime-=1;
			currentFrameCount=frames;
			frames=0;
			}
		previousTime=newTime;
		static char fps[20];
		_snprintf(fps,20,"%02d",currentFrameCount);
		unsigned int color=0xffffffff; // White
		if (technology_==Technology_DDraw)
			{
			color=0xffff00ff; // Magenta
			}
		if (technology_==Technology_GDI)
			{
			color=0xff00ffff; // Cyan
			}
		DebugText(bitmapData,bitmapWidth,bitmapHeight,6,6,fps,0);
		DebugText(bitmapData,bitmapWidth,bitmapHeight,5,5,fps,color);

		}


	bool result=technologyInstance_->Present(bitmapData,bitmapWidth,bitmapHeight,modulate,backgroundColor);
	if (!result)
		{
		DowngradeTechnology();
		Present(bitmapData,bitmapWidth,bitmapHeight,modulate,backgroundColor);
		}
	}
Ejemplo n.º 3
0
int CVariable::DeleteVariable_all()
{
	DebugText("AllDeleteVariable...");
	for(int i=0;i<=Max;i++)
	{
		DeleteVariable(i);
	}
	Max=-1;
	DebugText("OK!\n");
	return 0;
}
Ejemplo n.º 4
0
int CVariable::AddVariable_bool(bool *body, char *name)
{
	DebugText("ResistVariable(name=>%s,body=>%d)...",name,body);
	Add_Variable();
	strcpy(variable[Max].name,name);
	variable[Max].type=4;
	variable[Max].bool_data=new bool;
	variable[Max].bool_data=body;
	DebugText("OK!\n");
	return 0;
}
Ejemplo n.º 5
0
int CVariable::AddVariable_float(float *body, char *name)
{
	DebugText("ResistVariable(name=>%s,body=>%lf)...",name,body);
	Add_Variable();
	strcpy(variable[Max].name,name);
	variable[Max].type=3;
	variable[Max].float_data=new float;
	variable[Max].float_data=body;
	DebugText("OK!\n");
	return 0;
}
Ejemplo n.º 6
0
int CVariable::AddVariable_char(char *body,int char_len,char *name)
{
	DebugText("ResistVariable(name=>%s,body=>%s)...",name,body);
	Add_Variable();
	strcpy(variable[Max].name,name);
	variable[Max].type=2;
	variable[Max].char_data=new char[char_len];
	strcpy(variable[Max].char_data,body);
	DebugText("OK!\n");
	return 0;
}
Ejemplo n.º 7
0
int CVariable::AddVariable_int(int *body, char *name)
{
	DebugText("ResistVariable(name=>%s,body=>%d)...",name,body);

	Add_Variable();
	strcpy(variable[Max].name,name);
	variable[Max].type=1;
	variable[Max].int_data=new int;
	variable[Max].int_data=body;
	DebugText("OK!\n");
	return 0;
}
Ejemplo n.º 8
0
int CVariable::DeleteVariable(int num)
{
	DebugText("DeleteVariable(num=%d)\n",num);

	switch(variable[num].type)
	{
	case 0:
		//error
		return -1;
		break;
	case 1:
		//int
		free(variable[num].int_data);
		break;
	case 2:
		free(variable[num].char_data);
		break;
	case 3:
		free(variable[num].float_data);
		break;
	case 4:
		free(variable[num].bool_data);
		break;
	}
	Max--;
	if(Max<(Totalmax-ADD_MAX_VARIABLE))
	{
		//最大数を超えた
		Totalmax-=ADD_MAX_VARIABLE;
		variable=(_Variable*)realloc(variable,sizeof(_Variable)*Totalmax);
	}
	return 0;
}
Ejemplo n.º 9
0
//-------------------------------------------------------------
//フォントオブジェクト設定
//-------------------------------------------------------------
int Ctext::SetTextFont(int Size,int Angle,int Thickness,bool Oblique,bool Under,bool Cancellation,char FontNAME[] )
{
	DebugText("Set TextFont(fontname:%s)...",FontNAME);
	Max++;
	if(Max>=Totalmax)
	{
		//最大数を超えた
		Totalmax+=ADD_MAX_FONT;
		ManagementNum=(int*)realloc(ManagementNum,sizeof(int) *Totalmax);
		lpFont=(LPD3DXFONT*)realloc(lpFont,sizeof(LPD3DXFONT) *Totalmax);
		size=(int*)realloc(size,sizeof(int) *Totalmax);
	}
	HFONT hFont;
	int error;
	hFont=CreateFont(
		Size,              // 高さ
		0,               // 幅
		Angle,          // 文字送り方向の角度
		0,         // ベースラインの角度
		Thickness,             // 太さ
		Oblique,          // 斜体かどうか
		Under,       // 下線を引くかどうか
		Cancellation,       // 取り消し線を引くかどうか
		DEFAULT_CHARSET,         // 文字セット
		OUT_DEFAULT_PRECIS, // 出力精度
		CLIP_DEFAULT_PRECIS,   // クリッピング精度
		PROOF_QUALITY,         // 出力品質
		FIXED_PITCH | FF_MODERN,  // ピッチとファミリ
		FontNAME         // フォント名
	);
	size[Max]=Size;
   error=D3DXCreateFont(*pD3DDevice,hFont,&lpFont[Max]) ;
    
	if(error==D3DERR_INVALIDCALL)
	{
		//パラメーターミス
	}
	else if(error==E_OUTOFMEMORY)
	{
		//メモリの確保失敗
	}
	DeleteObject(hFont);
	ManagementNum[Max]=~Max;
	DebugText("OK!\n");
	return ManagementNum[Max];
}
Ejemplo n.º 10
0
_ReturnVariabledata CVariable::SearchVariable(char *name)
{
	DebugText("SearchVariable(Name=%s)...",name);
	_ReturnVariabledata temp_a;
	for(int i=0;i<=Max;i++)
	{
		if(strcmp(variable[i].name,name)==0)
		{
			temp_a.num=i;
			temp_a.type=variable[i].type;
			return temp_a;
		}
	}
	temp_a.num=-1;
	DebugText("OK!\n");

	return temp_a;
}
Ejemplo n.º 11
0
int Ctext::DeleteTextFont_All(void)
{
	DebugText("AllDelete TextFont...");
for(int count=0;count<Max;count++)
	{

		lpFont[count]->Release();
		
	}

	Totalmax=ADD_MAX_FONT;
	ManagementNum=(int*)realloc(ManagementNum,sizeof(int) *Totalmax);
	lpFont=(LPD3DXFONT*)realloc(lpFont,sizeof(LPD3DXFONT) *Totalmax);
	size=(int*)realloc(size,sizeof(int) *Totalmax);
			
	Max=-1;
	DebugText("OK!\n");
	return 0;
}
Ejemplo n.º 12
0
LightObject::LightObject(Object *o) : Object(o)
{
	l = 0;
	cout << "LightObjectC(2)" << endl;
	LightObject *lo = CastTo<LightObject>(o);
	if (lo != NULL)
	{
		cout << "Notice:::: lo != NULL !! ??? " << endl;
		this->l = lo->l;
	}
	DebugText(EMSG, "l ==== 0x%x", l);
	if (l == 0)
	{
		l = new Light(255, 255, 255);
		lightManager.addLight(l);
		DebugText(EMSG, "------(2)Created light: 0x%x", l);
	}
	l->setStatic(true);
	//l->relative = true;
}
Ejemplo n.º 13
0
LightObject::LightObject(string newName) : Object(newName)
{
	cout << "LightObjectC(1)" << endl;
	l = new Light(255, 255, 255);
	lightManager.addLight(l);
	DebugText(EMSG, "(1)Created light: 0x%x", l);
//	l->relative = true;
//	red = 255;
//	blue = 255;
//	green = 255;
}
Ejemplo n.º 14
0
int Ctext::DeleteTextFont_At(int num)
{
	DebugText("Delete TextFont...");
		int count=~num;

		lpFont[count]->Release();
		for(int i=count;i<Max;i++)
		{
			lpFont[i]=lpFont[i+1];
		}
		Max--;

		if(Max<(Totalmax-ADD_MAX_FONT))
		{
			//最大数を超えた
			Totalmax-=ADD_MAX_FONT;
			ManagementNum=(int*)realloc(ManagementNum,sizeof(int) *Totalmax);
			lpFont=(LPD3DXFONT*)realloc(lpFont,sizeof(LPD3DXFONT) *Totalmax);
			size=(int*)realloc(size,sizeof(int) *Totalmax);
		}
		DebugText("OK!\n");
		return 0;

}
Ejemplo n.º 15
0
int Cvorbis::Load_ogg(char szName[])
{
	DebugText("Open the 'OGG' File(FILE=>NAME:%s)...",szName);
	// ファイルを開く
	FILE *lpFile = fopen( szName, "rb" );
	if( lpFile == NULL )  return -1;

	// OggVorbisのファイル情報を取得
	if( ov_open( lpFile, &vf, NULL, 0 ) < 0 )
	{
	  fclose( lpFile );
	  return -1;
	}

	// OggVorbisの情報を取得
	vi = ov_info( &vf, -1 );
	if( vi == NULL )
	{
	  ov_clear( &vf );
	  return -1;
	}
	DebugText("...");
	//サイズの計算
	lWHSize = sizeof(wh.cRIFF)    + sizeof(wh.iSizeRIFF) +
				   sizeof(wh.cType)    + sizeof(wh.cFmt)      +
				   sizeof(wh.iSizeFmt) + sizeof(wh.WaveFmt)   +
				   sizeof(wh.cData)    + sizeof(wh.iSizeData);


	INT iWord = 2;  // 量子化バイト数(1 or 2)

	LONG  lDataSize = (LONG)ceil( 
	  vi->channels * vi->rate * ov_time_total( &vf,-1 ) * iWord 
	);

	lpWaveData = new CHAR[ lDataSize + lWHSize ];
	if( lpWaveData == NULL )
	{
	  ov_clear( &vf );
	  return -1;
	}
	INT  iCurrentSection;
	
	lReadSize = 0;
	while( 1 )
	{
	  // デコード
	  lWriteSize = ov_read( &vf, lpWaveData + lReadSize + lWHSize,
							lDataSize - lReadSize, 0, iWord, 1,
							&iCurrentSection );
		DebugText("...");
	  // デコード終了
	  if( ! lWriteSize )
	  {
		break;
	  }
	 
	  // エラー
	  else if ( lWriteSize < 0 )
	  {
		/* #define SAFE_RELEASE(p) if(p){p->Release();p=NULL;} */
		SAFE_DELETE( lpWaveData );
		ov_clear( &vf );
		DebugText("FAILD\n");
		return FALSE;
	  }

	  // 全てデコードできなかった
	  else
	  {
		lReadSize += lWriteSize;
	  }
	}

	
	// ヘッダの初期化
	memcpy( wh.cRIFF, "RIFF", 4 );
	wh.iSizeRIFF = lWHSize + lReadSize - 8;
	memcpy( wh.cType, "WAVE", 4 );
	memcpy( wh.cFmt, "fmt ", 4 );
	wh.iSizeFmt = sizeof(WAVEFORMATEX);
	wh.WaveFmt.cbSize          = sizeof(WAVEFORMATEX);
	wh.WaveFmt.wFormatTag      = WAVE_FORMAT_PCM;
	wh.WaveFmt.nChannels       = vi->channels;
	wh.WaveFmt.nSamplesPerSec  = vi->rate;
	wh.WaveFmt.nAvgBytesPerSec = vi->rate * vi->channels * iWord;
	wh.WaveFmt.nBlockAlign     = vi->channels * iWord;
	wh.WaveFmt.wBitsPerSample  = iWord * 8;
	memcpy( wh.cData, "data", 4 );
	wh.iSizeData = lReadSize;

	// メモリ上のヘッダの書き込み
	int iSize = 0;
	memcpy((char*)*lpWaveData,         &wh.cRIFF,     sizeof(wh.cRIFF));
	iSize += sizeof(wh.cRIFF);
	memcpy((char*)*lpWaveData + iSize, &wh.iSizeRIFF, sizeof(wh.iSizeRIFF));
	iSize += sizeof(wh.iSizeRIFF);
	memcpy((char*)*lpWaveData + iSize, &wh.cType,     sizeof(wh.cType));
	iSize += sizeof(wh.cType);
	memcpy((char*)*lpWaveData + iSize, &wh.cFmt,      sizeof(wh.cFmt));
	iSize += sizeof(wh.cFmt);
	memcpy((char*)*lpWaveData + iSize, &wh.iSizeFmt,  sizeof(wh.iSizeFmt));
	iSize += sizeof(wh.iSizeFmt);
	memcpy((char*)*lpWaveData + iSize, &wh.WaveFmt,   sizeof(wh.WaveFmt));
	iSize += sizeof(wh.WaveFmt);
	memcpy((char*)*lpWaveData + iSize, &wh.cData,     sizeof(wh.cData));
	iSize += sizeof(wh.cData);
	memcpy((char*)*lpWaveData + iSize, &wh.iSizeData, sizeof(wh.iSizeData));

   ov_clear( &vf );
	DebugText("OK!\n");
	return 0;
}
Ejemplo n.º 16
0
void sceneTutorial::Render()
{
	if (state == SCENE::INIT) return;
	tdnView::Clear(0xffffffff);
	tdnView::Activate();


/**********************************************/
//	この間がゲーム画面
/**************************************************/
	renderTarget->RenderTarget();
	//back->Render(0, 0);

	// ステージの後ろ描画
	stage->RenderBack();

	stage->Render();

	UIMNG.Render();
	m_poseIcon.pic->Render(m_poseIcon.x - 32, m_poseIcon.y - 32);

	// ステート描画
	switch (state) {
	case SCENE::READY:		ReadyRender();		break;
	case SCENE::MAIN:		MainRender();		break;
	}

/************************************************/

/******************************/
	// ポストエフェクト効果始まり	
	PostEffectMgr.BloomBigin();
	renderTarget->Render((int)ShakeMgr->move.x, (int)ShakeMgr->move.y);// レンダーターゲット																 
	PostEffectMgr.BloomEnd();
	/*****************************ポストエフェクトおわり*/

	/******************************/
	// ブラ—効果始まり	
	PostEffectMgr.RadialBigin();
	renderTarget->Render((int)ShakeMgr->move.x, (int)ShakeMgr->move.y);// レンダーターゲット
	PostEffectMgr.RadialEnd();
	/*****************************ブラ—おわり*/

	tdnSystem::GetDevice()->SetRenderTarget(0, backUp);
	//renderTarget->Render((int)ShakeMgr->move.x, (int)ShakeMgr->move.y); //これは描画されていない

	// ポストエフェクトたち
	PostEffectMgr.RadialRender(); // ◎これが放射ブラ—を掛けた真の描画元

	//if (KeyBoard(KB_ENTER))
	{
		PostEffectMgr.BloomRender();
	}
	
	// ↑

	switch (state) {
	case SCENE::READY:		EffectMgr.Render();	break;
	case SCENE::MAIN:break;
	}
	

	//基本的には最後。説明時のみ説明書の後ろにするので別途
	pointer->Render();
	FadeControl::Render();
#ifdef _DEBUG
	DebugText();
	//CollisionMgr->DebugRender(g_pSheepMgr, dataMNG, stage);
#endif
}