Exemplo n.º 1
0
//The Gc activate function ensures the correct window refreshing (clearing) and relative placement of origin for offscreen
//bitmap images.
void CTransGc::Activate(RDrawableWindow& aWindow)
	{				
		CancelClippingRect();
								
		//Alpha clear the redraw rect;
		iFbsBitGc.SetBrushColor(TRgb(0,0,0,0)); //Alpha transparent 			
		SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);	
		
		//The new Gc Origin is the current window position relative to our main iWindowOrigin
		TPoint p = aWindow.AbsPosition();	
		p -= iWindowOrigin;
		iGcOrigin = p;
		
		//ensure the drawing functions to draw to the correct origin
		iFbsBitGc.SetOrigin(p);

		//Only clear this Gc if a new window (and hence different rect) is applied 
		if (iWin!=&aWindow)		
			{
			//Save the window 
			iWin = &aWindow;
			TRect rect;
			//Get the redraw rectangle
			rect = aWindow.GetDrawRect();		
			//Clear the drawing region
			Clear(rect); 

			}			
		
		SetDrawMode(CGraphicsContext::EDrawModePEN);		
	}
Exemplo n.º 2
0
//動画表示
void MyDrawMovie::ContentView() {
	if (!CheckHandleASyncLoad(handle)) {
		SetDrawMode(DX_DRAWMODE_BILINEAR);
		DrawRotaGraphF(x, y, ex / SIZE_RATE, 0, handle, TRUE, TRUE); //描画
		SetDrawMode(DX_DRAWMODE_NEAREST);
	}
}
Exemplo n.º 3
0
void Image::DrawRotaImageF(float x, float y, double ExRate, double Angle, int GrIndex, bool TransFlag, int div, bool adj, bool corner)
{
	Image_t* img = img_db.QueryImgData(GrIndex);
	if(div > img->div_num-1) div = img->div_num-1; 

	float draw_x = x;
	float draw_y = y;

	if(corner){
		int img_w, img_h;
		GetImageSize(GrIndex, &img_w, &img_h);

		draw_x+=(float)img_w/2;
		draw_y+=(float)img_h/2;
	}

	if(adj){
		draw_x += GAME_X;
		draw_y += GAME_Y;
	}


	int img_w, img_h;
	GetGraphSize(img->img_han,&img_w,&img_h);
	int per_w = img_w/img->div_num;

	SetDrawMode(DX_DRAWMODE_BILINEAR);
	DrawRectRotaGraphF(draw_x,draw_y,per_w*div,0,per_w,img_h,ExRate,Angle,img->img_han,TransFlag,FALSE);
	SetDrawMode(DX_DRAWMODE_NEAREST);
}
Exemplo n.º 4
0
//弾丸の描画
void graph_bullet(){
	int i,j,eff;
	double disp_angle;
	SetDrawMode( DX_DRAWMODE_BILINEAR ) ;//線形補完描画
	for(i=0;i<SHOT_MAX;i++){//敵の弾幕数分ループ
		if(shot[i].flag>0){//弾幕データがオンなら
			for(j=0;j<SHOT_BULLET_MAX;j++){//その弾幕が持つ弾の最大数分ループ
				if(shot[i].bullet[j].flag!=0){//弾データがオンなら
					if(shot[i].bullet[j].eff==1)
						SetDrawBlendMode( DX_BLENDMODE_ADD, 255) ;
					if(bullet_info[shot[i].bullet[j].knd].kaiten==1)
						disp_angle=PI2*(shot[i].bullet[j].cnt%120)/120;
					else
						disp_angle=shot[i].bullet[j].angle+PI/2;

					DrawRotaGraphF(
						shot[i].bullet[j].x+FX+dn.x, shot[i].bullet[j].y+FY+dn.y,
						1.0, disp_angle,
						img_bullet[shot[i].bullet[j].knd][shot[i].bullet[j].col],TRUE);

					if(shot[i].bullet[j].eff==1)
						SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0) ;
				}
			}
		}
	}
	boss_assist_img();
	//ボス
	if(boss_shot.flag>0){//弾幕データがオンなら
		for(j=0;j<BOSS_BULLET_MAX;j++){//その弾幕が持つ弾の最大数分ループ
			if(boss_shot.bullet[j].flag!=0){//弾データがオンなら
				eff=0;
				if(boss_shot.bullet[j].kaiten==1)
					disp_angle=PI2*(boss_shot.bullet[j].cnt%120)/120;
				else
					disp_angle=boss_shot.bullet[j].angle+PI/2;
				if(boss_shot.bullet[j].eff_detail==1){//風雨にも負けず用弾エフェクト
					SetDrawBlendMode( DX_BLENDMODE_ADD, 100+GetRand(155)),eff=1 ;
					DrawRotaGraphF(
						boss_shot.bullet[j].x+FX+dn.x, boss_shot.bullet[j].y+FY+dn.y,
						1.3, disp_angle,
						img_bullet[boss_shot.bullet[j].knd][boss_shot.bullet[j].col],TRUE);
				}
				if(boss_shot.bullet[j].eff==1)
					SetDrawBlendMode( DX_BLENDMODE_ADD, 255),eff=1 ;
				if(boss_shot.bullet[j].eff==2)
					SetDrawBlendMode( DX_BLENDMODE_ADD, 255+GetRand(100)),eff=1 ;
				DrawRotaGraphF(
					boss_shot.bullet[j].x+FX+dn.x, boss_shot.bullet[j].y+FY+dn.y,
					1.0, disp_angle,
					img_bullet[boss_shot.bullet[j].knd][boss_shot.bullet[j].col],TRUE);

				if(eff==1)
					SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0) ;
			}
		}
	}
	SetDrawMode(DX_DRAWMODE_NEAREST);//描画形式を戻す
}
Exemplo n.º 5
0
void Enemy::Draw(){
	if(GetState() != Exist){return;}
	SetDrawBlendMode(DX_BLENDMODE_ADD,GetDrawParam());
	SetDrawMode(1);
	DrawRotaGraph(static_cast<int>(GetX()),static_cast<int>(GetY()),GetDrawExp(),(GetRotateWhenDraw())?GetAngle():0,GetImage(),TRUE);
	SetDrawMode(0);
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND,0);
}
//todo: this part of extra textures is a mess really ...
void CBaseGroundDrawer::DisableExtraTexture()
{
	if(drawLineOfSight){
		SetDrawMode(drawLos);
	} else {
		SetDrawMode(drawNormal);
	}
	extraTex=0;
	highResInfoTexWanted=false;
	updateTextureState=0;
	while(!UpdateExtraTexture());
}
Exemplo n.º 7
0
void graph_lazer(){
	int i;
	SetDrawMode( DX_DRAWMODE_BILINEAR ) ;//線形補完描画
	for(i=0;i<LAZER_MAX;i++){//敵の弾幕数分ループ
		if(lazer[i].flag>0){//弾幕データがオンなら
			SetDrawBlendMode( DX_BLENDMODE_ADD, 255) ;
			DrawRotaGraphF(//発射位置のエフェクトを描画
				lazer[i].startpt.x+FX,lazer[i].startpt.y+FY,1.0,0,
				img_lazer_moto[lazer[i].knd][lazer[i].col],TRUE
			);
			DrawModiGraphF(//レーザーを描画
				lazer[i].disppt[0].x+FX, lazer[i].disppt[0].y+FY, 
				lazer[i].disppt[1].x+FX, lazer[i].disppt[1].y+FY, 
				lazer[i].disppt[2].x+FX, lazer[i].disppt[2].y+FY, 
				lazer[i].disppt[3].x+FX, lazer[i].disppt[3].y+FY, 
				img_lazer[lazer[i].knd][lazer[i].col],TRUE
			);
			SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0) ;
/*			myDrawSquare(//当たり判定範囲を表示
				lazer[i].outpt[0].x+FX,lazer[i].outpt[0].y+FY,
				lazer[i].outpt[1].x+FX,lazer[i].outpt[1].y+FY,
				lazer[i].outpt[2].x+FX,lazer[i].outpt[2].y+FY,
				lazer[i].outpt[3].x+FX,lazer[i].outpt[3].y+FY
			);*/
		}
	}
}
Exemplo n.º 8
0
//---------------------------------------------------------------------
void SaveloadDraw::drawSavedataThumbnail(int savedata_pos)
{
    int num = savedata_pos + saveload_state->getPage() * SaveloadData::getSavedataNum();
    int px = SaveloadData::getSavedataPosX(savedata_pos) + 7;
    int py = SaveloadData::getSavedataPosY(savedata_pos) + 7;

    if (!SaveData::getInstance()->isData(num)) {
        DrawGraph(px, py, image_thumbnail_nodata, TRUE);
        return;
    }

    int scenario_num = SaveData::getInstance()->getScenarioPos(num);

    SetDrawMode(DX_DRAWMODE_BILINEAR);
    // background
    int back_image = AllScenarioData::getInstance()->getBackimage(scenario_num);
    DrawExtendGraph(
        px,
        py,
        px + 177,
        py + 100,
        ImageData::getInstance()->getImageBack(back_image),
        TRUE);
    // character
    for (int n = 1; n <= AllScenarioData::getInstance()->getCharaNum(scenario_num); n++) {

        int chara_image = AllScenarioData::getInstance()->getCharaImage(scenario_num, n);
        int chara_pos = AllScenarioData::getInstance()->getCharaPos(scenario_num, n);
        int image_handl = ImageData::getInstance()->getImageChara(chara_image);

        switch (chara_pos) {
        case 1: DrawExtendGraph(px + 34, py + -14, px + 146, py + 217, image_handl, TRUE); break;
        case 2: DrawExtendGraph(px + 55, py + 14, px + 125, py + 154, image_handl, TRUE); break;
        case 3: DrawExtendGraph(px + 13, py + 14, px + 83, py + 154, image_handl, TRUE); break;
        case 4: DrawExtendGraph(px + 97, py + 14, px + 167, py + 154, image_handl, TRUE); break;
        case 5: DrawExtendGraph(px + 69, py + 28, px + 117, py + 112, image_handl, TRUE); break;
        case 6: DrawExtendGraph(px + 13, py + 28, px + 55, py + 112, image_handl, TRUE); break;
        case 7: DrawExtendGraph(px + 125, py + 28, px + 167, py + 112, image_handl, TRUE); break;
        case 8: DrawExtendGraph(px + 41, py + 28, px + 83, py + 112, image_handl, TRUE); break;
        case 9: DrawExtendGraph(px + 97, py + 28, px + 139, py + 112, image_handl, TRUE); break;
        }
    }
    SetDrawMode(DX_DRAWMODE_NEAREST);
}
Exemplo n.º 9
0
void Image::DrawImageF(float x, float y, int GrIndex, bool TransFlag, int div, bool adj)
{
	Image_t* img = img_db.QueryImgData(GrIndex);
	if(div > img->div_num-1) div = img->div_num-1; 

	float adj_x = GAME_X;
	float adj_y = GAME_Y;
	if(!adj) {
		adj_x = 0;
		adj_y = 0;
	}

	int img_w, img_h;
	GetGraphSize(img->img_han,&img_w,&img_h);
	int per_w = img_w/img->div_num;

	SetDrawMode(DX_DRAWMODE_BILINEAR);
	DrawRectGraphF(x+adj_x,y+adj_y,per_w*div,0,per_w,img_h,img->img_han,TransFlag,FALSE);
	SetDrawMode(DX_DRAWMODE_NEAREST);
}
void CBaseGroundDrawer::SetHeightTexture()
{
	if (drawMode == drawHeight)
		DisableExtraTexture();
	else {
		SetDrawMode (drawHeight);
		highResInfoTexWanted=true;
		extraTex=0;
		updateTextureState=0;
		while(!UpdateExtraTexture());
	}
}
void CBaseGroundDrawer::SetPathMapTexture()
{
	if (drawMode==drawPath)
		DisableExtraTexture();
	else {
		SetDrawMode(drawPath);
		extraTex=0;
		highResInfoTexWanted=false;
		updateTextureState=0;
		while(!UpdateExtraTexture());
	}
}
Exemplo n.º 12
0
MeshViewer::MeshViewer(const char *title, int width, int height)
	:GlutOperatorN(title, width, height)
{
	m_Mesh.request_face_normals();
	m_Mesh.request_vertex_normals();

	ClearDrawModes();
	AddDrawMode("Wireframe");
	AddDrawMode("Hidden Line");
	AddDrawMode("Solid Flat");
	AddDrawMode("Solid Smooth");
	SetDrawMode(3);
}
Exemplo n.º 13
0
EXPORT_C void CHuiCanvasGc::SetDefaults()
	{
	SetTextStyle(0);
    SetPenColor(TRgb(255,255,255));
	SetPenWidth(1.0);
	SetOpacity(1.0);
	SetPolygonDrawMode(EHuiNoFill);
	SetTextAlign(EHuiAlignHLeft, EHuiAlignVTop);
    SetDrawMode(EHuiCanvasDrawModeBlend);
    EnableEffectiveOpacity(ETrue);    
    SetPolygonFillTexture(NULL);
    SetPolygonFillTextureOrigin(TPoint(0,0));
	CancelClipping();
	}
Exemplo n.º 14
0
//弾丸の描画
void graph_bullet(){
	int i,j;
	SetDrawMode( DX_DRAWMODE_BILINEAR ) ;//線形補完描画
	for(i=0;i<SHOT_MAX;i++){//敵の弾幕数分ループ
		if(shot[i].flag>0){//弾幕データがオンなら
			for(j=0;j<SHOT_BULLET_MAX;j++){//その弾幕が持つ弾の最大数分ループ
				if(shot[i].bullet[j].flag!=0){//弾データがオンなら
					if(shot[i].bullet[j].eff==1)
						SetDrawBlendMode( DX_BLENDMODE_ADD, 255) ;

					DrawRotaGraphF(
						shot[i].bullet[j].x+FIELD_X+dn.x, shot[i].bullet[j].y+FIELD_Y+dn.y,
						1.0, shot[i].bullet[j].angle+PI/2,
						img_bullet[shot[i].bullet[j].knd][shot[i].bullet[j].col],TRUE);

					if(shot[i].bullet[j].eff==1)
						SetDrawBlendMode( DX_BLENDMODE_NOBLEND, 0) ;
				}
			}
		}
	}
	SetDrawMode(DX_DRAWMODE_NEAREST);//描画形式を戻す
}
void CBaseGroundDrawer::ToggleLosTexture()
{
	if (drawMode==drawLos) {
		drawLineOfSight=false;
		DisableExtraTexture();
	} else {
		drawLineOfSight=true;
		SetDrawMode(drawLos);
		extraTex=0;
		highResInfoTexWanted=false;
		updateTextureState=0;
		while(!UpdateExtraTexture());
	}
}
Exemplo n.º 16
0
IShape* NodeFactory::CreateCircle(float radius, float precision, const Color4F& color)
{
	auto mesh = MeshFactory::Instance().CreateShapeCircleMesh(radius, precision, color);
	RETURN_NULL_IF_NULL(mesh);
	auto material = MaterialFactory::Instance().CreateShape(MEDUSA_PREFIX(Shape_TrianglesFan));
	material->SetDrawMode(GraphicsDrawMode::TriangleFan);
	IShape* sprite = new IShape();
	sprite->Initialize();
	sprite->SetSizeToContent(SizeToContent::Mesh);
	sprite->SetMesh(mesh);
	sprite->SetMaterial(material);
	return sprite;

}
Exemplo n.º 17
0
LinesShape* NodeFactory::CreateLine(const Point3F& from, const Point3F& to, const Color4F& color)
{
	auto mesh = MeshFactory::Instance().CreateLineMesh(from, to, color);
	RETURN_NULL_IF_NULL(mesh);
	auto material = MaterialFactory::Instance().CreateShape(MEDUSA_PREFIX(Shape_Lines));
	material->SetDrawMode(GraphicsDrawMode::Lines);
	LinesShape* sprite = new LinesShape();
	sprite->Initialize();

	sprite->SetSize(Math::Abs(to.X - from.X), Math::Abs(to.Y - from.Y));
	sprite->SetMesh(mesh);
	sprite->SetMaterial(material);
	return sprite;
}
Exemplo n.º 18
0
/***********************************************************************

  DrawLinks() - this function draws the current link hierarchy as stated 
		in the data structure 'data'.

***********************************************************************/
int 
DrawLinks(MyProgram *data)
{
   int i;

   if (data->redraw == TRUE)
      SetDrawMode(SANE_XOR);

   /*  draw each link 
    */
   for (i = 0; i < data->num_links; i++)
      DrawLine(data->links[i].start.x, InvertY(data->links[i].start.y), 
		data->links[i].visend.x, InvertY(data->links[i].visend.y));

   /*  draw end effector
    */
   switch(data->end_effect.type) {
      case ENDEFF_SQUARE:
         DrawFilledBox(data->end_effect.center.x, 
			InvertY(data->end_effect.center.y),
			ENDEFF_SIZE, ENDEFF_SIZE);
         break;
      case ENDEFF_CIRCLE:
         DrawFilledArc(data->end_effect.center.x, 
			InvertY(data->end_effect.center.y),
			ENDEFF_SIZE, ENDEFF_SIZE, 0, 360);
         break;
      case ENDEFF_TRIANGLE:
         break;
      default:
         break;
   }

   SetDrawMode(GXcopy);

   return(0);
} /* end of DrawLinks() */
void CBaseGroundDrawer::SetMetalTexture(unsigned char* tex,float* extractMap,unsigned char* pal,bool highRes)
{
	if (drawMode == drawMetal)
		DisableExtraTexture();
	else {
		SetDrawMode (drawMetal);

		highResInfoTexWanted=false;
		extraTex=tex;
		extraTexPal=pal;
		extractDepthMap=extractMap;
		updateTextureState=0;
		while(!UpdateExtraTexture());
	}
}
Exemplo n.º 20
0
IShape* NodeFactory::CreateRectBorder(const Size2F& rectSize, const Color4F& color)
{
	auto mesh = MeshFactory::Instance().CreateShapeQuadMesh(rectSize, color);
	RETURN_NULL_IF_NULL(mesh);
	auto material = MaterialFactory::Instance().CreateShape(MEDUSA_PREFIX(Shape_WireFrame));
	material->SetDrawMode(GraphicsDrawMode::LineStrip);

	IShape* sprite = new IShape();
	sprite->Initialize();
	sprite->SetSizeToContent(SizeToContent::Mesh);

	sprite->SetMesh(mesh);
	sprite->SetMaterial(material);
	sprite->SetSize(rectSize);
	return sprite;
}
Exemplo n.º 21
0
//弾丸の描画
void graph_bullet(){
	int j;
	double disp_angle;
	SetDrawMode( DX_DRAWMODE_BILINEAR );//線形補完描画
	for(j=0;j<BULLET_MAX;j++){//その弾幕が持つ弾の最大数分ループ
		if(bullet[j].flag!=0){//弾データがオンなら
			disp_angle=bullet[j].angle+PI/2;

			DrawRotaGraphF(bullet[j].x, bullet[j].y, 1.0, disp_angle,
				img_bullet[bullet[j].knd][bullet[j].col],TRUE);
		}
	}
	if(ch.bcnt){
		bdelete();
	}
}
Exemplo n.º 22
0
int WsSetPdata(void)
{
    ROMBanks = 1;
    RAMBanks = 0;
    RAMSize = 0;
    CartKind = 0;
    SaveName[0] = 0;
    if ((ROMMap[0xFF] = (BYTE*)malloc(0x10000)) == NULL)
    {
        ErrorMsg(ERR_MALLOC);
        return -1;
    }
    memcpy(ROMMap[0xFF] + 0xF080, pdata, size_pdata);
    WsReset();
    SetDrawMode(0);
    return 0;
}
Exemplo n.º 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;
}
Exemplo n.º 24
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;
}
Exemplo n.º 25
0
  CountryBorders ()  :  DataSet ()
    { Load ("data/Tissot_indicatrix_world_map_equirectangular_proj_360x180_coords_cleaner2.txt");

      //  Interpret the 0th and 1th column in the data as floats,
      //  and the 2th column as ints
      longitude = FloatColumn (0);
      latitude  = FloatColumn (1);
      drawitude = IntColumn   (2);

      LoadShaders ("shaders/foggy.vert", "shaders/null.frag");

      for (int64 i = 4  ;  i < Count ()  ;  i++)
        { float64 mapped_longitude
            = Range (longitude[i], 0.0, 360.0, -180.0, 180.0) - 0.2;

          //  todo: - .2 because the borders data is a tad off
          float64 mapped_latitude
            = Range (latitude[i], 0.0, 180.0, 90.0, -90.0) + 0.25;

          //  todo: + .25 because the borders data is a tad off

          Vect globe_position = LatLongToSphereSurface (GLOBE_RADIUS - 0.5,
                                                        mapped_latitude,
                                                        mapped_longitude);
          SetPointLocation (i, globe_position.x,
                            globe_position.y,
                            globe_position.z);

          SetPointColor (i, HSB (0.5, 0.0, 0.2, 1.0 * drawitude[i]));
        }

      DataReady ();
      SetDrawMode (GL_LINE_STRIP);

      RotationAnimateChase (0.75);
      TranslationAnimateChase (0.25);
    }
Exemplo n.º 26
0
void RenderingContext::ApplyDrawMode(GraphicsDrawMode val)
{
	SetDrawMode(val);
	UpdateShaderVariables();

}
Exemplo n.º 27
0
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )
{
	ChangeWindowMode(TRUE);
	//SetMouseDispFlag(TRUE);
	SetDrawMode(DX_DRAWMODE_BILINEAR);
	SetScreenMemToVramFlag(FALSE);
	SetAlwaysRunFlag(TRUE);
	SetDrawScreen( DX_SCREEN_BACK);
	if(DxLib_Init()==-1)		// DXライブラリ初期化処理
	{
		return -1 ;			// エラーが起きたら直ちに終了
	}

	//デバック用にコンソールを出現させる
	/*
	AllocConsole();
	freopen("CONOUT$","w",stdout);
	freopen("CONIN$","r",stdin);z
	*/

	Mode gamemode=OPENING;
	AI_T ai[AI_NUM];
	Takara takara;
	int death[AI_NUM]={0};
	Tagger tagger[TAGGER_NUM];
	int tagger_num = 0;
	int STAGE[WIDTH][HEIGHT]={0};
	int round=0;
	int start=0;
	int end=0;
	int StartTime,TimeLimit;

	for(int i=0;i<AI_NUM;i++){
		ai[i].entry=1;
	}
	ai[0].entry=0;

	while(ProcessMessage()!=-1){
		int speed=0;
		switch(gamemode){
		case OPENING:
			start=intro(ai);
			if(start==1)gamemode=SETTING;
			break;
		case SETTING:
			takara.x=GetRand(WIDTH/2)+WIDTH/2-1;
			takara.y=GetRand(HEIGHT/2)+1;
			takara.drop=0;
			make_Stage(STAGE,takara);//マップ構成
			tagger_num = init_Tagger(tagger,STAGE);//鬼の初期化 //tagger_numは鬼の要素番号

			init_Ai(ai,STAGE);

			round++;
			TimeLimit=TIME_LIMIT*60*79;//ゲーム開始時の時刻に合わせる
			gamemode=RUNNING;

			break;
		case RUNNING:
			TimeLimit-=79;
			if(TimeLimit<0)TimeLimit=0;
			if(tagger[tagger_num].step==0){
				//tagger[tagger_num].act=next_Tagger(tagger[tagger_num],STAGE,ai);
				tagger[tagger_num].act=tagger[tagger_num].moveFunc(tagger[tagger_num].x,tagger[tagger_num].y,STAGE); //AIと一緒で、moveFunc使う
			}
			for(int i=0;i<AI_NUM;i++){
				if(ai[i].step==0 && ai[i].entry==1){
					setview_Ai(&ai[i],STAGE);
					//ai[i].act=next_Ai(ai[i].view); //henteko : 下のmoveFunc()を使うためコメントアウト
					ai[i].act = ai[i].moveFunc(ai[i].view);
				}
			}
			if(TimeLimit>TIME_LIMIT*45*79)speed=0;
			else if(TimeLimit>TIME_LIMIT*30*79)speed=1;
			else if(TimeLimit>TIME_LIMIT*15*79)speed=1;
			else speed=3;
			update_Tagger(&tagger[tagger_num],STAGE,speed);
			for(int i=0;i<AI_NUM;i++){
				if(ai[i].entry==1)
					update_Ai(&ai[i],STAGE,&takara);
			}
			update_stage(STAGE,ai,tagger[tagger_num],takara);
			
			ClearDrawScreen();
			draw(STAGE,ai,tagger[tagger_num],takara);
			DrawFormatString(30,30,GetColor(0,255,255),"ROUND%d",round);
			
			DrawFormatString(500,15,GetColor(0,255,0),"TIME %d",TimeLimit);
			
			if(1){
				for(int i=0;i<AI_NUM;i++){
					if(death_Ai(ai[i],tagger[tagger_num])==1 && ai[i].entry==1){
						death[i]++;
						DrawBox(0,230,640,260,GetColor(0,0,0),1);
						DrawBox(-1,230,642,260,GetColor(255,0,0),0);
						DrawFormatString(100,240,GetColor(255,0,0),"%sがつかまりました",ai[i].name);// 8/3 zero追記:AI捕獲の宣言をまとめた。
						init_Ai(&ai[i],STAGE);//元の場所に戻される
						TimeLimit-=1000;//時間ペナルティ
						/*WaitTimer(3000);
						if(round>=ROUND_MAX){
							gamemode=ENDING;
						}
						else{
							gamemode=SETTING;
						}
						break;*/
					}
				}
			}
			if(TimeLimit<=0){// 8/3 zero追記:タイムアップを設定
				round--;
				DrawString(100,240,"時間切れです",GetColor(255,0,0));
				WaitTimer(3000);
				if(round>=ROUND_MAX){
					gamemode=ENDING;
				}
				else{
					gamemode=SETTING;
				}
				break;
			}
			if(CheckHitKey(KEY_INPUT_R)==1){
				gamemode=SETTING;
			}
			break;
		case ENDING:
			end=ranking(ai,death);
			break;
		default:
			break;
		}
		if(end==1 || CheckHitKey(KEY_INPUT_ESCAPE))break;
		ScreenFlip();
	}

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

	return 0 ;				// ソフトの終了 
}
Exemplo n.º 28
0
int WsCreate(wchar_t *CartName)
{
    int Checksum, i, j;
    FILE* fp;
    BYTE buf[16];
    wchar_t* p;

    for (i = 0; i < 256; i++)
    {
        ROMMap[i] = MemDummy;
        RAMMap[i] = MemDummy;
    }
    memset(IRAM, 0, sizeof(IRAM));
    memset(MemDummy, 0xA0, sizeof(MemDummy));
    memset(IO, 0, sizeof(IO));
    if (CartName == NULL)
    {
        return WsSetPdata();
    }
    if ((fp = _wfopen(CartName, L"rb")) == NULL)
    {
        ErrorMsg(ERR_FOPEN);
        return -1;
    }
    fseek(fp, -10, 2);
    if (fread(buf, 1, 10, fp) != 10)
    {
        ErrorMsg(ERR_FREAD_ROMINFO);
        return -1;
    }
    switch (buf[4])
    {
    case 1:
        ROMBanks = 4;
        break;
    case 2:
        ROMBanks = 8;
        break;
    case 3:
        ROMBanks = 16;
        break;
    case 4:
        ROMBanks = 32;
        break;
    case 5:
        ROMBanks = 48;
        break;
    case 6:
        ROMBanks = 64;
        break;
    case 7:
        ROMBanks = 96;
        break;
    case 8:
        ROMBanks = 128;
        break;
    case 9:
        ROMBanks = 256;
        break;
    default:
        ROMBanks = 0;
        break;
    }
    if (ROMBanks == 0)
    {
        ErrorMsg(ERR_ILLEGAL_ROMSIZE);
        return -1;
    }
    switch (buf[5])
    {
    case 0x01:
        RAMBanks = 1;
        RAMSize = 0x2000;
        CartKind = 0;
        break;
    case 0x02:
        RAMBanks = 1;
        RAMSize = 0x8000;
        CartKind = 0;
        break;
    case 0x03:
        RAMBanks = 2;
        RAMSize = 0x20000;
        CartKind = 0;
        break;
    case 0x04:
        RAMBanks = 4;
        RAMSize = 0x40000;
        CartKind = 0;
        break;
    case 0x10:
        RAMBanks = 1;
        RAMSize = 0x80;
        CartKind = CK_EEP;
        break;
    case 0x20:
        RAMBanks = 1;
        RAMSize = 0x800;
        CartKind = CK_EEP;
        break;
    case 0x50:
        RAMBanks = 1;
        RAMSize = 0x400;
        CartKind = CK_EEP;
        break;
    default:
        RAMBanks = 0;
        RAMSize = 0;
        CartKind = 0;
        break;
    }
    WsRomPatch(buf);
    Checksum = (int)((buf[9] << 8) + buf[8]);
    Checksum += (int)(buf[9] + buf[8]);
    for (i = ROMBanks - 1; i >= 0; i--)
    {
        fseek(fp, (ROMBanks - i) * -0x10000, 2);
        if ((ROMMap[0x100 - ROMBanks + i] = (BYTE*)malloc(0x10000)) != NULL)
        {
            if (fread(ROMMap[0x100 - ROMBanks + i], 1, 0x10000, fp) == 0x10000)
            {
                for (j = 0; j < 0x10000; j++)
                {
                    Checksum -= ROMMap[0x100 - ROMBanks + i][j];
                }
            }
            else
            {
                ErrorMsg(ERR_FREAD_ROM);
                break;
            }
        }
        else
        {
            ErrorMsg(ERR_MALLOC);
            break;
        }
    }
    fclose(fp);
    if (i >= 0)
    {
        return -1;
    }
    if (Checksum & 0xFFFF)
    {
        //ErrorMsg(ERR_CHECKSUM);
    }
    if (RAMBanks)
    {
        for (i = 0; i < RAMBanks; i++)
        {
            if ((RAMMap[i] = (BYTE*)malloc(0x10000)) != NULL)
            {
                memset(RAMMap[i], 0x00, 0x10000);
            }
            else
            {
                ErrorMsg(ERR_MALLOC);
                return -1;
            }
        }
    }
    if (RAMSize)
    {
        wcscpy (SaveName, CurDir);
        p = wcsrchr(CartName, L'\\');
        if (p)
        {
            wcscat(SaveName, SaveDir);
            if (PathIsDirectoryW(SaveName) == FALSE)
            {
                CreateDirectoryW(SaveName, NULL);
            }
            wcscat(SaveName, p);
            p = wcsrchr(SaveName, L'.');
            if (p)
            {
                *p = 0;
            }
            wcscat(SaveName, L".sav");
        }
        else
        {
            SaveName[0] = 0;
        }
        if ((fp = _wfopen(SaveName, L"rb")) != NULL)
        {
            for (i = 0; i < RAMBanks; i++)
            {
                if (RAMSize < 0x10000)
                {
                    if (fread(RAMMap[i], 1, RAMSize, fp) != (size_t)RAMSize)
                    {
                        ErrorMsg(ERR_FREAD_SAVE);
                        break;
                    }
                }
                else
                {
                    if (fread(RAMMap[i], 1, 0x10000, fp) != 0x10000)
                    {
                        ErrorMsg(ERR_FREAD_SAVE);
                        break;
                    }
                }
            }
            fclose(fp);
        }
    }
    else
    {
        SaveName[0] = 0;
    }
    wcscpy (StateName, CurDir);
    p = wcsrchr(CartName, L'\\');
    if (p)
    {
        wcscat(StateName, StateDir);
        if (PathIsDirectoryW(StateName) == FALSE)
        {
            CreateDirectoryW(StateName, NULL);
        }
        wcscat(StateName, p);
        p = wcsrchr(StateName, L'.');
        if (p)
        {
            *p = 0;
        }
    }
    WsReset();
    SetDrawMode(buf[6] & 1); // 0:横 1:縦
    return 0;
}
Exemplo n.º 29
0
void BmsPlayer::bmsPlay(){
	ChronoTimer calcflame;

	// メディアロード開始
	SetUseASyncLoadFlag(TRUE);
	setSoundToMem();
	setGraphToMem();

	SetUseASyncLoadFlag(FALSE);
	
	while (ProcessMessage() == 0 && GetASyncLoadNum() != 0){
		if (calcflame.GetLapTime() >= (1.0 / GetRefreshRate()) * 100000){
			system_graph.drawsystembg();
			system_graph.drawsystem();
			DrawFormatString(450, 60, GetColor(255, 255, 255), "GENRE : %s", parser->getHeader("GENRE").c_str());
			DrawFormatString(450, 75, GetColor(255, 255, 255), "TITLE : %s", parser->getHeader("TITLE").c_str());
			DrawFormatString(450, 90, GetColor(255, 255, 255), "ARTIST: %s", parser->getHeader("ARTIST").c_str());
			DrawFormatString(450, 105, GetColor(255, 255, 255), "BPM   : %s", parser->getHeader("BPM").c_str());
			DrawFormatString(450, 120, GetColor(255, 255, 255), "Loading...");

			ScreenFlip();
			ClearDrawScreen();
			calcflame.ResetTime();
		}
	}

	// ゲーム用タイマー
	input.ResetTime();

	// 入力関係
	Result score;

	int grph_i = 0;

	while (ProcessMessage() == 0)
	{
		// プレー処理
		play_channel_sound(1, input.GetLapTime());
		for (int j = 11; j < 20; j++){
			play_channel_sound(j, input.GetLapTime());
		}

		input.inputUpdate();
		checkJudge(input.GetLapTime());

		// 描画ブロック
		if (calcflame.GetLapTime() >= (1.0 / GetRefreshRate()) * 100000){
			system_graph.drawsystembg();

			SetDrawMode(DX_DRAWMODE_BILINEAR);
			grph_i += play_channel_graph(4, grph_i, input.GetLapTime());

			SetDrawMode(DX_DRAWMODE_NEAREST);

			drawInterface(input.GetLapTime());
			system_graph.drawsystem();

			DrawFormatString(150, 300, GetColor(255, 255, 255), "PERFECT %d", combo_debug);

			ScreenFlip();
			ClearDrawScreen();
			calcflame.ResetTime();
		}
	}

	// リザルトクラス呼び出しとか



	InitSoundMem();
}
Exemplo n.º 30
0
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
	ChangeWindowMode(true);
	SetGraphMode(640, 480, 16);
	DxLib_Init();
	SetDrawScreen(DX_SCREEN_BACK);
	SetDrawMode(DX_DRAWMODE_BILINEAR);
	SetMainWindowText("禁断の果実と楽園の護人");

	//int titlebg = LoadGraph("picture/taitol.bmp");
	int titletext = LoadGraph("picture/title.bmp");
	int bg = LoadGraph("picture/playbg_2.bmp");
	int tree = LoadGraph("picture/bigtreekai.bmp");
	char key[256];
	Opening openingscene;
	Play playscene;
	MusicSelect musicselect;
	Result resultscene;

	enum{
		OPENING,
		PLAY,
		MUSICSELECT,
		RESULT
	}scene=OPENING;

	while(Process(key)){
		switch(scene){
		case OPENING:
			DrawGraph(0, 0, bg, false);
			DrawGraph(0, 0, tree, true);
			DrawGraph(0, 0, titletext, true);
			if( ProcessMessage() == -1 ){
				break ;        // エラーが起きたらループを抜ける
			}
			openingscene.UpDate();
			openingscene.Draw();
			if(key[KEY_INPUT_LEFT]==1 || openingscene.HitJudge() == true){
				scene = MUSICSELECT;
				
			}

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

		case MUSICSELECT:
			if( ProcessMessage() == -1 ){
				break ;        // エラーが起きたらループを抜ける
			}
			DrawGraph(0, 0, bg, false);
			DrawGraph(0, 0, tree, true);
			musicselect.UpDate();
			musicselect.Draw();
			if(musicselect.HitJudge() == true){
				playscene.Loadfile(musicselect.GetMusicfile());
				playscene.SetMusic(musicselect.GetMusic());
				playscene.SoundPlay();
				scene = PLAY;
			}
			if(key[KEY_INPUT_UP]==1){
				scene = PLAY;
			}

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

		case PLAY:
			if( ProcessMessage() == -1 ){
				break ;        // エラーが起きたらループを抜ける
			}
			DrawGraph(0, 0, bg, false);
			DrawGraph(0, 0, tree, true);
			playscene.UpDate();
			playscene.Draw();
			if(key[KEY_INPUT_RIGHT]==1 || playscene.isPlaying() == false){
				playscene.SoundStop();
				scene = RESULT;
			}

			if(key[KEY_INPUT_ESCAPE]==1){
				DxLib_End();
			}
			break;
		
		case RESULT:
			DrawGraph(0, 0,bg, false);
			resultscene.Update();
			resultscene.Draw();
			if(key[KEY_INPUT_DOWN]==1 || resultscene.HitJudge() == true){
				scene = OPENING;
			}

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

	return 0;
}