void Window::Draw() { if(!Visible)return; int Draw_x = (int)x; int Draw_y = (int)y; DrawRotaGraph2(Draw_x,Draw_y,0,0,Ext,Angle,Screen,true); }
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); }
void p12(void) { SetDrawScreen(DX_SCREEN_BACK); int i; char keybuf[256]; int img; i = 0; img = LoadGraph("pic11.png"); while (ProcessMessage() == 0 && GetHitKeyStateAll(keybuf) == 0 && keybuf[KEY_INPUT_ESCAPE] == 0) { ClearDrawScreen(); DrawRotaGraph(120, 239, 1.0, PI / 4.0, img, TRUE); DrawCircle(120, 239, 5, GetColor(255, 0, 0), TRUE); DrawRotaGraph(320, 239, 1.0, PI / 180.0 * i, img, TRUE); DrawCircle(320, 239, 5, GetColor(255, 0, 0), TRUE); DrawRotaGraph2(520, 239, 19, 19, 1.0, PI / 180.0 * i * 2, img, TRUE); DrawCircle(520, 239, 5, GetColor(255, 0, 0), TRUE); ScreenFlip(); i++; } }
void Camera::drawImageOnWindow(Vec2D center_pos, int graphHandle, const std::shared_ptr<ImagePropertyData> &img_prop) { Vec2D p = center_pos + this->sway_now; if (!this->isVisibleForWindowPos(center_pos, img_prop->img_size*img_prop->img_expansion)) return; SetDrawBright((int)(this->shield_ratio * 255), (int)(this->shield_ratio * 255), (int)(this->shield_ratio * 255)); DrawRotaGraph2((int)p.x, (int)p.y, img_prop->img_size.width / 2, img_prop->img_size.height / 2, img_prop->img_expansion, img_prop->img_rotation, graphHandle, true, img_prop->img_turn); }
void Camera::drawImageInWorld(Vec2D center_pos, int graphHandle, const std::shared_ptr<ImagePropertyData> &img_prop) { Vec2D p = this->toWindowPosPxFromWorldPos(center_pos) + this->sway_now; double d = this->zoom_magnification_now*img_prop->img_expansion; double a = img_prop->img_rotation - this->rotate_angle_now; if (!this->isVisibleForWindowPos(p, img_prop->img_size*d, a)) return; SetDrawBright((int)(this->shield_ratio * 255), (int)(this->shield_ratio * 255), (int)(this->shield_ratio * 255)); DrawRotaGraph2((int)p.x, (int)p.y, img_prop->img_size.width / 2, img_prop->img_size.height / 2, d, a, graphHandle, true, img_prop->img_turn); }
//画像を使用して文字を描画する void Font::DrawString_UseImage(int x,int y,int Space,float ext,const char* String,int FontIndex) { int StrLen = strlen(String); int Img = 0; int x_Pos = x; int y_Pos = y; int Width = 0; int Height = 0; int ImgWidth = 0; int AverageSpace = Space; for(int i=0;i<StrLen;i++) { char Alphabet = String[i]; //改行判定 if(Alphabet == '\\') { x_Pos = ImgWidth; x_Pos = x; y_Pos += Height + Space; continue; } //指定文字の画像を読み込む if(String[i] == ' ')goto Blank; Img = FontData[FontIndex][Alphabet-'A']; //描画 if(Img) { GetGraphSize(Img,&Width,&Height); Width = (int)(Width * ext); Height = (int)(Height * ext); DrawRotaGraph2(x_Pos,y_Pos,0,0,ext,0,Img,true); //次の描画位置を指定 x_Pos += Width + Space; }else {//ブランク挿入 Blank:; x_Pos += AverageSpace; } AverageSpace = (AverageSpace + Width) / 2; } }
void draw_title() { switch (Csystem::title_level) { case 0: if(blend_flag == false && blend_pal >= 255 ) { blend_flag = true; blend_pal = 255; } if(blend_flag == true && blend_pal <= 0) { blend_flag = false; blend_pal = 0; } if(blend_flag == true) { blend_pal -= 6; }else{ blend_pal += 6; } if(next_all_blend_flag == true ) { blend_pal -= 15; if(blend_pal <= 0) { Csystem::title_level += 1; next_all_blend_flag = false; } } SetDrawBlendMode(DX_BLENDMODE_ALPHA,blend_pal); SetFontSize(40); DrawFormatString(400,540,0xffffff,"Aボタンを押してください。"); SetFontSize(17); SetDrawBlendMode(DX_BLENDMODE_NOBLEND,0); break; case 1: if(blend_pal <= 255) blend_pal += 8; if(next_all_blend_flag == true) { blend_pal -= 15; if(next_all_blend_flag == true && blend_pal <= 0) { Csystem::title_level += 1; next_all_blend_flag = false; } } if( back_all_blend_flag == true ) { blend_pal -= 15; if(back_all_blend_flag == true && blend_pal <= 0) { Csystem::title_level -= 1; back_all_blend_flag = false; } } SetDrawBlendMode(DX_BLENDMODE_ALPHA,blend_pal); DrawGraph(0,0,how_to_g,FALSE); break; case 2: if(blend_pal <= 255) blend_pal += 8; if(next_all_blend_flag == true) { blend_pal -= 15; if(next_all_blend_flag == true && blend_pal <= 0) { Csystem::title_level += 1; next_all_blend_flag = false; } } if( back_all_blend_flag == true ) { blend_pal -= 15; if(back_all_blend_flag == true && blend_pal <= 0) { Csystem::title_level -= 1; back_all_blend_flag = false; } } /* if(Csystem::game_mode == Csystem::SOLO) { DrawFormatString(0,50,0xffffff,"シングルモード"); }else{ DrawFormatString(0,50,0xffffff,"オンラインモード"); } if(Csystem::game_mode == Csystem::ONLINE) { if(Cnetwork::online_role == Cnetwork::HOST) { DrawFormatString(0,74,0xffffff,"ホスト"); }else{ DrawFormatString(0,74,0xffffff,"ゲスト"); } } */ break; case 3: if(Csystem::left_lever_y_in != 0 && Csystem::chosen_arm == Carm::RIGHT ) { blend_r_pal = 0; } if(blend_r_pal < 255) { blend_r_pal += 15; }else{ blend_r_pal = 255; } if(Csystem::left_lever_y_in != 0 && Csystem::chosen_arm == Carm::LEFT ) { blend_l_pal = 0; } if(blend_l_pal < 255) { blend_l_pal += 15; }else{ blend_l_pal = 255; } if(blend_pal <= 255) blend_pal += 8; if(next_all_blend_flag == true) { blend_pal -= 15; if(next_all_blend_flag == true && blend_pal <= 0) { Csystem::title_level += 1; next_all_blend_flag = false; } } if( back_all_blend_flag == true ) { blend_pal -= 15; if(back_all_blend_flag == true && blend_pal <= 0) { Csystem::title_level -= 1; back_all_blend_flag = false; } } case 4: if(blend_pal <= 255) blend_pal += 8; if( back_all_blend_flag == true ) { blend_pal -= 15; if(back_all_blend_flag == true && blend_pal <= 0) { Csystem::title_level -= 1; back_all_blend_flag = false; } } if(Csystem::a_button == 1 ) { blend_flag = true ; } if(blend_flag == true) { blend_pal -= 9; blend_r_pal -= 9; blend_l_pal -= 9; } if(blend_pal < 0) { blend_pal = 0; blend_r_pal = 0; blend_l_pal = 0; } SetDrawBlendMode( DX_BLENDMODE_ALPHA , blend_pal ); DrawRotaGraph2(Csystem::SCREEN_WIDTH/2,Csystem::SCREEN_HEIGHT/2,250,200,1.8f,0,chosen_player_g,FALSE,FALSE); SetDrawBlendMode( DX_BLENDMODE_ALPHA , blend_r_pal ); switch(Carm::right_arm_type) { case Carm::TWO_WAY: DrawRotaGraph2(Csystem::SCREEN_WIDTH/2 + 198,Csystem::SCREEN_HEIGHT/2 - 90,70,70,1.8f,0,two_way_g,TRUE,FALSE); break; case Carm::FOUR_WAY: DrawRotaGraph2(Csystem::SCREEN_WIDTH/2 + 198,Csystem::SCREEN_HEIGHT/2 - 90,70,70,1.8f,0,four_way_g,TRUE,FALSE); break; case Carm::ONE_WAY: DrawRotaGraph2(Csystem::SCREEN_WIDTH/2 + 198,Csystem::SCREEN_HEIGHT/2 - 90,70,70,1.8f,0,one_way_g,TRUE,FALSE); break; } SetDrawBlendMode( DX_BLENDMODE_ALPHA , blend_l_pal ) ; switch(Carm::left_arm_type) { case Carm::TWO_WAY: DrawRotaGraph2(Csystem::SCREEN_WIDTH/2 - 198,Csystem::SCREEN_HEIGHT/2 - 90,70,70,1.8f,0,two_way_g,TRUE,TRUE); break; case Carm::FOUR_WAY: DrawRotaGraph2(Csystem::SCREEN_WIDTH/2 - 198,Csystem::SCREEN_HEIGHT/2 - 90,70,70,1.8f,0,four_way_g,TRUE,TRUE); break; case Carm::ONE_WAY: DrawRotaGraph2(Csystem::SCREEN_WIDTH/2 - 198,Csystem::SCREEN_HEIGHT/2 - 90,70,70,1.8f,0,one_way_g,TRUE,TRUE); break; } SetDrawBlendMode( DX_BLENDMODE_NOBLEND , 0 ) ; switch(Csystem::chosen_arm) { case Carm::RIGHT: DrawTriangle(Csystem::SCREEN_WIDTH/2 + 178,Csystem::SCREEN_HEIGHT/2 - 200, Csystem::SCREEN_WIDTH/2 + 218,Csystem::SCREEN_HEIGHT/2 - 200, Csystem::SCREEN_WIDTH/2 + 198,Csystem::SCREEN_HEIGHT/2 - 170, 0x221111 , TRUE ) ; break; case Carm::LEFT: DrawTriangle(Csystem::SCREEN_WIDTH/2 - 178,Csystem::SCREEN_HEIGHT/2 - 200, Csystem::SCREEN_WIDTH/2 - 218,Csystem::SCREEN_HEIGHT/2 - 200, Csystem::SCREEN_WIDTH/2 - 198,Csystem::SCREEN_HEIGHT/2 - 170, 0x221111 , TRUE ) ; break; } break; } SetDrawBlendMode( DX_BLENDMODE_NOBLEND , blend_pal ) ; }