Ejemplo n.º 1
0
/**
 * Calculate the color using the supplied angle.
 *
 * @param angle The selected color's position expressed as angle (in rad).
 *
 * @return The ARGB value of the color on the color wheel at the specified
 *         angle.
 */
int calculateColor(float angle) {
   float unit = (float) (angle / (2 * PI));
   if (unit < 0) {
      unit += 1;
   }

   if (unit <= 0) {
      mColor = COLORS[0];
      return COLORS[0];
   }
   if (unit >= 1) {
      mColor = COLORS[sizeof(COLORS)/sizeof(COLORS[0]) - 1];
      return COLORS[sizeof(COLORS)/sizeof(COLORS[0]) - 1];
   }

   float p = unit * (sizeof(COLORS)/sizeof(COLORS[0]) - 1);
   int i = (int) p;
   p -= i;

   int c0 = COLORS[i];
   int c1 = COLORS[i + 1];
   int a = ave(alpha(c0), alpha(c1), p);
   int r = ave(red(c0), red(c1), p);
   int g = ave(green(c0), green(c1), p);
   int b = ave(blue(c0), blue(c1), p);

   mColor = argb(a, r, g, b);
   return argb(a, r, g, b);
}
Ejemplo n.º 2
0
int CBackStage6::Draw(){
	D3DCOLOR color = xrgb(20,0,70);
	Sun3D.Clear( color );
	RECT rect;

	x = 0;
	y = 0;
	z = 0;
	ax = x;
	ay = 0;
	az = 100;

	//ビュー行列
	D3DXVECTOR3 eye( x, y, z );		//視点
	D3DXVECTOR3 at( x, ay, az );	//注視点
	D3DXVECTOR3 up( 0, 1, 0 );		//上方向
	D3DXMATRIX	view;
	D3DXMatrixLookAtLH( &view, &eye, &at, &up );
	Sun3D.SetTransform( D3DTS_VIEW, &view );

	//フォグON
	Sun3D.SetRenderState(D3DRS_FOGCOLOR,color);
	Sun3D.SetRenderState(D3DRS_FOGENABLE,true);

	SunSprite3D sprite3D(&imgHyoga);

	//床
	sprite3D.SetTexture(&imgYuki);
	SetRect(&rect,0,-512,512,512);
	sprite3D.CreateRectZX( rect, -100 );
	sprite3D.SetRepeat( 1, 1 );
	sprite3D.Move( 0, 0, -(count*10) % 512 );
	sprite3D.Draw();
	sprite3D.Move( 0, 0, 512 );
	sprite3D.Draw();
	sprite3D.Move( 0, 0, 512 );
	sprite3D.Draw();

	//フォグOFF
	Sun3D.SetRenderState(D3DRS_FOGENABLE,false);

	//雲
	Sun3D.SetBlendingType( BLEND_ADD );
	D3DCOLOR c = argb(100,100,50,0);
	imgHyoga.DrawClip( (-10*count) % 512, 0, c );
	imgHyoga.DrawClip( (-10*count) % 512 + 512, 0, c );
	imgHyoga.DrawClip( (-10*count) % 512 + 1024, 0, c );

	c = argb(100,0,50,100);
	imgHyoga.DrawClip( (10*count) % 512, 0, c );
	imgHyoga.DrawClip( (10*count) % 512 - 512, 0, c );
	imgHyoga.DrawClip( (10*count) % 512 - 1024, 0, c );
	Sun3D.SetBlendingType( BLEND_NORMAL );
	return 1;
}
Ejemplo n.º 3
0
int CTalkChirno1::Thread(){

	chara = 0;
	face = 0;
	enemy_face = -1;
	font.CreateList("いるんだろ?\n出てこいよ。");
	Talk();

	for( int i = 0; i < 46; i++ ) {
		g_pBoss->Appear();
		SunEffectRect flame;
		flame.m_color = argb(127,0,0,0);
		SetRect(&flame.m_rect,GAME_LEFT+60,350,GAME_RIGHT-60,430);
		D3DCOLOR color = mono(128+127*(chara==0));
		int cx = - (chara != 0) * 20;
		int cy = (chara != 0) * 20;
		DrawMarisa(-200+cx,60+cy,face,manfu,color);
		flame.Draw();
		if( !GetInputState( INP_B6 ) )
			mt.Suspend();
	}

	chara = 1;
	enemy_face = 3;
	font.CreateList("な、なんで分かったのよ……");
	fntEnemy.CreateList("氷精 チルノ",16);
	Talk();

	chara = 0;
	face = 1;
	font.CreateList("妖精が現れるのには、前触れがあるんだぜ、\n知らないのか?");
	Talk();

	return 1;
}
Ejemplo n.º 4
0
	void operator()(const tbb::blocked_range<short>& range) const {
		for (short labelid=range.begin(); labelid!=range.end(); ++labelid) {
			// Compute mask.
			// For big images it might make sense to parallelize this on a
			// smaller granularity (pixel ranges).
			// And it might be a good idea to cache these.
			cv::Mat1b mask(labels == labelid);

			if(tbb::task::self().is_cancelled()) {
				//GGDBGM("aborted through tbb cancel." << endl);
				return;
			}

			// transform mask into icon
			cv::Mat1b masktrf = cv::Mat1b::zeros(iconSizecv);
			cv::warpAffine(mask, masktrf, trafo, iconSizecv, CV_INTER_AREA);

			if(tbb::task::self().is_cancelled()) {
				//GGDBGM("aborted through tbb cancel." << endl);
				return;
			}
			// The rest is probably too fast to allow checking for cancellation.

			QColor color = ctx.colors.at(labelid);

			// Fill icon with solid color in ARGB format.
			cv::Vec4b argb(0, color.red(), color.green(), color.blue());
			cv::Mat4b icon = cv::Mat4b(iconSizecv.height,
									   iconSizecv.width,
									   argb);

			// Now apply alpha channel.
			// Note: this is better than OpenCV's mask functionality as it
			// preserves the antialiasing!

			// Make ARGB 'array' which is interleaved to a true ARGB image
			// using mixChannels.
			const cv::Mat1b zero = cv::Mat1b::zeros(iconSizecv.height,
													iconSizecv.width);
			const cv::Mat in[] = {masktrf, zero, zero, zero};
			// Copy only the alpha channel (0) of the in array into the
			// alpha channel (0) of the ARGB icon.
			const int mix[] = {0,0};
			// 4 input matrices, 1 dest, 1 mix-pair
			cv::mixChannels(in,4, &icon,1, mix,1);
			// convert the result to a QImage
			QImage qimage = Mat2QImage(icon);

			/* draw a border (alternative: the icon view could do this) */
			QPainter p(&qimage);
			QPen pen(color);
			// ensure border visibility, fixed to 1px
			pen.setWidthF(1.f);
			p.setPen(pen);
			p.drawRect(brect);

			ctx.icons[labelid] = qimage;
		}
	}
Ejemplo n.º 5
0
Archivo: value.c Proyecto: kebekus/srt
int64_t stripe(struct stripe_data *sd, int j)
{
	uint32_t *fb = sd->fb;
	int w = sd->w;
	v4sf dU = sd->dU;
	v4sf dV = sd->dV;
	m34sf UV = sd->UV;
	struct sphere sphere = sd->sphere;
	struct aabb aabb = sd->aabb;
	struct camera camera = sd->camera;
	float a = sd->a;
	int use_aabb = sd->use_aabb;
	v4sf jdV = v4sf_set1(j) * dV;
	int64_t pixels = 0;
	for (int i = 0; i < (w & ~1); i += 2) {
		v4sf idU = v4sf_set1(i) * dU;
		m34sf scr = m34sf_addv(UV, jdV + idU);
		m34sf dir = m34sf_normal(m34sf_addv(scr, camera.dir));
		struct ray ray = init_ray(m34sf_splat(camera.origin), dir);
		i4sf l;
		uint32_t color[4] = { 0, 0, 0, 0 };
		v4su test;
		if (use_aabb)
			test = aabb_ray(&l, aabb, ray);
		else
			test = sphere_ray(&l, sphere, ray);
		test &= v4sf_gt(l.max, v4sf_set1(0));
		if (!v4su_all_zeros(test)) {
			pixels += 4;
			l.min = v4sf_max(l.min, v4sf_set1(0));
			l.min = v4sf_and(test, l.min);
			l.max = v4sf_and(test, l.max);
			m34sf tmp = value(l, ray, a);
			color[0] = test[0] & argb(m34sf_get0(tmp));
			color[1] = test[1] & argb(m34sf_get1(tmp));
			color[2] = test[2] & argb(m34sf_get2(tmp));
			color[3] = test[3] & argb(m34sf_get3(tmp));
		}
		fb[w * (j+0) + (i+0)] = 0xff000000 | color[0];
		fb[w * (j+0) + (i+1)] = 0xff000000 | color[1];
		fb[w * (j+1) + (i+0)] = 0xff000000 | color[2];
		fb[w * (j+1) + (i+1)] = 0xff000000 | color[3];
	}
	return pixels;
}
Ejemplo n.º 6
0
//--------------------------------------------------------------
void testApp::update() {
  if (origin.y > 0) {
    unsigned char *data = pixelsBelowWindow(origin.x, origin.y, 400, 400);
    cv::Mat argb(400, 400, CV_8UC4, data);
    cv::Mat rgb(400, 400, CV_8UC3);
    int fromTo[] = {1,0, 2,1, 3,2};
    mixChannels(&argb, 1, &rgb, 1, fromTo, 3);
    ofxCv::toOf(rgb, image);
    image.reloadTexture();
    
    getStateFromImage();
    findAnswer();
    
    if (selected.size()) {
      mouseThread.move(origin.x + (selected[0] + (ofRandom(1) < 0.5 ? -1 : 1)) * 50 + 23,
                       origin.y + selected[1] * 50 + 23);
      return;
    }
    
    if (wildcard.size()) {
        mouseThread.click(origin.x + wildcard[0] * 50 + 23, origin.y + wildcard[1] * 50 + 23);
        return;
//      int max_count = 0;
//      unsigned int max_id = 0;
//      for (map<unsigned int, int>::iterator it = count.begin(); it != count.end(); it++) {
//        if (it->second > max_count) {
//          max_count = it->second;
//          max_id = it->first;
//        }
//      }
//      if (max_count > 0) {
//        cout << "max_id: " << max_id << ", count: " << max_count << endl;
//        for (int i = 0; i < wildcard.size(); i += 2) {
//          int x = wildcard[i];
//          int y = wildcard[i + 1];
//          if (state[x][y].id == max_id) {
//            mouseThread.click(origin.x + x * 50 + 23, origin.y + y * 50 + 23);
//            return;
//          }
//        }
//      }
    }
    
    if (answers.size() > 0) {
      Answer ans = answers.at(ofRandom(MIN(answers.size(), 3)));
      mouseThread.drag(origin.x + ans.x1 * 50 + 23,
                       origin.y + ans.y1 * 50 + 23,
                       origin.x + ans.x2 * 50 + 23,
                       origin.y + ans.y2 * 50 + 23);
    }
  }
}
Ejemplo n.º 7
0
int CTalkMystia1::Thread(){
	chara = 0;
	face = 0;
	enemy_face = -1;
	font.CreateList("あー何だろな、この場所は");
	Talk();

	for( int i = 0; i < 46; i++ ) {
		g_pBoss->Appear();
		SunEffectRect flame;
		flame.m_color = argb(127,0,0,0);
		SetRect(&flame.m_rect,GAME_LEFT+60,350,GAME_RIGHT-60,430);
		D3DCOLOR color = mono(128+127*(chara==0));
		int cx = - (chara != 0) * 20;
		int cy = (chara != 0) * 20;
		DrawMarisa(-200+cx,60+cy,face,manfu,color);
		flame.Draw();
		if( !GetInputState( INP_B6 ) )
			mt.Suspend();
	}

	chara = 1;
	enemy_face = 2;
	font.CreateList("ある〜晴れ〜た日〜の事〜♪");
	fntEnemy.CreateList("みみずくの夜 ミスティア",16);
	Talk();

	chara = 0;
	face = 4;
	font.CreateList("なんだ、夜雀の巣か");
	Talk();

	chara = 1;
	enemy_face = 2;
	font.CreateList("魔砲以上の〜愉快な〜♪");
	Talk();

	chara = 0;
	face = 3;
	manfu = 3;
	font.CreateList("歌うな!");
	Talk();

	return 1;
}
Ejemplo n.º 8
0
void CTalk::Talk(){
	if( g_pTitle->talk ) {
		SunEffectRect flame;
		flame.m_color = argb(127,0,0,0);
		SetRect(&flame.m_rect,GAME_LEFT+60,350,GAME_RIGHT-60,430);
		do{
			mt.Suspend();
			int mae = (chara != 0 && chara != 2);
			D3DCOLOR color = mono(128+127*(!mae));
			int cx = - mae * 20;
			int cy = mae * 20;
			DrawMarisa(-200+cx,60+cy,face,manfu,color);
			RECT rect;
			switch( manfu ) {
			case 0://驚
				SetRect(&rect,0,0,48,64);
				break;
			case 1://困
				SetRect(&rect,48,0,128,64);
				break;
			case 2://汗
				SetRect(&rect,128,0,160,64);
				break;
			case 3://怒
				SetRect(&rect,160,0,208,64);
				break;
			default:
				break;
			}
			if( manfu != -1 )
				g_pMaterial->imgManfu.DrawRectClip(40+cx,90+cy,rect,color);
			if( g_pTitle->otaku )
				DrawEnemy();
			flame.Draw();

			D3DCOLOR c1 = (chara==1) ? ENEMY_TALK_COLOR : MARISA_TALK_COLOR;
			D3DCOLOR c2 = ENEMY_TALK_COLOR;
			font.DrawFormat(100,370,c1);
			font2.DrawFormat(100,400,c2);
			fntEnemy.DrawFormat(500-16*fntEnemy.m_str.size()/2,340,ENEMY_NAME_COLOR);
		}while( !Next() );
	}
}
Ejemplo n.º 9
0
void InstrumentGrid::setLights(const color::FColorList& colors) {
    MessageManagerLock l;

    auto size = jmin(colors.size(), instruments_.size());
    for (auto i = 0; i < size; ++i) {
        auto& c = colors.get(i);
        uint32 argb;
        if (useGamma_) {
            auto c2 = c;
            c2.gamma(gamma_);
            argb = c2.argb();
        } else {
            argb = c.argb();
        }
        instruments_[i]->setColor(Colour(argb));
    }

    for (auto i = size; i < instruments_.size(); ++i)
        instruments_[i]->setColor(Colours::black);
    pythonRepaint();
}
Ejemplo n.º 10
0
int CTalkLety2::Thread(){
	chara = 0;
	face = 0;
	enemy_face = -1;
	font.CreateList("さあ、そろそろ黒幕においで願おうか");
	Talk();

	for( int i = 0; i < 46; i++ ) {
		g_pBoss->Appear();
		SunEffectRect flame;
		flame.m_color = argb(127,0,0,0);
		SetRect(&flame.m_rect,GAME_LEFT+60,350,GAME_RIGHT-60,430);
		D3DCOLOR color = mono(128+127*(chara==0));
		int cx = - (chara != 0) * 20;
		int cy = (chara != 0) * 20;
		DrawMarisa(-200+cx,60+cy,face,manfu,color);
		flame.Draw();
		if( !GetInputState( INP_B6 ) )
			mt.Suspend();
	}

	chara = 1;
	enemy_face = 0;
	font.CreateList("あら、あなたはこの美しく輝くオーロラが\n黒く見えるの?");
	fntEnemy.CreateList("冬の落とし子 レティ",16);
	Talk();

	chara = 0;
	face = 1;
	font.CreateList("黒くたって輝けるんだぜ。\n知らないのか?");
	Talk();

	chara = 1;
	enemy_face = 1;
	font.CreateList("輝くのはあなたじゃなくて、\nあなたの魔法でしょう?");
	Talk();

	chara = 0;
	face = 0;
	font.CreateList("つれないなあ。\nそんなだからこんな寒い冬にしちまうんだぜ?");
	Talk();

	chara = 1;
	enemy_face = 0;
	font.CreateList("私はいつも通り冬を運んだだけ。\n巫女が出てこないのが何よりの証拠よ");
	Talk();

	chara = 0;
	face = 1;
	font.CreateList("私は魔法使いだぜ、\n寒さをしのぐ魔法なんて夕飯前だ");
	Talk();

	chara = 1;
	enemy_face = 1;
	font.CreateList("あなた達人間は、少しばかり近視眼になっている。\n少しは妖怪を見習ったらどう?");
	Talk();

	chara = 0;
	face = 0;
	font.CreateList("妖怪は退治するものだぜ");
	Talk();

	chara = 1;
	enemy_face = 1;
	font.CreateList("妖怪は自然を司る……");
	Talk();

	chara = 1;
	enemy_face = 0;
	font.CreateList("自然に依存する人間は、\n自然のしっぺ返しを食らうことになる");
	Talk();

	chara = 2;
	enemy_face = 1;
	face = 1;
	font.CreateList("黒の魔法を食らわせてやろう、冬の妖怪");
	font2.CreateList("白き冬を味わわせてあげるわ、魔法使い");
	Talk();

	PlayBGM("tbm_lety");
	return 1;
}
Ejemplo n.º 11
0
int CTalkChirno2::Thread(){

	chara = 0;
	face = 3;
	enemy_face = -1;
	font.CreateList("む、誰だ!");
	Talk();

	for( int i = 0; i < 46; i++ ) {
		g_pBoss->Appear();
		SunEffectRect flame;
		flame.m_color = argb(127,0,0,0);
		SetRect(&flame.m_rect,GAME_LEFT+60,350,GAME_RIGHT-60,430);
		D3DCOLOR color = mono(128+127*(chara==0));
		int cx = - (chara != 0) * 20;
		int cy = (chara != 0) * 20;
		DrawMarisa(-200+cx,60+cy,face,manfu,color);
		flame.Draw();
		if( !GetInputState( INP_B6 ) )
			mt.Suspend();
	}

	chara = 1;
	enemy_face = 2;
	font.CreateList("さっき遭ったじゃない!");
	fntEnemy.CreateList("氷精 チルノ",16);
	Talk();

	chara = 0;
	face = 1;
	font.CreateList("そうだったか?");
	Talk();

	chara = 1;
	enemy_face = 1;
	font.CreateList("ふん、\nこの寒さで頭がおかしくなったんじゃない?");
	Talk();

	chara = 0;
	face = 0;
	font.CreateList("ところでこの寒さは……");
	Talk();

	chara = 1;
	enemy_face = 0;
	font.CreateList("ふっふっふ");
	Talk();

	chara = 0;
	face = 1;
	font.CreateList("お前以外の誰の仕業だ?");
	Talk();

	chara = 1;
	enemy_face = 1;
	font.CreateList("むっ");
	Talk();

	chara = 0;
	face = 2;
	font.CreateList("って、知らなさそうだな\nそもそもおまえは夏以外出没禁止なんだが");
	Talk();

	chara = 1;
	enemy_face = 2;
	font.CreateList("大ガマが冬眠している今こそ、\n私が活躍するチャンスなのよ!");
	Talk();

	chara = 0;
	face = 0;
	font.CreateList("まぁいいや。");
	Talk();
	face = 1;
	font.CreateList("3×3は?");
	Talk();

	chara = 1;
	enemy_face = 1;
	font.CreateList("�H!");
	Talk();

	StopBGM();
	PlayBGM("tbm_otenba");
	g_lEffect3.Add( new CEffectFont("♪バカとバカの境界",bgmFontColor,380,420) );

	return 1;
}
Ejemplo n.º 12
0
void drawFrame(GifFileType* gif, AndroidBitmapInfo*  info, int* pixels, int frame_no, bool force_dispose_1) {
  GifColorType *bg;
  GifColorType *color;
  SavedImage * frame;
  ExtensionBlock * ext = 0;
  GifImageDesc * frameInfo;
  ColorMapObject * colorMap;
  int *line;
  int width, height,x,y,j,loc,n,inc,p;
  int* px;

  width = gif->SWidth;
  height = gif->SHeight;

  frame = &(gif->SavedImages[frame_no]);
  frameInfo = &(frame->ImageDesc);
  if (frameInfo->ColorMap) {
      colorMap = frameInfo->ColorMap;
    } else {
      colorMap = gif->SColorMap;
  }

  bg = &colorMap->Colors[gif->SBackGroundColor];

  for (j=0; j<frame->ExtensionBlockCount; j++) {
    if (frame->ExtensionBlocks[j].Function == GRAPHICS_EXT_FUNC_CODE) {
      ext = &(frame->ExtensionBlocks[j]);
      break;
    }
  }

  // For dispose = 1, we assume its been drawn
  px = pixels;
  if (ext && dispose(ext) == 1 && force_dispose_1 && frame_no > 0) {
    drawFrame(gif, info, pixels, frame_no-1, true);
  }
  else if (ext && dispose(ext) == 2 && bg) {
    for (y=0; y<height; y++) {
      line = (int*) px;
      for (x=0; x<width; x++) {
        line[x] = argb(255, bg->Red, bg->Green, bg->Blue);
      }
      px = (char*)px + info->stride;
    }
  } else if (ext && dispose(ext) == 3 && frame_no > 1) {
    drawFrame(gif, info, pixels, frame_no-2, true);
  }
  px = pixels;
  if (frameInfo->Interlace && false) {
    n = 0;
    inc = 8;
    p = 0;
    px = (char*)px + info->stride*frameInfo->Top;
    for (y=frameInfo->Top; y<frameInfo->Top+frameInfo->Height; y++) {
      for (x=frameInfo->Left; x<frameInfo->Left+frameInfo->Width; x++) {
        loc = (y - frameInfo->Top)*frameInfo->Width + (x - frameInfo->Left);
        if (ext && frame->RasterBits[loc] == trans_index(ext) && transparency(ext)) {
          continue;
        }

        color = (ext && frame->RasterBits[loc] == trans_index(ext)) ? bg : &colorMap->Colors[frame->RasterBits[loc]];
        if (color)
          line[x] = argb(255, color->Red, color->Green, color->Blue);
      }
      px = (char*)px + info->stride*inc;
      n += inc;
      if (n >= frameInfo->Height) {
        n = 0;
        switch(p) {
          case 0:
          px = (char *)pixels + info->stride*(4+frameInfo->Top);
          inc = 8;
          p++;
          break;
          case 1:
          px = (char *)pixels + info->stride*(2+frameInfo->Top);
          inc = 4;
          p++;
          break;
          case 2:
          px = (char *)pixels + info->stride*(1+frameInfo->Top);
          inc = 2;
          p++;
        }
      }
    }
  }
  else {
    px = (char*)px + info->stride*frameInfo->Top;
    for (y=frameInfo->Top; y<frameInfo->Top+frameInfo->Height; y++) {
      line = (int*) px;
      for (x=frameInfo->Left; x<frameInfo->Left+frameInfo->Width; x++) {
        loc = (y - frameInfo->Top)*frameInfo->Width + (x - frameInfo->Left);
        if (ext && frame->RasterBits[loc] == trans_index(ext) && transparency(ext)) {
          continue;
        }
        color = (ext && frame->RasterBits[loc] == trans_index(ext)) ? bg : &colorMap->Colors[frame->RasterBits[loc]];
        if (color)
        	line[x] = argb(255, color->Red, color->Green, color->Blue);
      }
      px = (char*)px + info->stride;
    }
  }
}
Ejemplo n.º 13
0
//描画
int CSystem::Draw()
{
	int i;
	RECT rect;

	//ステージリザルト
	if( state == SYSTEM_RESULT ){
		switch( result_mode ) {
		case 0:
			DrawResult(200,100*(RESULT_COUNT-result_count),alpha(255));
			break;
		case 1:
			DrawResult(200,0,alpha(255));
			break;
		case 2:
			DrawResult(200,100*result_count,alpha(255));
			break;
		}
	}

	//システム背景
	if( draw_system ) {
		//上
		SetRect(&rect,0,0,256,48);
		imgSystem1.DrawRect(0,0,rect);

		SetRect(&rect,0,48,256,96);
		imgSystem1.DrawRect(256,0,rect);
		
		SetRect(&rect,0,96,128,144);
		imgSystem1.DrawRect(512,0,rect);

		//下
		SetRect(&rect,0,144,256,176);
		imgSystem1.DrawRect(0,448,rect);

		SetRect(&rect,0,176,256,208);
		imgSystem1.DrawRect(256,448,rect);

		SetRect(&rect,128,96,256,144);
		imgSystem1.DrawRect(512,448,rect);

		//左
		SetRect(&rect,0,0,24,256);
		imgSystem2.DrawRect(0,48,rect);

		SetRect(&rect,24,0,48,144);
		imgSystem2.DrawRect(0,304,rect);

		//右
		SetRect(&rect,48,0,88,256);
		imgSystem2.DrawRect(600,48,rect);

		SetRect(&rect,88,0,128,144);
		imgSystem2.DrawRect(600,304,rect);

		//ライフ
		for(i=0;i<life;++i){
			imgLife.Draw(93+i*24,7,alpha(255),1,(double)count/36*2);
		}
		//ボム
		for(i=0;i<bomb;++i){
			imgBomb.Draw(93+i*24,23,alpha(255),1.0+0.1*sin((double)count/36*10));
		}

		//魔法陣
		Sun3D.SetBlendingType(BLEND_ADD);
		imgMaho.Draw(414,440,alpha(255),0.8,(double)count/36);
		Sun3D.SetBlendingType(BLEND_NORMAL);

		//難易度
		SetRect(&rect,0,16+16*g_pGame->diff,88,32+16*g_pGame->diff);
		imgMoji.DrawRect(50,454,rect);

		//数値
		DrawNumber(480,7,score,8);
		DrawNumber(480,23,hiscore,8);
		if( power < 1000 ) {
			DrawNumber(340,7,power,3);
		}
		else {
			SetRect(&rect,208,0,248,16);
			imgMoji.DrawRect(340,7,rect);
		}
		DrawNumber(340,23,graze,3);

		//FPS
		DrawNumber(360,454,SunApp.m_obfps,2);

		//弾数
		DrawNumber(240,454,g_lTama.GetSize(),3);
		if( g_lTama.GetSize() > bullet )
			bullet = g_lTama.GetSize();

		//フルパワー
		if( fullpower_count > 0 ) {
			SetRect(&rect,0,72,190,96);
			imgMoji2.DrawRect(240,80,rect);
		}
		//スペルカードボーナス
		if( spellbonus_count > 0 ) {
			SetRect(&rect,0,96,120,120);
			imgMoji2.DrawRect(180,100,rect);
			if( spellbonus > 0 ) {
				SetRect(&rect,0,120,72,144);
				imgMoji2.DrawRect(320,100,rect,alpha(255));
				DrawNumber( 550,100,spellbonus,0,xrgb(255,255,255));
			}
			else {
				SetRect(&rect,72,120,144,144);
				imgMoji2.DrawRect(320,100,rect,alpha(255));
			}
		}
	}
	switch(state) {
	case SYSTEM_PAUSE:	//ポーズ中
		{
			SunEffectRect effect;
			SetRect(&effect.m_rect,GAME_LEFT,GAME_TOP,GAME_RIGHT,GAME_BOTTOM);
			effect.m_color = argb(200,0,0,0);
			effect.Draw();

			SetRect(&rect,0,128,96,160);
			imgMoji.DrawRect(250,130,rect);

			SetRect(&rect,0,160,216,191);
			imgMoji.DrawRect(200,200,rect,alpha(128+127*(pause_select==0)));

			SetRect(&rect,0,192,168,224);
			imgMoji.DrawRect(220,250,rect,alpha(128+127*(pause_select==1)));

			//リプレイモードでは「最初からやり直す」はなし
			if( g_pTitle->title_select != 3 ) {
				SetRect(&rect,0,224,254,255);
				imgMoji.DrawRect(200,300,rect,alpha(128+127*(pause_select==2)));
			}
		}
		break;
	case SYSTEM_GAMEOVER://ゲームオーバー
		{
			SunEffectRect effect;
			SetRect(&effect.m_rect,GAME_LEFT,GAME_TOP,GAME_RIGHT,GAME_BOTTOM);
			effect.m_color = argb(200,0,0,0);
			effect.Draw();

			SetRect(&rect,0,0,256,24);
			imgMoji2.DrawRect(200,130,rect);

			SetRect(&rect,0,24,216,48);
			imgMoji2.DrawRect(220,200,rect,alpha(128+127*(gameover_select==0)));

			SetRect(&rect,0,48,200,72);
			imgMoji2.DrawRect(220,250,rect,alpha(128+127*(gameover_select==1)));

			SetRect(&rect,144,120,224,144);
			imgMoji2.DrawRect(420,300,rect);
			DrawNumber(420+40,303,continue_rest,1);
		}
		break;
	case SYSTEM_REPLAY://リプレイ保存
		{
			SunEffectRect effect;
			SetRect(&effect.m_rect,GAME_LEFT,GAME_TOP,GAME_RIGHT,GAME_BOTTOM);
			effect.m_color = argb(200,0,0,0);
			effect.Draw();

			SetRect(&rect,0,144,256,168);
			imgMoji2.DrawRect(200,130,rect);

			if( continue_dirty == 0 ) {
				SetRect(&rect,120,96,200,120);
				imgMoji2.DrawRect(220,200,rect,alpha(128+127*(replay_select==0)));

				SetRect(&rect,200,96,256,120);
				imgMoji2.DrawRect(220,250,rect,alpha(128+127*(replay_select==1)));
			}else{
				SetRect(&rect,0,168,256,216);
				imgMoji2.DrawRect(220,200,rect);
			}
		}
		break;
	case SYSTEM_RESUME://ゲーム再開中
		{
			SunEffectRect effect;
			SetRect(&effect.m_rect,GAME_LEFT,GAME_TOP,GAME_RIGHT,GAME_BOTTOM);
			effect.m_color = argb(200,0,0,0);
			effect.Draw();
		}
		break;
	}
	return 1;
}
Ejemplo n.º 14
0
int CTitle::Draw()
{
	D3DVIEWPORT9 view = { 0, 0, WINDOW_WIDTH, WINDOW_WIDTH, 0.0, 1.0 };
	Sun3D.SetViewport( view );

	RECT rect;
	const int h = 32;
	const int h2 = 100;
	int x=50;
	int y=220;
	switch( mode ) {
	case 0: //タイトル画面
		if( g_pTitle->otaku ) {
			SetRect(&rect,0,0,512,480);
			g_pTitleMaterial->imgTitle.DrawRect(0,0,rect);
			SetRect(&rect,0,0,128,480);
			g_pTitleMaterial->imgRight.DrawRect(512,0,rect);
		}
		else
		Sun3D.Clear( xrgb(0,0,0));

		//Start
		SetRect(&rect,0,0,104,32);
		g_pTitleMaterial->imgTitleMoji.DrawRect(x,y,rect,alpha(128+127*(title_select==0)));
		y+=h;
		
		//Extra Start
		//SetRect(&rect,0,32,216,64);
		//g_pTitleMaterial->imgTitleMoji.DrawRect(50,190+h,rect,alpha(128+127*(title_select==1)));
		
		//Practice
		SetRect(&rect,0,64,150,96);
		g_pTitleMaterial->imgTitleMoji.DrawRect(x,y,rect,alpha(128+127*(title_select==2)));
		y+=h;
		
		//Replay
		SetRect(&rect,0,96,120,136);
		g_pTitleMaterial->imgTitleMoji.DrawRect(x,y,rect,alpha(128+127*(title_select==3)));
		y+=h;
		
		//Result
		SetRect(&rect,0,136,120,168);
		g_pTitleMaterial->imgTitleMoji.DrawRect(x,y,rect,alpha(128+127*(title_select==4)));
		y+=h;

		//Music Room
		//SetRect(&rect,0,168,200,208);
		//g_pTitleMaterial->imgTitleMoji.DrawRect(50,190+5*h,rect,alpha(128+127*(title_select==5)));

		//Option
		SetRect(&rect,0,208,128,248);
		g_pTitleMaterial->imgTitleMoji.DrawRect(x,y,rect,alpha(128+127*(title_select==6)));
		y+=h;
		
		//Quit
		SetRect(&rect,128,208,256,248);
		g_pTitleMaterial->imgTitleMoji.DrawRect(x,y,rect,alpha(128+127*(title_select==7)));
		y+=h;
		break;
	case 1: //難易度選択
		SetRect(&rect,0,0,512,480);
		g_pTitleMaterial->imgSelect.DrawRect(0,0,rect);
		SetRect(&rect,256,0,384,480);
		g_pTitleMaterial->imgRight.DrawRect(512,0,rect);

		for( int i = 0; i < 4; ++i ) {
			SetRect(&rect,0,128*i,256,128*(i+1));
			g_pTitleMaterial->imgDifficult.DrawRect(50,h2*i,rect,alpha(128+127*(difficult_select==i)));
		}
		break;
	case 2: //ステージ選択
		SetRect(&rect,0,0,512,480);
		g_pTitleMaterial->imgSelect.DrawRect(0,0,rect);
		SetRect(&rect,256,0,384,480);
		g_pTitleMaterial->imgRight.DrawRect(512,0,rect);

		for(int i = 1; i < 7; i++){
			SetRect(&rect,0,32,96,64);
			g_pTitleMaterial->imgStageMoji.DrawRect(400,100+50*i,rect,alpha(128+127*(stage_select==i)));
			SetRect(&rect,i*32,0,(i+1)*32,32);
			g_pTitleMaterial->imgStageMoji.DrawRect(500,100+50*i,rect,alpha(128+127*(stage_select==i)));
		}
		for( int i = 0; i < 4; ++i ) {
			SetRect(&rect,0,128*i,256,128*(i+1));
			g_pTitleMaterial->imgDifficult.DrawRect(50,h2*i,rect,alpha(128+127*(difficult_select==i)));
		}
		break;
	case 3: //リプレイ選択
		SetRect(&rect,0,0,512,480);
		g_pTitleMaterial->imgSelect.DrawRect(0,0,rect);
		SetRect(&rect,256,0,384,480);
		g_pTitleMaterial->imgRight.DrawRect(512,0,rect);

		for(int i = 0; i < REPLAY_NUM; i++){
			if( replay_exist[i] )
				DrawNumber(100+i/10*100,80+30*(i%10),i,2,alpha(128+127*(replay_select==i)),1);
		}
		break;
	case 4: //リザルト選択
		SetRect(&rect,0,0,512,480);
		g_pTitleMaterial->imgSelect.DrawRect(0,0,rect);
		SetRect(&rect,256,0,384,480);
		g_pTitleMaterial->imgRight.DrawRect(512,0,rect);

		SetRect(&rect,0,64,100,96);
		g_pTitleMaterial->imgStageMoji.DrawRect(200,200,rect,alpha(128+127*(result_select==0)));
		
		SetRect(&rect,100,64,256,96);
		g_pTitleMaterial->imgStageMoji.DrawRect(200,250,rect,alpha(128+127*(result_select==1)));

		break;
	case 6: //オプション
		SetRect(&rect,0,0,512,480);
		g_pTitleMaterial->imgSelect.DrawRect(0,0,rect);
		SetRect(&rect,256,0,384,480);
		g_pTitleMaterial->imgRight.DrawRect(512,0,rect);

		//コンフィグ
		for( int i = 0; i < 8; ++i ) {
			rect.left = 0;
			rect.top = 32*i;
			rect.bottom = 32*(i+1);
			int right[] = {80,112,112,112,128,112,144,80};
			rect.right = right[i];
			g_pTitleMaterial->imgConfig.DrawRect(50,64+32*i,rect,alpha(128+127*(option_select==i)));
		}
		//FullScrean
		SetRect(&rect,96,0,256,32);
		g_pTitleMaterial->imgConfig.DrawRect(200,64,rect,alpha(128+127*(optMode.m_now==0)));
		//Window
		SetRect(&rect,128,32,256,64);
		g_pTitleMaterial->imgConfig.DrawRect(360,64,rect,alpha(128+127*(optMode.m_now==1)));
		//16Bit
		SetRect(&rect,128,64,256,96);
		g_pTitleMaterial->imgConfig.DrawRect(200,96,rect,alpha(128+127*(optGraphic.m_now==16)));
		//32Bit
		SetRect(&rect,128,96,256,128);
		g_pTitleMaterial->imgConfig.DrawRect(360,96,rect,alpha(128+127*(optGraphic.m_now==32)));
		//BGMVol
		{
			SunEffectGauge gauge;
			SetRect( &gauge.m_rect, 200, 132, 400, 156 );
			gauge.m_point = (double)optBGMVol.m_now/100.0;
			gauge.m_downColor = xrgb(0,0,0);
			gauge.m_yoko = 1;
			gauge.Draw();

			gauge.m_rect.left += 1;
			gauge.m_rect.top += 1;
			gauge.m_rect.right -= 1;
			gauge.m_rect.bottom -= 1;
			gauge.m_downColor = xrgb(255,255,255);
			gauge.Draw();
		}
		//SEVol
		{
			SunEffectGauge gauge;
			SetRect( &gauge.m_rect, 200, 164, 400, 188 );
			gauge.m_point = (double)optSEVol.m_now/100.0;
			gauge.m_downColor = xrgb(0,0,0);
			gauge.m_yoko = 1;
			gauge.Draw();

			gauge.m_rect.left += 1;
			gauge.m_rect.top += 1;
			gauge.m_rect.right -= 1;
			gauge.m_rect.bottom -= 1;
			gauge.m_downColor = xrgb(255,255,255);
			gauge.Draw();
		}
		//Interval
		{
			SetRect(&rect,1*24,0,(1+1)*24,32);
			g_pTitleMaterial->imgKeyConfig.DrawRect(200,64+32*4,rect,alpha(128+127*(optInterval.m_now==1)));
			SetRect(&rect,2*24,0,(2+1)*24,32);
			g_pTitleMaterial->imgKeyConfig.DrawRect(250,64+32*4,rect,alpha(128+127*(optInterval.m_now==2)));
			SetRect(&rect,3*24,0,(3+1)*24,32);
			g_pTitleMaterial->imgKeyConfig.DrawRect(300,64+32*4,rect,alpha(128+127*(optInterval.m_now==3)));
		}
		break;
	case 7: //キーコンフィグ
		SetRect(&rect,0,0,512,480);
		g_pTitleMaterial->imgSelect.DrawRect(0,0,rect);
		SetRect(&rect,256,0,384,480);
		g_pTitleMaterial->imgRight.DrawRect(512,0,rect);

		//コンフィグ
		for( int i = 0; i < 7; ++i ) {
			SetRect(&rect,0,32*(i+1),150,32*(i+2));
			g_pTitleMaterial->imgKeyConfig.DrawRect(50,64+32*i,rect,alpha(128+127*(config_select==i)));
			//数字
			int inp  = optKeyConfig[i].m_now;
			SetRect(&rect,inp%10*24,0,(inp%10+1)*24,32);
			g_pTitleMaterial->imgKeyConfig.DrawRect(326,64+32*i,rect);
			SetRect(&rect,inp/10*24,0,(inp/10+1)*24,32);
			g_pTitleMaterial->imgKeyConfig.DrawRect(300,64+32*i,rect);
		}
		//Reset
		{
			rect.left = 0;
			rect.top = 32*5;
			rect.bottom = 32*(5+1);
			rect.right = 112;
			g_pTitleMaterial->imgConfig.DrawRect(50,64+32*7,rect,alpha(128+127*(config_select==7)));
		}
		//Quit
		{
			rect.left = 0;
			rect.top = 32*7;
			rect.bottom = 32*(7+1);
			rect.right = 80;
			g_pTitleMaterial->imgConfig.DrawRect(50,64+32*8,rect,alpha(128+127*(config_select==8)));
		}
		break;
	case 8: //Score
		SetRect(&rect,0,0,512,480);
		g_pTitleMaterial->imgSelect.DrawRect(0,0,rect);
		SetRect(&rect,256,0,384,480);
		g_pTitleMaterial->imgRight.DrawRect(512,0,rect);

		//Easy
		SetRect(&rect,0,128,72,160);
		g_pTitleMaterial->imgStageMoji.DrawRect(100,150,rect);

		SetRect(&rect,72,128,180,160);
		g_pTitleMaterial->imgStageMoji.DrawRect(100,200,rect);

		SetRect(&rect,180,128,256,160);
		g_pTitleMaterial->imgStageMoji.DrawRect(100,250,rect);

		SetRect(&rect,0,160,120,192);
		g_pTitleMaterial->imgStageMoji.DrawRect(100,300,rect);

		for( int i = 0; i < 4; ++i ) {
			DrawNumber(250,150+50*i,g_pRecord->data.score[i].score,8,alpha(255),1);
		}
		break;
	case 9: //Spell Card
		{
			SetRect(&rect,0,0,512,480);
			g_pTitleMaterial->imgSelect.DrawRect(0,0,rect);
			SetRect(&rect,256,0,384,480);
			g_pTitleMaterial->imgRight.DrawRect(512,0,rect);

			//スペルカード合計
			SetRect(&rect,160,32,192,64);
			g_pTitleMaterial->imgStageMoji.DrawRect(480,40,rect,alpha(255),0.75);
			DrawNumber(400,40,spell_sum,3,alpha(255),0.75);
			DrawNumber(510,40,SPELL_NUM*4,3,alpha(255),0.75);

			//難易度表示
			RECT rectdiff[] = {
				{0,128,72,160},
				{72,128,184,160},
				{184,128,256,160},
				{0,160,112,192}};
			g_pTitleMaterial->imgStageMoji.DrawRect(60,70,rectdiff[spell_difficult],alpha(255),0.75);
			//スペルカード合計(難易度別)
			SetRect(&rect,160,32,192,64);
			g_pTitleMaterial->imgStageMoji.DrawRect(480,70,rect,alpha(255),0.75);
			DrawNumber(400,70,spell_sum_diff,3,alpha(255),0.75);
			DrawNumber(510,70,SPELL_NUM,3,alpha(255),0.75);

			for( int i = 0; i < SPELL_DISPLAY; ++i ) {
				int num = spell_select*SPELL_DISPLAY+i;
				int a = 255;
				if( num < SPELL_NUM ) {
					int success = g_pRecord->data.spell[num][spell_difficult].success;
					int challenge = g_pRecord->data.spell[num][spell_difficult].challenge;
					if(success == 0)
						a = 127;

					fontSpellName[i].DrawFlame(60,110+30*i,alpha(a),argb(a,0,0,0));
					SetRect(&rect,160,32,192,64);
					g_pTitleMaterial->imgStageMoji.DrawRect(480,100+30*i,rect,alpha(a),0.75);
					DrawNumber(400,100+30*i,success,3,alpha(a),0.75);
					DrawNumber(510,100+30*i,challenge,3,alpha(a),0.75);

				}
			}
		}
		break;
	case 10: //Other Result
		break;
	}
	return 1;
}