Пример #1
0
void Board::ChangeColor(int x, int y, int color)
{
	board[x][y] = color;
    if (x - 1 >= 0 && board[x - 1][y] == oldcolor)
        ChangeColor(x - 1, y, color);
    if (x + 1 < BOARD_SIZE && board[x + 1][y] == oldcolor)
        ChangeColor(x + 1, y, color);
    if (y - 1 >= 0 && board[x][y - 1] == oldcolor)
        ChangeColor(x, y - 1, color);
    if (y + 1 < BOARD_SIZE && board[x][y + 1] == oldcolor)
        ChangeColor(x, y + 1, color);
}
Пример #2
0
// adds text element
char *Add_Inline_Text (document_rendering_context_t *cx, char *text, document_tag_text_t *tag)
{
	char *s, *d;
	char *buf;
	size_t size;

	size = strlen (text) + strlen (tag->text) + 1;
	buf = (char *) Q_malloc (size);
	strlcpy (buf, text, size);
	Q_free (text);

	d = buf + strlen(buf);
	s = tag->text;

	while (*s)
	{
		char c = *s++;

		if (cx->do_color)
			c = ChangeColor(c);

		*d++ = c;
	}

	*d = 0;

	return buf;
}
Пример #3
0
void Decepticon :: DrawPause()
{
	if (anti_aliasing)
	{
		glEnable (GL_LINE_SMOOTH);
		glEnable (GL_BLEND);
		glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
		glLineWidth (1.5);
	}  // if statement

	ChangeColor(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);

	glBegin(display_mode);			// pause button face
		glNormal3f(0, 0, 1);
		glVertex3f(12.5, -1.5, 2.5);
		glVertex3f(12.5, -7.5, 2.5);
		glVertex3f(1.5, -7.5, 2.5);
		glVertex3f(1.5, -1.5, 2.5);
	glEnd();

	glBegin(display_mode);			// pause button right edge
		glNormal3f(1, 0, 0);
		glVertex3f(12.5, -1.5, 2.5);
		glVertex3f(12.5, -7.5, 2.5);
		glVertex3f(12.5, -7.5, 0);
		glVertex3f(12.5, -1.5, 0);
	glEnd();

	glBegin(display_mode);			// pause button left edge
		glNormal3f(-1, 0, 0);
		glVertex3f(1.5, -1.5, 2.5);
		glVertex3f(1.5, -7.5, 2.5);
		glVertex3f(1.5, -7.5, 0);
		glVertex3f(1.5, -1.5, 0);
	glEnd();

	glBegin(display_mode);			// pause button bottom edge
		glNormal3f(0, -1, 0);
		glVertex3f(12.5, -7.5, 2.5);
		glVertex3f(1.5, -7.5, 2.5);
		glVertex3f(1.5, -7.5, 0);
		glVertex3f(12.5, -7.5, 0);
	glEnd();

	glBegin(display_mode);			// pause button top edge
		glNormal3f(0, 1, 0);
		glVertex3f(12.5, -1.5, 2.5);
		glVertex3f(1.5, -1.5, 2.5);
		glVertex3f(1.5, -1.5, 0);
		glVertex3f(12.5, -1.5, 0);
	glEnd();

	//GLfloat mat_ambient[] = {0.0, 0.0, 1.0, 1.0};
	//GLfloat mat_diffuse[] = {0.0, 0.0, 0.8, 1.0};
	//glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
	//glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
}  // DrawPause
Пример #4
0
int main(int argc, char ** argv) {
  
  palette * palheta;
  bufferdevice * dispositivo;
  window * janela;
  object * poligono1, * poligono2, * poligono3;
  
  SetWorld(-20, 10, -20, 15); // Define o tamanho do mundo  
  dispositivo = CreateBuffer(640,480); // cria um dispositivo
  
  palheta = CreatePalette(4);
  SetColor(0,0,0,palheta);  
  SetColor(1,0,0,palheta);
  SetColor(0,0,1,palheta);
  SetColor(1,1,0,palheta);
  
  poligono1 = CreateObject(5);
  poligono2 = CreateObject(4);
  
  SetObject(SetPoint(-9.0,-8.0,1), poligono1);
  SetObject(SetPoint(-7.0,-3.0,1), poligono1);
  SetObject(SetPoint(-4.0,-4.0,1), poligono1);
  SetObject(SetPoint(-3.0,-6.0,1), poligono1);
  SetObject(SetPoint(-6.0,-9.0,1), poligono1);
  
  SetObject(SetPoint(-6.0,-2.0,2), poligono2);
  SetObject(SetPoint(-1.0,-2.0,2), poligono2);
  SetObject(SetPoint(-1.0,-6.0,2), poligono2);
  SetObject(SetPoint(-6.0,-6.0,2), poligono2);
  
  poligono1 = Translate(poligono1,5,5);        // centraliza em relação a origem do sistema
  poligono2 = Translate(poligono2,5,5); 

  poligono3 = Translate(poligono2,-1.5,-1.0);   
  poligono3 = Rotate(poligono3,45);
  poligono3 = Translate(poligono3,1.5,1.0);
  poligono3 = ChangeColor(poligono3,3);
  
  poligono1 = Scale(poligono1,0.4,0.4);
  poligono2 = Scale(poligono2,0.4,0.4);
  poligono3 = Scale(poligono3,0.4,0.4);
  
  janela = CreateWindow(-2.0,2.0,-2.0,2.0); // define uma janela de visualização
  
  DrawObject(poligono1,janela,dispositivo); // desenha o poligono 1 dentro da janela no buffer do dispositivo 
  DrawObject(poligono2,janela,dispositivo); // desenha o poligono 2 dentro da janela no buffer do dispositivo
  DrawObject(poligono3,janela,dispositivo); // desenha o poligono 3 dentro da janela no buffer do dispositivo  
  
  /*
   * O sistema RGB é aditivo pois cada cor nesse modelo é representada por uma soma ponderada de três componentes
   * primárias (o vermelho, o verde e o azul).
   */
  
  DumpX(dispositivo,palheta); // desenha o buffer na tela
  //DumpOpenGL(argc,argv,dispositivo,palheta);
  
  return 0;
  }
Пример #5
0
	virtual void Emit(const char* Message, const unsigned int ColorArgb) override
	{
		if (m_ConsoleHandle != INVALID_HANDLE_VALUE && m_LastColor != ColorArgb)
		{
			ChangeColor(ColorArgb);
		}
		printf(Message);
		OutputDebugStringA(Message);
	}
Пример #6
0
void Decepticon :: DrawStop()
{
	if (anti_aliasing)
	{
		glEnable (GL_LINE_SMOOTH);
		glEnable (GL_BLEND);
		glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
		glLineWidth (1.5);
	}  // if statement

	ChangeColor(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);

	glBegin(display_mode);			// stop button face
		glNormal3f(0, 0, 1);
		glVertex3f(-12.5, -1.5, 2.5);
		glVertex3f(-12.5, -7.5, 2.5);
		glVertex3f(-1.5, -7.5, 2.5);
		glVertex3f(-1.5, -1.5, 2.5);
	glEnd();

	glBegin(display_mode);			// stop button left edge
		glNormal3f(-1, 0, 0);
		glVertex3f(-12.5, -1.5, 2.5);
		glVertex3f(-12.5, -7.5, 2.5);
		glVertex3f(-12.5, -7.5, 0);
		glVertex3f(-12.5, -1.5, 0);
	glEnd();

	glBegin(display_mode);			// stop button right edge
		glNormal3f(1, 0, 0);
		glVertex3f(-1.5, -1.5, 2.5);
		glVertex3f(-1.5, -7.5, 2.5);
		glVertex3f(-1.5, -7.5, 0);
		glVertex3f(-1.5, -1.5, 0);
	glEnd();

	glBegin(display_mode);			// stop button bottom edge
		glNormal3f(0, -1, 0);
		glVertex3f(-12.5, -7.5, 2.5);
		glVertex3f(-1.5, -7.5, 2.5);
		glVertex3f(-1.5, -7.5, 0);
		glVertex3f(-12.5, -7.5, 0);
	glEnd();

	glBegin(display_mode);			// stop button top edge
		glNormal3f(0, 1, 0);
		glVertex3f(-12.5, -1.5, 2.5);
		glVertex3f(-1.5, -1.5, 2.5);
		glVertex3f(-1.5, -1.5, 0);
		glVertex3f(-12.5, -1.5, 0);
	glEnd();
}  // DrawStop
Пример #7
0
void cmd_go(void)
{
  SET (flags, THINK);
  CLEAR (flags, MANUAL);
  CLEAR (flags, TIMEOUT);
  CLEAR (flags, ENDED);
  computer = board.side;
  ExpectAnswerFromEngine( true );
  ChangeColor( true );
  SetDataToEngine( token[0] );
  pgnloaded = 0;
}
Пример #8
0
bool Board::SetColorByNumber(int color)
{
	if ((color==board[0][0]) || IsLose() || IsWin())
		return false;
	oldcolor = board[0][0];
	ChangeColor(0, 0, color);
	
	step_count++;
	// check for winnings
	win = CheckForWin();
	
	return true;
}
Пример #9
0
bool CDialogWindow::OnCommand(HWND hwndDlg, WORD command) {
	switch (command) {
	case IDC_BUTTON_BACKGROUND:
	{
		ChangeColor(hwndDlg, settingsNew.backgroundColor);
		break;
	}
	case IDC_BUTTON_FONT_UNSAT:
	{
		ChangeColor(hwndDlg, settingsNew.fontColorUnsat);
		break;
	}
	case IDC_BUTTON_FONT_SAT:
	{
		ChangeColor(hwndDlg, settingsNew.fontColorSat);
		break;
	}
	case IDC_BUTTON_LINE_CORR:
	{
		ChangeColor(hwndDlg, settingsNew.lineColorCorr);
		break;
	}
	case IDC_BUTTON_LINE_WRNG:
	{
		ChangeColor(hwndDlg, settingsNew.lineColorWrong);
		break;
	}
	case IDC_BUTTON_LINE_GRID:
	{
		ChangeColor(hwndDlg, settingsNew.lineColorGrid);
		break;
	}
	case IDC_CHECK1:
	{
		HWND checkCtrl = ::GetDlgItem(hwndDlg, IDC_CHECK1);
		isPreview = Button_GetCheck(checkCtrl) == BST_CHECKED;
		if( !isPreview ) {
			ApplySettings(settingsDefault);
		}
		break;
	}
	case IDC_OK:
	{
		settingsDefault = settingsNew;
		ApplySettings(settingsNew);
		::EndDialog(hwndDlg, 0);
		return true;
	}
	case IDC_CANCEL:
	{
		settingsNew = settingsDefault;
		ApplySettings(settingsDefault);
		::EndDialog(hwndDlg, 0);
		return true;
	}
	}
	MakePreview();
	return false;
}
Пример #10
0
void cmd_last(void)
{
  if (!pgnloaded)
    return;

  while (GameCnt+1 <= pgncnt) {
    ChangeColor( true );
    SetAutoGo( true );
    MakeMove (board.side, &Game[GameCnt+1].move);
  }

  printf("%d. ",GameCnt/2+1);
  printf("%s\n", Game[GameCnt].SANmv);
  ShowBoard ();
}
void
EditButtonWindow::SetNewColor( BMessage *msg)
{
	int cid;
	rgb_color cl,*startColor;
	ssize_t size;
	
	cid = msg->FindInt32("cid");
	msg->FindData( "color",B_RGB_COLOR_TYPE,(const void**)&startColor,&size );

	cl.red 		= startColor->red;
	cl.green 	= startColor->green;
	cl.blue 	= startColor->blue;

	ChangeColor(cid,cl);
}
void
CBEditTextPrefsDialog::SetReverseVideoColors()
{
	JXColormap* cmap = GetColormap();
	ChangeColor(CBPrefsManager::kTextColorIndex,        cmap->GetWhiteColor());
	ChangeColor(CBPrefsManager::kBackColorIndex,        cmap->GetBlackColor());
	ChangeColor(CBPrefsManager::kCaretColorIndex,       cmap->GetWhiteColor());
	ChangeColor(CBPrefsManager::kSelColorIndex,         cmap->GetBlueColor());
	ChangeColor(CBPrefsManager::kSelLineColorIndex,     cmap->GetCyanColor());
	ChangeColor(CBPrefsManager::kRightMarginColorIndex, cmap->GetGrayColor(80));
}
void
CBEditTextPrefsDialog::SetDefaultColors()
{
	JXColormap* cmap = GetColormap();
	ChangeColor(CBPrefsManager::kTextColorIndex,        cmap->GetBlackColor());
	ChangeColor(CBPrefsManager::kBackColorIndex,        cmap->GetWhiteColor());
	ChangeColor(CBPrefsManager::kCaretColorIndex,       cmap->GetRedColor());
	ChangeColor(CBPrefsManager::kSelColorIndex,         cmap->GetDefaultSelectionColor());
	ChangeColor(CBPrefsManager::kSelLineColorIndex,     cmap->GetBlueColor());
	ChangeColor(CBPrefsManager::kRightMarginColorIndex, cmap->GetGrayColor(70));
}
Пример #14
0
void Decepticon :: DrawFastForward()
{
	if (anti_aliasing)
	{
		glEnable (GL_LINE_SMOOTH);
		glEnable (GL_BLEND);
		glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
		glLineWidth (1.5);
	}  // if statement

	ChangeColor(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);

	glBegin(display_mode);			// fastforward button face
		glNormal3f(0, 0, 1);
		glVertex3f(15, 7.5, 2.5);
		glVertex3f(15, -7.5, 2.5);
		glVertex3f(27.5, 0, 2.5);
	glEnd();

	glBegin(display_mode);			// fastforward button left edge
		glNormal3f(-1, 0, 0);
		glVertex3f(15, 7.5, 2.5);
		glVertex3f(15, -7.5, 2.5);
		glVertex3f(15, -7.5, 0);
		glVertex3f(15, 7.5, 0);
	glEnd();

	glBegin(display_mode);			// fastforward button top right edge
		CalculateNormal(12.5, -7.5, 0, 12.5, -7.5, -2.5);
		glNormal3f(normal_vector[0], normal_vector[1], normal_vector[2]);
		glVertex3f(15, 7.5, 2.5);
		glVertex3f(27.5, 0, 2.5);
		glVertex3f(27.5, 0, 0);
		glVertex3f(15, 7.5, 0);
	glEnd();

	glBegin(display_mode);			// fastforward button bottom right edge
		CalculateNormal(12.5, 7.5, -2.5, 12.5, 7.5, 0);
		glNormal3f(normal_vector[0], normal_vector[1], normal_vector[2]);
		glVertex3f(15, -7.5, 2.5);
		glVertex3f(27.5, 0, 2.5);
		glVertex3f(27.5, 0, 0);
		glVertex3f(15, -7.5, 0);
	glEnd();
}  // DrawFastForward
Пример #15
0
void cmd_pgnreplay(void)
{
  char tmp_epd[]=".tmp.epd";
  char data[MAXSTR]="";
  FILE *epdfile=NULL;
  char epdline[MAXSTR]="";

  PGNReadFromFile (token[1],1);

  SaveEPD( tmp_epd );
  epdfile = fopen( tmp_epd, "r" );
  if ( fgets( epdline, MAXSTR, epdfile ) == NULL ) {
    printf( _("Incorrect epd file\n") );
    return;
  }

  strcpy( data, "setboard " );
  int i=0;
  while ( epdline[i] != '\n' ) {
    data[i+9] = epdline[i];
    ++i;
  }
  data[i+9] = '\0';

  SetDataToEngine( data );
  SetAutoGo( true );

  pgnloaded = 1;
  pgncnt = GameCnt;

  while (GameCnt >= 0) {
    if (GameCnt >= 0) {
      CLEAR (flags, ENDED);
      CLEAR (flags, TIMEOUT);
      ChangeColor( true );
      SetAutoGo( true );
      UnmakeMove (board.side, &Game[GameCnt].move);
      if (GameCnt >= 0) {
        UnmakeMove (board.side, &Game[GameCnt].move);
      }
    }
  }

  cmd_first();
}
Пример #16
0
void cmd_next(void)
{
  if (!pgnloaded)
    return;

  if ((GameCnt+1) <= pgncnt) {
    ChangeColor( true );
    SetAutoGo( true );
    MakeMove (board.side, &Game[GameCnt+1].move);
  } else {
    printf(_("No more moves. Game reached the end.\n"));
    return;
  }

  printf("%d. ",GameCnt/2+1);
  printf("%s\n", Game[GameCnt].SANmv);
  ShowBoard ();
}
Пример #17
0
void cmd_previous(void)
{
  if (!pgnloaded)
    return;

  if (GameCnt >= 0) {
    ChangeColor( true );
    SetAutoGo( true );
    UnmakeMove (board.side, &Game[GameCnt].move);
  }
  else {
    printf(_("Initial position reached. There are no earlier moves.\n"));
    return;
  }

  printf("%d. ",GameCnt/2+1);
  printf("%s\n", Game[GameCnt].SANmv);
  ShowBoard ();
}
Пример #18
0
//目次描画
void Help::DrawIndex(void)
{
	float extend = 1.0f;
	//ラベル
	DXLibMath::DrawRotaGraphResize(	0.5f, 0.17f, 1.0f, 0.0f, 
									DataManager::GetInstance().Get(DataManager::Help_Label), TRUE);
	for(int i=0; i<NUM_INDEX; i++)
	{
		DXLibMath::DrawRotaGraphResize(	0.5f, 0.408f + ((float)i * 0.06667f), m_I_Scale[i], 0.0f, 
									DataManager::GetInstance().Get(DataManager::Help_Index), TRUE);
	}
	// 文字表示
	int color = GetColor(255, 255, 255);
	for(int i=0; i<NUM_INDEX; i++)
	{
		color = ChangeColor(i);
		//m_Font.DrawFontString(FontManager::FontSet_AZUKI_25 , 280, 230+i*40, (char*)&g_Index[i][0],	400, color);
		m_Font.DrawCenter(FontManager::FontSet_AZUKI_25, 400, 230+i*40, const_cast<char*>(&g_Index[i][0]), color);
	}
}
Пример #19
0
void cmd_first(void)
{
  if (!pgnloaded)
    return;

  while (GameCnt >= 0) {
    if (GameCnt >= 0) {
      CLEAR (flags, ENDED);
      CLEAR (flags, TIMEOUT);
      ChangeColor( true );
      SetAutoGo( true );
      UnmakeMove (board.side, &Game[GameCnt].move);
      if (GameCnt >= 0) {
        UnmakeMove (board.side, &Game[GameCnt].move);
      }
    }
  }

  ShowBoard ();
}
Пример #20
0
void wxBasePlayerGameListCtrl::OnData(wxCoord x, wxCoord y, 
									  const Player &player)
{
	wxInt32 index = HitTest(wxPoint(x, y));
	
	if(-1 != index)
	{
		// If this is a drag happening from within the list, swap colors
		// instead of adding or removing.
		if(-1 != mDragIndex)
		{
			// Don't drop on the same person.
			if(index != mDragIndex)
			{
				// Get originator player.
				ColorType color = static_cast<ColorType>(mDragIndex);
				ColorMap::const_iterator it = sPlayers.find(color);
				if(sPlayers.end() != it)
				{
					ChangeColor(it->second, static_cast<ColorType>(index));
				}
			}
		}
		else
		{
			ColorType color = static_cast<ColorType>(index);

			// See if we have to remove an existing player from the game
			ColorMap::const_iterator it = sPlayers.find(color);
			if(sPlayers.end() != it)
			{
				RemovePlayer(it->second);
			}

			// Add the new player.
			AddPlayer(player, color);
		}
	}
}
Пример #21
0
void Decepticon :: DrawFoot()
{
	if (anti_aliasing)
	{
		glEnable (GL_LINE_SMOOTH);
		glEnable (GL_BLEND);
		glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
		glLineWidth (1.5);
	}  // if statement

	glScalef(1, 1, 0.85);
	ChangeColor(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0);

	glBegin(display_mode);			// foot toe plate
		CalculateNormal(20, 5, -2.5, 0, 5, -2.5);
		glNormal3f(normal_vector[0], normal_vector[1], normal_vector[2]);
		glVertex3f(-10, 0, 40);
		glVertex3f(-10, 5, 37.5);
		glVertex3f(10, 5, 37.5);
		glVertex3f(10, 0, 40);
	glEnd();

	glBegin(display_mode);			// foot top ramp
		CalculateNormal(20, 5, -27.5, 0, 5, -27.5);
		glNormal3f(normal_vector[0], normal_vector[1], normal_vector[2]);
		glVertex3f(-10, 5, 37.5);
		glVertex3f(-10, 10, 10);
		glVertex3f(10, 10, 10);
		glVertex3f(10, 5, 37.5);
	glEnd();

	glBegin(display_mode);			// foot top face
		glNormal3f(0, 1, 0);
		glVertex3f(-10, 10, 10);
		glVertex3f(-10, 10, -15);
		glVertex3f(10, 10, -15);
		glVertex3f(10, 10, 10);
	glEnd();

	glBegin(display_mode);			// foot back face
		CalculateNormal(20, 0, 0, 20, -10, -5);
		glNormal3f(normal_vector[0], normal_vector[1], normal_vector[2]);
		glVertex3f(-10, 10, -15);
		glVertex3f(10, 10, -15);
		glVertex3f(10, 0, -20);
		glVertex3f(-10, 0, -20);
	glEnd();

	glBegin(display_mode);			// foot left face
		glNormal3f(-1, 0, 0);
		glVertex3f(-10, 0, 40);
		glVertex3f(-10, 5, 37.5);
		glVertex3f(-10, 10, 10);
		glVertex3f(-10, 10, -15);
		glVertex3f(-10, 0, -20);
	glEnd();

	glBegin(display_mode);			// foot right face
		glNormal3f(1, 0, 0);
		glVertex3f(10, 0, 40);
		glVertex3f(10, 5, 37.5);
		glVertex3f(10, 10, 10);
		glVertex3f(10, 10, -15);
		glVertex3f(10, 0, -20);
	glEnd();

	glBegin(display_mode);			// foot bottom face
		glNormal3f(0, -1, 0);
		glVertex3f(-10, 0, 40);
		glVertex3f(10, 0, 40);
		glVertex3f(10, 0, -20);
		glVertex3f(-10, 0, -20);
	glEnd();

	glBegin(display_mode);			// foot top piece top slanted plate
		CalculateNormal(10, 0, 0, 10, 7.5, -15);
		glNormal3f(normal_vector[0], normal_vector[1], normal_vector[2]);
		glVertex3f(-5, 7.5, 25);
		glVertex3f(5, 7.5, 25);
		glVertex3f(5, 15, 10);
		glVertex3f(-5, 15, 10);
	glEnd();

	glBegin(display_mode);			// foot top piece top plate
		glNormal3f(0, 1, 0);
		glVertex3f(-5, 15, 10);
		glVertex3f(5, 15, 10);
		glVertex3f(5, 15, -5);
		glVertex3f(-5, 15, -5);
	glEnd();

	glBegin(display_mode);			// foot top piece left face
		glNormal3f(-1, 0, 0);
		glVertex3f(-5, 7.5, 25);
		glVertex3f(-5, 15, 10);
		glVertex3f(-5, 15, -5);
		glVertex3f(-5, 10, -10);
	glEnd();

	glBegin(display_mode);			// foot top piece right face
		glNormal3f(1, 0, 0);
		glVertex3f(5, 7.5, 25);
		glVertex3f(5, 15, 10);
		glVertex3f(5, 15, -5);
		glVertex3f(5, 10, -10);
	glEnd();

	glBegin(display_mode);			// foot top piece back face
		CalculateNormal(10, 5, 5, 10, 0, 0);
		glNormal3f(normal_vector[0], normal_vector[1], normal_vector[2]);
		glVertex3f(-5, 10, -10);
		glVertex3f(5, 10, -10);
		glVertex3f(5, 15, -5);
		glVertex3f(-5, 15, -5);
	glEnd();
}  // DrawFoot
Пример #22
0
void Decepticon :: DrawShoulder()
{
	if (anti_aliasing)
	{
		glEnable (GL_LINE_SMOOTH);
		glEnable (GL_BLEND);
		glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
		glHint (GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
		glLineWidth (1.5);
	}  // if statement

	glTranslatef (0, -20, -15);
	ChangeColor(0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.8, 1.0);

	glBegin(display_mode);				// shoulder back
		glNormal3f(0, 0, -1);
		glVertex3f(0, 0, -12.5);
		glVertex3f(0, 22.5, -12.5);
		glVertex3f(5, 27.5, -12.5);
		glVertex3f(20, 27.5, -12.5);
		glVertex3f(20, 10, -12.5);
		glVertex3f(7.5, 0, -12.5);
	glEnd();

	glBegin(display_mode);				// shoulder front
		glNormal3f(0, 0, 1);
		glVertex3f(0, 0, 12.5);
		glVertex3f(0, 22.5, 12.5);
		glVertex3f(5, 27.5, 12.5);
		glVertex3f(20, 27.5, 12.5);
		glVertex3f(20, 10, 12.5);
		glVertex3f(7.5, 0, 12.5);
	glEnd();

	glBegin(display_mode);				// back inner shoulder edge
		glNormal3f(-1, 0, 0);
		glVertex3f(0, 0, -12.5);
		glVertex3f(0, 22.5, -12.5);
		glVertex3f(0, 20, -10.5);
		glVertex3f(0, 0, -10.5);
	glEnd();

	glBegin(display_mode);				// front inner shoulder edge
		glNormal3f(-1, 0, 0);
		glVertex3f(0, 0, 12.5);
		glVertex3f(0, 22.5, 12.5);
		glVertex3f(0, 20, 10.5);
		glVertex3f(0, 0, 10.5);
	glEnd();

	glBegin(display_mode);				// top inner shoulder edge
		glNormal3f(-1, 0, 0);
		glVertex3f(0, 22.5, -12.5);
		glVertex3f(0, 20, -10);
		glVertex3f(0, 20, 10);
		glVertex3f(0, 22.5, 12.5);
	glEnd();

	glBegin(display_mode);				// shoulder top left edge
		CalculateNormal(5, 5, 25, 5, 5, 0);
		glNormal3f(normal_vector[0], normal_vector[1], normal_vector[2]);
		glVertex3f(0, 22.5, -12.5);
		glVertex3f(5, 27.5, -12.5);
		glVertex3f(5, 27.5, 12.5);
		glVertex3f(0, 22.5, 12.5);
	glEnd();

	glBegin(display_mode);				// shoulder top edge
		glNormal3f(0, 1, 0);
		glVertex3f(5, 27.5, -12.5);
		glVertex3f(20, 27.5, -12.5);
		glVertex3f(20, 27.5, 12.5);
		glVertex3f(5, 27.5, 12.5);
	glEnd();

	glBegin(display_mode);				// shoulder right edge
		glNormal3f(1, 0, 0);
		glVertex3f(20, 27.5, -12.5);
		glVertex3f(20, 10, -12.5);
		glVertex3f(20, 10, 12.5);
		glVertex3f(20, 27.5, 12.5);
	glEnd();

	glBegin(display_mode);
		CalculateNormal(-1.95, -1.66, 25, -1.95, -1.66, 0);
		glNormal3f(normal_vector[0], normal_vector[1], normal_vector[2]);
		glVertex3f(20, 10, -12.5);
		glVertex3f(18.05, 8.34, -12.5);		// 18.05 = 10 - (2.5 * 12.5) / sqrt(256.25)
		glVertex3f(18.05, 8.34, 12.5);		// 8.34 = 10 - (2.5 *10) / sqrt(256.25)
		glVertex3f(20, 10, 12.5);
	glEnd();

	glBegin(display_mode);
		CalculateNormal(12.5, 10, 2.5, 12.5, 10, 0);
		glNormal3f(normal_vector[0], normal_vector[1], normal_vector[2]);
		glVertex3f(7.5, 0, -12.5);
		glVertex3f(20, 10, -12.5);
		glVertex3f(20, 10, -10.5);
		glVertex3f(7.5, 0, -10.5);
	glEnd();

	glBegin(display_mode);				// same normal as last calculation
		glVertex3f(7.5, 0, 12.5);
		glVertex3f(20, 10, 12.5);
		glVertex3f(20, 10, 10.5);
		glVertex3f(7.5, 0, 10.5);
	glEnd();

	glBegin(display_mode);
		glNormal3f(-1, 0, 0);
		glVertex3f(0, 0, -12.5);
		glVertex3f(7.5, 0, -12.5);
		glVertex3f(7.5, 0, -10);
		glVertex3f(0, 0, -10);
	glEnd();

	glBegin(display_mode);				// same normal as last calculation
		glVertex3f(0, 0, 12.5);
		glVertex3f(7.5, 0, 12.5);
		glVertex3f(7.5, 0, 10);
		glVertex3f(0, 0, 10);
	glEnd();

	glBegin(display_mode);				// shoulder plate back face
		glNormal3f(0, 0, 1);
		glVertex3f(0, 0, 12.5);
		glVertex3f(0, 22.5, 12.5);
		glVertex3f(15, 22.5, 12.5);
		glVertex3f(15, 6, 12.5);
		glVertex3f(7.5, 0, 12.5);
	glEnd();

	glBegin(display_mode);				// shoulder plate front face
		glVertex3f(0, 0, 15);				// same normal as last calculation
		glVertex3f(0, 22.5, 15);
		glVertex3f(15, 22.5, 15);
		glVertex3f(15, 6, 15);
		glVertex3f(7.5, 0, 15);
	glEnd();

	glBegin(display_mode);				// shoulder plate left edge
		glNormal3f(-1, 0, 0);
		glVertex3f(0, 0, 12.5);
		glVertex3f(0, 22.5, 12.5);
		glVertex3f(0, 22.5, 15);
		glVertex3f(0, 0, 15);
	glEnd();

	glBegin(display_mode);				// shoulder plate top edge
		glNormal3f(0, 1, 0);
		glVertex3f(0, 22.5, 12.5);
		glVertex3f(15, 22.5, 12.5);
		glVertex3f(15, 22.5, 15);
		glVertex3f(0, 22.5, 15);
	glEnd();

	glBegin(display_mode);				// shoulder plate right edge
		glNormal3f(1, 0, 0);
		glVertex3f(15, 22.5, 12.5);
		glVertex3f(15, 6, 12.5);
		glVertex3f(15, 6, 15);
		glVertex3f(15, 22.5, 15);
	glEnd();

	glBegin(display_mode);				// shoulder plate bottom right edge
		CalculateNormal(-7.5, -6, 2.5, -7.5, -6, 0);
		glNormal3f(normal_vector[0], normal_vector[1], normal_vector[2]);
		glVertex3f(15, 6, 12.5);
		glVertex3f(7.5, 0, 12.5);
		glVertex3f(7.5, 0, 15);
		glVertex3f(15, 6, 15);
	glEnd();

	glBegin(display_mode);				// shoulder plate bottom edge
		glNormal3f(0, -1, 0);
		glVertex3f(0, 0, 12.5);
		glVertex3f(7.5, 0, 12.5);
		glVertex3f(7.5, 0, 15);
		glVertex3f(0, 0, 15);
	glEnd();
}  // DrawShoulder
Пример #23
0
void ShapeCompPanel::OnSetEndColor(wxCommandEvent& event)
{
	ChangeColor(m_pc->col_end.rgba);
}
Пример #24
0
void ShapeCompPanel::OnSetBeginColor(wxCommandEvent& event)
{
	ChangeColor(m_pc->col_begin.rgba);
}
		ibool Launcher::Colors::OnCmdChangeForeground(Param&)
		{
			ChangeColor( foreground.color );
			UpdateColor( foreground );
			return true;
		}
Пример #26
0
//main
int main()
{
    int letra;
    OpcaoBackground(letra);
    //primitive variables
    int NUM_ENEMYRED = 10; //quantidade de inimigos vermelhos
    int NUM_ENEMYBLUE = 10; //quantidade de inimigos azuis
    int NUM_BOSS = 5;
    int text_color = 255; //variavel para cor (animacao inicial de jogo - efeito relampago)
    int text_boss = 255; //variavel para cor de texto boss
    int FPS = 60; //frames per second
    bool done = false;
    bool redraw = true;
    enum KEYS {UP, DOWN, LEFT, RIGHT, Q, W, E, R};
    bool keys[8] = {false, false, false, false, false, false, false, false};

    //object variables
    struct Player player;
    struct Enemy_red enemyred[NUM_ENEMYRED];
    struct Enemy_blue enemyblue[NUM_ENEMYBLUE];
    struct Boss boss[NUM_BOSS];
    struct Shoot shootQ;
    struct Shoot shootW;
    struct Shoot shootE;
    struct Obstacle obstacle;
    struct SpriteScientist scientist;
    struct Sprite background;
    struct Sprite background1;
    struct Sprite background2;
    struct Sprite background3;
    struct Sprite background4;
    struct Sprite background5;
    struct Sprite background6;
    struct Sprite enemyred_sprite;

    //allegro variables
    ALLEGRO_DISPLAY *display;
    ALLEGRO_EVENT_QUEUE *event_queue = NULL;
    ALLEGRO_TIMER *timer = NULL;

    ALLEGRO_FONT *title_font = NULL;
    ALLEGRO_FONT *medium_font = NULL;

////////////////////////////////////////////////////////////////////////

    //verificacoes de erro
    if(!al_init())
        return -1; //caso de erro ao inicializar allegro

    display = al_create_display(WIDTH,HEIGHT); //criar display

    if(!display)
        return -1; //se der merda

    //Allegro Module Init
    al_init_primitives_addon();
    al_init_font_addon();
    if (!al_init_ttf_addon())
    {
        printf("Falha ao inicializar addon allegro_ttf.\n");
        return -1;
    }
    al_install_keyboard();

    if(!al_init_image_addon())
    {
        printf("Falha ao inicializar image addon");
        return -1;
    }




    event_queue = al_create_event_queue();
    timer = al_create_timer(1.0 / FPS);
    medium_font = al_load_font("fonts/EHSMB.TTF", 50, 0);
    if (!medium_font)
    {
        al_destroy_display(display);
        printf("Falha ao carregar fonte.\n");
        return -1;
    }
    title_font = al_load_font("fonts/French Electric Techno.ttf", 200, 0);
    if (!title_font)
    {
        al_destroy_display(display);
        printf("Falha ao carregar fonte.\n");
        return -1;
    }

    int b;

    //Inicializacao de objetos
    InitPlayer(player, &text_color); //funcao que "inicia" player
    InitScientist(scientist);
    if (!scientist.bitmap)
    {
        al_destroy_display(display);
        printf("Falha ao carregar sprite scientist.\n");
        return -1;
    }
    InitEnemyRed(enemyred, &NUM_ENEMYRED); //funcao que inicia enemyred
    InitEnemyBlue(enemyblue, &NUM_ENEMYBLUE); //funcao que inicia enemyblue
    InitShootQ(shootQ); //funcao que inicializa disparo 1 (capacitor)
    if(!shootQ.bitmap)
    {
        al_destroy_display(display);
        printf("Falha ao carregar sprite shootQ.\n");
        return -1;
    }
    InitShootW(shootW); //funcao que inicializa disparo 2 (indutor)
    if(!shootW.bitmap)
    {
        al_destroy_display(display);
        printf("Falha ao carregar sprite shootW.\n");
        return -1;
    }
    InitShootE(shootE); //funcao que inicializa habilidade de escudo (shield / resistor)
    if(!shootE.bitmap)
    {
        al_destroy_display(display);
        printf("Falha ao carregar sprite shield.\n");
        return -1;
    }
    InitObstacle(obstacle); //funcao que inicializa obstaculos
    InitBoss(boss, &NUM_BOSS); //funcao que inicializa chefes (bosses)
    InitBackground(background, letra); //funcao que inicializa sprite de background
    InitBackground1(background1, letra); //funcao que inicializa sprite de background1 alternativo
    InitBackground2(background2, letra); //funcao que inicializa sprite de background2 alternativo
    InitBackground3(background3, letra); //funcao que inicializa sprite de background3 alternativo
    InitBackground4(background4, letra); //funcao que inicializa sprite de background4 alternativo
    InitBackground5(background5, letra); //funcao que inicializa sprite de background4 alternativo
    InitBackground6(background6, letra); //funcao que inicializa sprite de background4 alternativo
    InitEnemyredSprite(enemyred_sprite); // funcao que inicializa sprite de inimigo vermelho

    al_register_event_source(event_queue, al_get_keyboard_event_source());
    al_register_event_source(event_queue, al_get_display_event_source(display));
    al_register_event_source(event_queue, al_get_timer_event_source(timer));
    al_start_timer(timer);

    while (!done)
    {
        ALLEGRO_EVENT ev;
        al_wait_for_event(event_queue, &ev);

        //se clicar para fechar a janela
        if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
        {
            done = true;
        }
        //evento do timer (vai entrar nesse else if sempre, a nao ser que feche a janela)
        else if(ev.type == ALLEGRO_EVENT_TIMER)
        {
            redraw = true;
            if(keys[RIGHT] && !player.moving)
            {
                player.velx = player.speed;
                player.moving = true;
            }
            if(keys[LEFT] && !player.moving)
            {
                player.velx = player.speed;
                player.moving = true;
            }

            ChangeColor(&text_color, player, boss, &NUM_BOSS, &text_boss);
            PlayerJump(player, &keys[UP]);
            PlayerRight(player, &keys[RIGHT], scientist);
            PlayerLeft(player, &keys[LEFT]);
            //updates
            UpdateShootQ(shootQ, player);
            UpdateShootW(shootW, player);
            UpdateShootE(shootE, player);
            UpdateEnemyRed(enemyred, &NUM_ENEMYRED, player, shootQ);
            UpdateEnemyBlue(enemyblue, &NUM_ENEMYBLUE, player, shootW);
            UpdateObstacle(obstacle, medium_font, player);
            UpdateBoss(boss, &NUM_BOSS, &text_boss, player, enemyred, &NUM_ENEMYRED, enemyblue, &NUM_ENEMYBLUE);
            //colisoes
            ShootQColisionEnemyRed(shootQ,enemyred, &NUM_ENEMYRED, player);
            ShootWColisionEnemyBlue(shootW, enemyblue, &NUM_ENEMYBLUE, player);
            ShootColisionBoss(shootW, shootQ, boss, &NUM_BOSS, player);
            PlayerColisionEnemyBlue(player, enemyblue, &NUM_ENEMYBLUE);
            PlayerColisionEnemyRed(player, enemyred, &NUM_ENEMYRED);
            PlayerColisionObstacle(player,obstacle);
            PlayerColisionBoss(player, boss, &NUM_BOSS);

            ResetPlayer(player, enemyred, &NUM_ENEMYRED, enemyblue, &NUM_ENEMYBLUE, obstacle, boss, &NUM_BOSS, &text_color);
        }

        else if(ev.type == ALLEGRO_EVENT_KEY_DOWN)
        {
            switch(ev.keyboard.keycode)
            {
            case ALLEGRO_KEY_ESCAPE:
                done = true;
                break;
            case ALLEGRO_KEY_UP:
                keys[UP] = true;
                break;
            case ALLEGRO_KEY_RIGHT:
                keys[RIGHT] = true;
                break;
            case ALLEGRO_KEY_LEFT:
                keys[LEFT] = true;
                break;
            case ALLEGRO_KEY_Q:
                keys[Q] = true;
                FireShootQ(shootQ, player);
                break;
            case ALLEGRO_KEY_W:
                keys[W] = true;
                FireShootW(shootW, player);
                break;
            case ALLEGRO_KEY_E:
                keys[E] = true;
                FireShootE(shootE, player);
                break;
            case ALLEGRO_KEY_R:
                keys[R] = true;
                break;
            }
        }

        else if(ev.type == ALLEGRO_EVENT_KEY_UP)
        {
            switch(ev.keyboard.keycode)
            {
            case ALLEGRO_KEY_UP:
                keys[UP] = false;
                break;
            case ALLEGRO_KEY_RIGHT:
                keys[RIGHT] = false;
                player.moving = false;
                break;
            case ALLEGRO_KEY_LEFT:
                keys[LEFT] = false;
                player.moving = false;
                break;
            case ALLEGRO_KEY_Q:
                keys[Q] = false;
                break;
            case ALLEGRO_KEY_W:
                keys[W] = false;
                break;
            case ALLEGRO_KEY_E:
                keys[E] = false;
                break;
            case ALLEGRO_KEY_R:
                keys[R] = false;
                break;
            }
        }

        if(redraw && al_is_event_queue_empty(event_queue))
        {
            redraw = false;

            //desenhar objetos
            DrawBackground(background, letra);
            DrawBackground1(background1, letra);
            DrawBackground2(background2, letra);
            DrawBackground3(background3, letra);
            DrawBackground4(background4, letra);
            DrawBackground5(background5, letra);
            DrawBackground6(background6, letra);
            DrawText(title_font, medium_font, player, boss, &NUM_BOSS, &text_color, &text_boss);
            DrawShootQ(shootQ);
            DrawShootW(shootW);
            DrawShootE(shootE, player);
            DrawEnemyRed(enemyred, &NUM_ENEMYRED, player, enemyred_sprite);
            DrawEnemyBlue(enemyblue, &NUM_ENEMYBLUE, player);
            DrawBoss(boss, &NUM_BOSS, player);
            DrawObstacle(obstacle);
            DrawScientist(player, scientist, &keys[LEFT], &keys[RIGHT]);

            al_flip_display();
        }
    }

    al_destroy_event_queue(event_queue);
    al_destroy_timer(timer);
    al_destroy_font(title_font);
    al_destroy_font(medium_font);
    al_destroy_display(display);
    al_destroy_bitmap(scientist.bitmap);
    al_destroy_bitmap(shootE.bitmap);
    for(b=0; b<background.frame_max; b++)
    {
        al_destroy_bitmap(background.image[b]);
    }
    for(b=0; b<background1.frame_max; b++)
    {
        al_destroy_bitmap(background1.image[b]);
    }
    for(b=0; b<background2.frame_max; b++)
    {
        al_destroy_bitmap(background2.image[b]);
    }
    for(b=0; b<background3.frame_max; b++)
    {
        al_destroy_bitmap(background3.image[b]);
    }
    for(b=0; b<background4.frame_max; b++)
    {
        al_destroy_bitmap(background4.image[b]);
    }
    for(b=0; b<background5.frame_max; b++)
    {
        al_destroy_bitmap(background5.image[b]);
    }
    for(b=0; b<background6.frame_max; b++)
    {
        al_destroy_bitmap(background6.image[b]);
    }

    return 0;
}//final da MAIN!!
void
CBEditTextPrefsDialog::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if (sender == this && message.Is(JXDialogDirector::kDeactivated))
		{
		const JXDialogDirector::Deactivated* info =
			dynamic_cast<const JXDialogDirector::Deactivated*>(&message);
		assert( info != NULL );
		if (info->Successful())
			{
			UpdateSettings();
			}
		}

	else if (sender == itsHelpButton && message.Is(JXButton::kPushed))
		{
		(JXGetHelpManager())->ShowSection(kCBEditorPrefsHelpName);
		}

	else if ((sender == itsCreateBackupCB || sender == itsBalanceWhileTypingCB) &&
			 message.Is(JXCheckbox::kPushed))
		{
		UpdateDisplay();
		}

	else if (sender == itsFontMenu && message.Is(JXChooseMonoFont::kFontChanged))
		{
		UpdateSampleText();
		}
	else if (sender == itsRightMarginCB && message.Is(JXCheckbox::kPushed))
		{
		UpdateSampleText();
		}

	else if (message.Is(JXButton::kPushed) && HandleColorButton(sender))
		{
		// function did all the work
		}

	else if (sender == itsChooseColorDialog &&
			 message.Is(JXDialogDirector::kDeactivated))
		{
		const JXDialogDirector::Deactivated* info =
			dynamic_cast<const JXDialogDirector::Deactivated*>(&message);
		assert( info != NULL );
		if (info->Successful())
			{
			ChangeColor(itsChooseColorIndex, itsChooseColorDialog->GetColor());
			}
		itsChooseColorDialog = NULL;
		}

	else if (sender == itsDefColorsButton && message.Is(JXButton::kPushed))
		{
		SetDefaultColors();
		}
	else if (sender == itsInvColorsButton && message.Is(JXButton::kPushed))
		{
		SetReverseVideoColors();
		}

	else if (sender == itsEmulatorMenu && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* info =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( info != NULL );
		itsEmulatorIndex = info->GetIndex();
		}

	else
		{
		JXDialogDirector::Receive(sender, message);
		}
}
Пример #28
0
void image()
{int i;
 randomize();
 settextstyle(1,HORIZ_DIR,9);
 for (i=-250;i<10;i+=5)
 {setcolor(BLACK);
  outtextxy(i-5,0,*Title);// "Hyper"
  setcolor(LIGHTBLUE);
  outtextxy(i,0,*Title);// "Hyper"
  Delay(1);
 }
 Delay(300);
 setcolor(LIGHTRED);
 settextstyle(3,HORIZ_DIR,16);
 for (i=1;i<7;i++)
 {outtextxy(210+i*60,60,*(Title+i));// "Reader"
  Delay(400);
 }
 Delay(100);
 for (i=1;i<7;i++)
 {settextstyle(4,0,i);
  setcolor(LIGHTCYAN);
  outtextxy(450,190,*(Title+7));// "2000"
  Delay(300);
  setcolor(BLACK);
  settextstyle(4,HORIZ_DIR,i);
  outtextxy(450,190,*(Title+7));// "2000"
 }
 setcolor(LIGHTCYAN);
 settextstyle(4,HORIZ_DIR,i);
 outtextxy(450,190,*(Title+7));// "2000"
 Delay(400);
 setcolor(BLUE);
 line(10,140,250,140);
 line(250,140,250,200);
 line(250,200,400,200);
 line(400,200,400,280);
 line(400,280,600,280);
 Delay(800);
 setcolor(LIGHTGREEN);
 settextstyle(2,0,7);
 outtextxy(20,200,*(Title+8));// "Produced by Zhao Chang."
 Delay(500);
 outtextxy(40,225,*(Title+9));// "Copyright (C)  2000"
 Delay(500);
 outtextxy(37,250,*(Title+10));// "ALL RIGHTS RESERVED."
 Delay(500);
 setcolor(LIGHTMAGENTA);
 settextstyle(1,0,2);
 outtextxy(340,350,*(Title+11));// "Press any key . . ."
 setcolor(WHITE);
 settextstyle(2,0,5);
 outtextxy(142,450,"Version");
 outtextxy(205,450,Version);
 outtextxy(377,450,"Update:");
 outtextxy(435,450,Update);
 people();
 book();
 Delay(2000);
 ClearKey();
 while (!kbhit())
 {ChangeColor();
  book();
  people();
  delaykey(30);
 }
 getch();
 restorecrtmode();
}
Пример #29
0
//色指定
Color::Color(const char *color) {
	ChangeColor(color);
}
Пример #30
0
void CProtoblastEffectActive::Tick()	// Метод тика
{
	ChangeColor(m_endColor, 20, 20, 20);	// Приближаем текущий цвет к цели
}