/* InitToPose - gently moves Darwin into a ready position with speed 0x40
 * Return - true if successful
 *        - false if unable to set torque, or if write fails
 */
bool DarwinController::InitToPose(){

    unsigned char initpacket[108] = {0, };
    unsigned char initparams[100] = {0, };

    // Red eyes - Initialization in progress
    int color = MakeColor(255, 0, 0);
    unsigned char colorparams[2] = {GetLowByte(color), GetHighByte(color)}; 

    MakePacket(initpacket, 0xC8, 2, 0x03, 0x1C, colorparams);
    port.ClearPort();
    port.WritePort(initpacket, 9);

    // Torque enable
    for(int IDnum = 0; IDnum < 21; IDnum++){
       initparams[2*IDnum] = (unsigned char)(IDnum+1); // +1 because motors start at 1
       initparams[2*IDnum+1] = 0x01;
    }

    unsigned char paramlength = 1;
    unsigned char initnumparams = 40;
    
    if(SyncWrite(initpacket, 0x18, initparams, initnumparams, paramlength) != 48){
        printf("Failed Torque Enable in InitToPose!\n");
        return false;
    }

    usleep(2000);

    // Starting position and speed
    for(int z = 0; z < 20; z++){
        initparams[5*z] = z+1;
        initparams[5*z+1] = 0x00;
        initparams[5*z+2] = 0x08; // "zero" neutral position is 2048
        initparams[5*z+3] = 0x40; // speed is 0x40
        initparams[5*z+4] = 0x00;
    }

    if(SyncWrite(initpacket, 0x1E, initparams, 100, 4) != 108){
        printf("Failed to init to pose\n");
        return false;
    }

    sleep(1);

    // Green eyes - Finished initializing
    color = MakeColor(0, 255, 0); 
    initpacket[6] = GetLowByte(color);
    initpacket[7] = GetHighByte(color);

    colorparams[0] = GetLowByte(color);
    colorparams[1] = GetHighByte(color);
    MakePacket(initpacket, 0xC8, 2, 0x03, 0x1C, colorparams);

    port.ClearPort();
    port.WritePort(initpacket, 9);
  
    return true;
}
/**
 *  Konstruktor von @p iwMerchandiseStatistics.
 *
 *  @author jh
 */
iwMerchandiseStatistics::iwMerchandiseStatistics()
    : IngameWindow(CGI_MERCHANDISE_STATISTICS, 0xFFFE, 0xFFFE, 252, 310, _("Merchandise"), LOADER.GetImageN("resource", 41)), currentTime(STAT_1H)
{
    // Statistikfeld
    AddImage(0, 10 + 115, 23 + 81, LOADER.GetImageN("io", 228));

    // Waren-Buttons
    // obere Reihe
    ctrlMultiSelectGroup* types = AddMultiSelectGroup(22, ctrlOptionGroup::ILLUMINATE);
    types->AddImageButton(1, 17, 192, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_WOOD), _("Wood"));
    types->AddImageButton(2, 48, 192, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_BOARDS), _("Boards"));
    types->AddImageButton(3, 79, 192, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_STONES), _("Stones"));
    types->AddImageButton(4, 110, 192, 30, 30, TC_GREY, LOADER.GetImageN("io", 80), _("Food"));
    types->AddImageButton(5, 141, 192, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_WATER), _("Water"));
    types->AddImageButton(6, 172, 192, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_BEER), _("Beer"));
    types->AddImageButton(7, 203, 192, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_COAL), _("Coal"));

    // untere Reihe
    types->AddImageButton(8, 17, 227, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_IRONORE), _("Ironore"));
    types->AddImageButton(9, 48, 227, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_GOLD), _("Gold"));
    types->AddImageButton(10, 79, 227, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_IRON), _("Iron"));
    types->AddImageButton(11, 110, 227, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_COINS), _("Coins"));
    types->AddImageButton(12, 141, 227, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_HAMMER), _("Tools"));
    types->AddImageButton(13, 172, 227, 30, 30, TC_GREY, LOADER.GetImageN("io", 111), _("Weapons"));
    types->AddImageButton(14, 203, 227, 30, 30, TC_GREY, LOADER.GetMapImageN(2250 + GD_BOAT), _("Boats"));

    // Hilfe
    AddImageButton(16, 17, 261, 30, 32, TC_GREY, LOADER.GetImageN("io", 21), _("Help"));

    // Mülleimer
    AddImageButton(17, 49, 263, 30, 28, TC_GREY, LOADER.GetImageN("io", 106), _("Delete all"));

    // Zeiten
    ctrlOptionGroup* times = AddOptionGroup(23, ctrlOptionGroup::ILLUMINATE);
    times->AddTextButton(18, 81, 263, 36, 28, TC_GREY, _("15 m"), NormalFont);
    times->AddTextButton(19, 119, 263, 36, 28, TC_GREY, _("1 h"), NormalFont);
    times->AddTextButton(20, 155, 263, 36, 28, TC_GREY, _("4 h"), NormalFont);
    times->AddTextButton(21, 191, 263, 36, 28, TC_GREY, _("16 h"), NormalFont);
    times->SetSelection(19);


    // Zeit-Werte an der x-Achse
    timeAnnotations = std::vector<ctrlText*>(7);
    for (unsigned i = 0; i < 7; ++i)
    {
        timeAnnotations[i] = AddText(32 + i, 211 + i, 125 + i, "", MakeColor(255, 136, 96, 52),
                                     glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_TOP, LOADER.GetFontN("resource", 0));
    }

    // Aktueller Maximalwert an der y-Achse
    maxValue = AddText(31, 211, 55, "1", MakeColor(255, 136, 96, 52),
                       glArchivItem_Font::DF_RIGHT | glArchivItem_Font::DF_VCENTER, LOADER.GetFontN("resource", 0));
}
Beispiel #3
0
void G2DTestSystemDriver::DrawAlphaTestScreen ()
{
  int w = myG2D->GetWidth ();
  int h = myG2D->GetHeight ();
  myG2D->SetClipRect(0,0,w,h);
  myG2D->DrawBox(0,0,w,h, dsteel);

  SetFont (fontItalic);
  WriteCentered (1, 1, white, -1, "ALPHA COLOR TEST");

  SetFont (fontLarge);
  WriteCentered (1, 16*2, black, -1, "If your current canvas is in 32-bit mode, you should");
  WriteCentered (1, 16*3, black, -1, "see various text and geometry at various transparencies.");

  myG2D->DrawBox (190, 80, 50, 100, black);
  myG2D->DrawBox (20, 100, 150, 75, myG2D->FindRGB (205, 0, 125, 200));
  myG2D->DrawBox (120, 100, 100, 50, myG2D->FindRGB (120, 50, 50, 100));
  myG2D->DrawLine (30, 110, 120, 60, myG2D->FindRGB (255, 128, 128, 128));
  myG2D->DrawLine (120, 60, 70, 120, myG2D->FindRGB (128, 255, 128, 128));
  myG2D->DrawLine (70, 120, 30, 110, myG2D->FindRGB (128, 128, 255, 128));

  if (alphaBlitImage.IsValid ())
  {
    myG2D->Blit (20, 160, alphaBlitImage->GetWidth (), alphaBlitImage->GetHeight (), 
      (unsigned char*)alphaBlitImage->GetImageData ());
  }

  myG2D->Write (font, 50, 140, myG2D->FindRGB (255, 255, 255, 100), -1,
    L"Here is some partially transparent text");
  myG2D->Write (font, 50, 150, myG2D->FindRGB (0, 0, 255, 150), -1,
    L"overlaying partially transparent boxes.");

  csString str;
  int i;
  int y = 140;
  int tw, th;
  font->GetMaxSize (tw, th);
  for (i = 0; i < 6; i++)
  {
    const uint8 alpha = (i * 51);
    str.Format ("FG has alpha %" PRIu8 , alpha);
    myG2D->Write (font, 320, y, MakeColor (255, 255, 255, alpha), 
      black, str);
    y += th;
    str.Format ("BG has alpha %" PRIu8, alpha);
    myG2D->Write (font, 320, y, white, MakeColor (0, 0, 0, alpha), 
      str);
    y += th;
  }
}
Beispiel #4
0
/**
 *
 *  @author OLiver
 */
unsigned PreviewMinimap::CalcPixelColor(const void * param, const MapCoord x, const MapCoord y, const unsigned t)
{
	const glArchivItem_Map& s2map = *static_cast<const glArchivItem_Map*>(param); 
	unsigned color = 0;
	// Baum an dieser Stelle?
	unsigned char landscape_obj = s2map.GetMapDataAt(MAP_TYPE, x, y);
	if(landscape_obj >= 0xC4 && landscape_obj <= 0xC6)
		color = VaryBrightness(TREE_COLOR,VARY_TREE_COLOR);
	// Granit an dieser Stelle?
	else if(landscape_obj == 0xCC || landscape_obj == 0xCD)
		color = VaryBrightness(GRANITE_COLOR,VARY_GRANITE_COLOR);
	// Ansonsten die jeweilige Terrainfarbe nehmen
	else
	{
		color = TERRAIN_COLORS[s2map.getHeader().getGfxSet()]
		[TERRAIN_INDIZES[s2map.GetMapDataAt(MapLayer(MAP_TERRAIN1+t),x,y)]];

		// Schattierung
		int r = GetRed(color)+s2map.GetMapDataAt(MAP_SHADOWS, x, y)-0x40;
		int g = GetGreen(color)+s2map.GetMapDataAt(MAP_SHADOWS, x, y)-0x40;
		int b = GetBlue(color)+s2map.GetMapDataAt(MAP_SHADOWS, x, y)-0x40;

		if(r < 0) r = 0;
		if(r > 255) r = 255;
		if(g < 0) g = 0;
		if(g > 255) g = 255;
		if(b < 0) b = 0;
		if(b > 255) b = 255;

		color = MakeColor(0xFF,unsigned(r),unsigned(g),unsigned(b));
	}

	return color;
}
Beispiel #5
0
static GC CreateGC(int width, char *fg, char *bg, int style)
{
    XtGCMask value_mask = GCLineWidth | GCLineStyle | GCForeground
      | GCBackground | GCFunction | GCPlaneMask;
    XGCValues gc_values;

    gc_values.plane_mask = AllPlanes;
    gc_values.line_width = width;
    gc_values.line_style = style;
    gc_values.function = GXcopy;

    gc_values.foreground = MakeColor(fg);
    gc_values.background = MakeColor(bg);

    return XtGetGC(evalGraphShell, value_mask, &gc_values);
}
Beispiel #6
0
TColor Str_ColorN (const string &s, const TColor def) {
	float r, g, b, a;
	istringstream is(s);
	is >> r >> g >> b >> a;
	if (is.fail()) return def;
	else return MakeColor (r, g, b, a);
}
/**
*
*  @author OLiver
*/
unsigned PreviewMinimap::CalcPixelColor(const MapPoint pt, const unsigned t)
{
    unsigned color = 0;
    // Baum an dieser Stelle?
    unsigned char landscape_obj = objects[GetMMIdx(pt)];
    if(landscape_obj >= 0xC4 && landscape_obj <= 0xC6)
        color = VaryBrightness(TREE_COLOR, VARY_TREE_COLOR);
    // Granit an dieser Stelle?
    else if(landscape_obj == 0xCC || landscape_obj == 0xCD)
        color = VaryBrightness(GRANITE_COLOR, VARY_GRANITE_COLOR);
    // Ansonsten die jeweilige Terrainfarbe nehmen
    else
    {
        color = TerrainData::GetColor(lt, TerrainData::MapIdx2Terrain(t == 0 ? terrain1[GetMMIdx(pt)] : terrain2[GetMMIdx(pt)]));

        // Schattierung
        const int shading = shadows[GetMMIdx(pt)] - 0x40;
        int r = GetRed(color) + shading;
        int g = GetGreen(color) + shading;
        int b = GetBlue(color) + shading;

        if(r < 0) r = 0;
        if(r > 255) r = 255;
        if(g < 0) g = 0;
        if(g > 255) g = 255;
        if(b < 0) b = 0;
        if(b > 255) b = 255;

        color = MakeColor(0xFF, unsigned(r), unsigned(g), unsigned(b));
    }

    return color;
}
Beispiel #8
0
int ldr_main(struct multiboot_info* boot_info, uint32 krnldr_size_bytes)
{
	SetColor(MakeColor(DARK_BLUE, WHITE));
	ClearScreen();

	if (krnldr_size_bytes > 40 KB)
		PANIC("Kernel Loader is too large");

	init_kallocations(KRN_LDR_BASE + krnldr_size_bytes, KRN_LDR_LIMIT);

	Print("Initializing descriptor tables.");

	INT_OFF;
	init_isr();
	init_descriptor_tables();
	init_pic();
	INT_ON;

	init_pit_timer(50, timer_callback);

	struct kernel_info* k_info = kalloc(sizeof(struct kernel_info));

	//setup AHCI
	HBA_MEM_t* abar = PCIFindAHCI();

	// initialize basic virtual memory
	vmmngr_initialize();

	uint32 ahci_base = kalloc_get_ptr() + 1024 - (uint32)kalloc_get_ptr() % 1024;
	init_ahci(abar, ahci_base);

	uint32 start, _length, position = 0;
	fsysSimpleFind("MeOs.exe", 1, &_length, &start);

	if (start == (uint32)-1 && _length == 0)
		PANIC("Kernel module could not be found!");

	while (position <= _length)
	{
		fsysSimpleRead(start + position / 512, 4096, KERNEL_BASE + position);
		position += 4096;
	}

	// after all the loading is done... enable paging
	vmmngr_paging_enable(true);

	k_info->kernel_size = _length;
	k_info->isr_handlers = interrupt_handlers;
	k_info->gdt_base = gdt_entries;
	k_info->idt_base = idt_entries;

	printfln("Executing kernel\0");
	execute_kernel(boot_info, k_info);

	ClearScreen();
	_asm cli
	_asm hlt
}
Beispiel #9
0
bool G2DTestSystemDriver::HandleEvent (iEvent &Event)
{
  if (myG2D && (Event.Name == SystemOpen))
  {
    white = MakeColor (255, 255, 255);
    yellow = MakeColor (255, 255, 0);
    green = MakeColor (0, 255, 0);
    red = MakeColor (255, 0, 0);
    blue = MakeColor (0, 0, 255);
    gray = MakeColor (128, 128, 128);
    dsteel = MakeColor (80, 100, 112);
    black = MakeColor (0, 0, 0);
  }
  else if (myG2D && (Event.Name == CanvasResize))
  {
    ResizeContext ();
  }
  else if (Event.Name == KeyboardDown)
  {
	if (state_sptr)
	  switch (state [state_sptr - 1])
	  {
	    case stWaitKey:
	      lastkey = csKeyEventHelper::GetCookedCode (&Event);
	      break;
	    case stTestLinePerf:
	      lastkey2 = csKeyEventHelper::GetCookedCode (&Event);
	      break;
	    case stTestTextDraw:
	      lastkey3 = csKeyEventHelper::GetCookedCode (&Event);
	      break;
	    case stTestTextDraw2:
	      lastkey4 = csKeyEventHelper::GetCookedCode (&Event);
	      break;
	    case stPixelClipTest:
	      lastkey5 = csKeyEventHelper::GetCookedCode (&Event);
	      break;
	    case stLineClipTest:
	      lastkey6 = csKeyEventHelper::GetCookedCode (&Event);
	      break;
	    case stBoxClipTest:
	      lastkey7 = csKeyEventHelper::GetCookedCode (&Event);
	      break;
	    case stFontClipTest:
	      lastkey8 = csKeyEventHelper::GetCookedCode (&Event);
	      break;
	    case stCustomCursor:
	      lastkey9 = csKeyEventHelper::GetCookedCode (&Event);
	      break;
	    default:
	      break;
	  }
  }
  return false;
}
Beispiel #10
0
/**
 *  Berechnet Spielerfarbe mit in eine gegebene Farbe mit ein
 *  (player muss mit +1 gegeben sein!)
 */
unsigned IngameMinimap::CombineWithPlayerColor(const unsigned color, const unsigned char player) const
{
    // Spielerfarbe mit einberechnen
    unsigned player_color = gwv.GetWorld().GetPlayer(player - 1).color;

    return MakeColor(0xFF, (GetRed(color) + GetRed(player_color)) / 2,
        (GetGreen(color) + GetGreen(player_color)) / 2,
        (GetBlue(color) + GetBlue(player_color)) / 2);
}
Beispiel #11
0
void VSP::BlitObs(int x, int y, int index, image *dest)
{
	if (index >= numobs) return;
	char *c = (char *) obs + (index * 256);
	int white = MakeColor(255,255,255);
	for (int yy=0; yy<16; yy++)
		for (int xx=0; xx<16; xx++)
			if (c[(yy*16)+xx]) PutPixel(x+xx, y+yy, white, dest);
}
Beispiel #12
0
/**
 *  Berechnet Spielerfarbe mit in eine gegebene Farbe mit ein
 *  (player muss mit +1 gegeben sein!)
 *
 *  @author OLiver
 */
unsigned IngameMinimap::CombineWithPlayerColor(const unsigned color, const unsigned char player) const
{
	// Spielerfarbe mit einberechnen
	unsigned player_color = COLORS[GameClient::inst().GetPlayer(player-1)->color];

	return MakeColor(0xFF,(GetRed(color)+GetRed(player_color))/2,
		(GetGreen(color)+GetGreen(player_color))/2,
		(GetBlue(color)+GetBlue(player_color))/2);
}
std::shared_ptr<Composite>& AlloyContext::getGlassPane() {
	if (glassPane.get() == nullptr) {
		glassPane = std::shared_ptr<Composite>(
				new Composite("Glass Pane", CoordPX(0, 0),
						CoordPercent(1.0f, 1.0f)));
		glassPane->backgroundColor = MakeColor(
				theme.DARKEST.toSemiTransparent(0.5f));
	}
	return glassPane;
}
/// Berechnet die dunklere Spielerfarbe zum Zeichnen
unsigned CalcPlayerFOWDrawColor(const unsigned color)
{
    // Farbkomponenten extrahieren
    unsigned red = GetRed(color), green = GetGreen(color), blue = GetBlue(color);

    // "Skalieren"
    red = red * FOW_DRAW_COLOR_BRIGHTNESS / 0xFF;
    green = green * FOW_DRAW_COLOR_BRIGHTNESS / 0xFF;
    blue = blue * FOW_DRAW_COLOR_BRIGHTNESS / 0xFF;

    // Fertige Farbe zurückgeben
    return MakeColor(0xFF, red, green, blue);
}
Beispiel #15
0
void CDDomWidgetA::Paint( C2DRender* p2DRender )
{
	if( NULL == p2DRender )
		return;

	int x = g_Option.m_nResWidth;
	int y = g_Option.m_nResHeight;

	CRect rect;
	rect.top = 25;
	rect.left = x / 2 / 2;
	rect.right = x / 2 + rect.left;
	rect.bottom = rect.top + 110;

	// p2DRender->RenderFillRect( rect, D3DCOLOR_ARGB( 30, 0, 0, 0 ) );

	CD3DFont* pOldFont = p2DRender->GetFont();
#ifdef __NEWFONT
	p2DRender->SetFont( CWndBase::m_Theme.m_pFontDisko ); 
#endif

	D3DCOLOR colorA, colorB;
	MakeColor( colorA, m_BaseA );
	MakeColor( colorB, m_BaseB );

	/*p2DRender->TextOut( rect.left+15, rect.top, "A", colorA, 0xDA000000 ); 
	p2DRender->TextOut( rect.right-55, rect.top, "B", colorB, 0xDA000000 ); */ 
	
	PaintMiddleNumber( p2DRender, x / 2 - 11, rect.top-5 );

	p2DRender->TextOut( rect.left+15, rect.top, "A", colorA, 0xDA000000 ); 
	p2DRender->TextOut( rect.right-41 , rect.top, "B", colorB, 0xDA000000 ); 

	p2DRender->SetFont( pOldFont );



}
/* 系统初始化 */
void initVars(void){
	/*-- After load Panel, you can init args' value right here ---*/
	//Panel relative Vals
	GetPanelAttribute(panelHdl, ATTR_WIDTH, &pWidth);
	GetPanelAttribute(panelHdl, ATTR_HEIGHT, &pHeight);
	GetPanelAttribute(panelHdl, ATTR_MENU_HEIGHT, &mHeight);
	validMonNum = 6;
	averSpaceH = 8; averSpaceV = 20; extraRight = 150;
	pHeight = pHeight - mHeight;
	cWidth = (pWidth - extraRight - averSpaceH*3)/3;
	cHeight = (pHeight - averSpaceV*2)/2;
	plotBakgColor = MakeColor(200, 200, 200); //Set background color of graphs
	plotGridColor = MakeColor(10, 10, 10);
	plotLineColor = MakeColor(136, 0, 25);
	graphScaleMode = VAL_MANUAL; //or VAL_MANUAL VAL_AUTOSCALE
	//x,y坐标的标值范围
	xAxisRange[0] = 0.0, xAxisRange[1] = 9.0; //temp
	yAxisRange[0] =0.00, yAxisRange[1] = 3.00;
	
	popPanelIsPloting = 0;
	//Create a ThreadPool
	if(setupThreadPool()<0){
		MessagePopup("s", "Create thread pool error.");
	}
	//ChildPanel,TabPage、and Popup panel's Vals
	tabWidth = pWidth-extraRight-averSpaceH*3;
	tabHeight = pHeight - averSpaceV*3;
	
	dataSrc = 0;
	for(int i=0; i<validMonNum; i++)
		signalShowingStat[i] = 1;
	//init the necessary Directory this system needs
	initDirectorySets();
	refreshDimmedStat();
	isDataAcqRunning = 0;
}
void Hippo_WriteConsole(CONSOLE_COLOR color,char *szstr,... )
{
	DWORD numWritten = 0;
	static char szParsedString[1024];

	va_list va;
	va_start( va, szstr );
	vsprintf( szParsedString,szstr, va );
	va_end( va );

	SetConsoleTextAttribute(g_hippo_state->m_console_handle, MakeColor(color));

	WriteConsoleA(g_hippo_state->m_console_handle,szParsedString, (DWORD)strlen(szParsedString),&numWritten,0);
	WriteConsoleA(g_hippo_state->m_console_handle,"\n", 1,&numWritten,0);
}
Beispiel #18
0
iwPostWindow::iwPostWindow(GameWorldViewer& gwv)
    : IngameWindow(CGI_POSTOFFICE, 0xFFFF, 0xFFFF, 254, 295, _("Post office"), LOADER.GetImageN("resource", 41)), gwv(gwv)
{
    AddImageButton( 0, 18, 25, 35, 35, TC_GREY, LOADER.GetImageN("io", 190));   // Viewer: 191 - Papier
    AddImageButton( 1, 56, 25, 35, 35, TC_GREY, LOADER.GetImageN("io", 30));    // Viewer:  31 - Soldat
    AddImageButton( 2, 91, 25, 35, 35, TC_GREY, LOADER.GetImageN("io", 20));    // Viewer:  21 - Geologe
    AddImageButton( 3, 126, 25, 35, 35, TC_GREY, LOADER.GetImageN("io", 28));   // Viewer:  29 - Wage
    AddImageButton( 4, 161, 25, 35, 35, TC_GREY, LOADER.GetImageN("io", 189));  // Viewer: 190 - Neue Nachricht
    AddImageButton( 5, 199, 25, 35, 35, TC_GREY, LOADER.GetImageN("io", 79));   // Viewer:  80 - Notiz
    AddImage(  6, 126, 151, LOADER.GetImageN("io", 228));
    AddImageButton( 7, 18, 242, 30, 35, TC_GREY, LOADER.GetImageN("io", 225));  // Viewer: 226 - Hilfe
    AddImageButton( 8, 51, 246, 30, 26, TC_GREY, LOADER.GetImageN("io", 102));  // Viewer: 103 - Schnell zurück
    AddImageButton( 9, 81, 246, 30, 26, TC_GREY, LOADER.GetImageN("io", 103));  // Viewer: 104 - Zurück
    AddImageButton(10, 111, 246, 30, 26, TC_GREY, LOADER.GetImageN("io", 104)); // Viewer: 105 - Vor
    AddImageButton(11, 141, 246, 30, 26, TC_GREY, LOADER.GetImageN("io", 105)); // Viewer: 106 - Schnell vor


    gotoButton = AddImageButton(14, 181, 246, 30, 26, TC_GREY, LOADER.GetImageN("io", 107)); // Goto, nur sichtbar wenn Nachricht mit Koordinaten da
    gotoButton->SetVisible(false);
    deleteButton = AddImageButton(15, 211, 246, 30, 26, TC_GREY, LOADER.GetImageN("io", 106)); // Mülleimer, nur sichtbar, wenn Nachricht da
    deleteButton->SetVisible(false);



    postMsgInfos = AddText(18, 127, 228, "", MakeColor(255, 188, 100, 88), glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_BOTTOM, SmallFont);
    postMsgInfos->SetVisible(false);

    postImage = AddImage(13, 127, 155, LOADER.GetImageN("io", 225));

    // Multiline-Teil mit drei leeren Zeilen erzeugen
    ctrlMultiline* text = AddMultiline(12, 126, 141, 200, 50, TC_INVISIBLE, NormalFont, glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_BOTTOM | glArchivItem_Font::DF_NO_OUTLINE);
    text->EnableBox(false);
    text->AddString("", COLOR_WINDOWBROWN, false);
    text->AddString("", COLOR_WINDOWBROWN, false);
    text->AddString("", COLOR_WINDOWBROWN, false);

    SetMessageText(_("No letters!"));

    acceptButton = AddImageButton(16, 87, 185, 30, 26, TC_GREEN1, LOADER.GetImageN("io", 32)); // Button mit Haken, zum Annehmen von Verträgen
    acceptButton->SetVisible(false);
    declineButton = AddImageButton(17, 137, 185, 30, 26, TC_RED1, LOADER.GetImageN("io", 40)); // Button mit Kreuz, zum Ablehnen von Verträgen
    declineButton->SetVisible(false);

    currentMessage = 0;
    DisplayPostMessage();

    lastSize = GameClient::inst().GetPostMessages().size();
}
Beispiel #19
0
/**
 *  Variiert die übergebene Farbe zufällig in der Helligkeit
 *
 *  @author OLiver
 */
unsigned Minimap::VaryBrightness(const unsigned color, const int range) const
{
	int add = 100 - rand()%(2*range);

	int red = GetRed(color)*add/100;
	if(red < 0) red = 0;
	else if(red > 0xFF) red = 0xFF;
	int green = GetGreen(color)*add/100;
	if(green < 0) green = 0;
	else if(green > 0xFF) green = 0xFF;
	int blue = GetBlue(color)*add/100;
	if(blue < 0) blue = 0;
	else if(blue > 0xFF) blue = 0xFF;

	return MakeColor(GetAlpha(color), red, green, blue);
}
Beispiel #20
0
LRESULT LyricForm::HandleMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
	LRESULT lRes = 0L;
	switch (message)
	{
	case WM_CREATE:
		lRes = OnCreate(message, wParam, lParam);
		break;
	case WM_PAINT:
		PaintLyric();
		break;
	case WM_DESTROY:
		_writeText->Release();
		PostQuitMessage(0);
		break;
	case WM_NCPAINT:
		break;
	case WM_NCCALCSIZE:
		break;
	case WM_NCACTIVATE:
		lRes = wParam == NULL ? TRUE : FALSE;
		break;
	case WM_NCHITTEST:
		lRes = OnNCHitTest(message, wParam, lParam);
	case WM_SIZE:
		_writeText->OnFormChange();
		break;
	case WM_TIMER:
		break;
	case CM_LYRIC:
		SetLyric(std::wstring((wchar_t*)wParam));
		PaintLyric();
		break;
	case CM_FONTCOLOR:
		SetFontColor(MakeColor((DWORD)wParam, (DWORD)lParam));
		break;
	case CM_FONTSIZE:
		SetFontSize((float)wParam);
		break;
	case CM_CLOSE:
		PostQuitMessage(0);
		break;
	default:
		return DefWindowProc(m_hWnd, message, wParam, lParam);
	}
	return lRes;
}
Beispiel #21
0
/**
 *  Berechnet für einen bestimmten Punkt und ein Dreieck die normale Terrainfarbe
 *
 *  @author OLiver
 */
unsigned IngameMinimap::CalcTerrainColor(const MapCoord x, const MapCoord y, const unsigned t)
{
	unsigned color = TERRAIN_COLORS[gwv.GetLandscapeType()][ (t==0) ? gwv.GetNode(x,y).t1 : gwv.GetNode(x,y).t2];

	// Schattierung
	int shadow = gwv.GetNode(x,y).shadow;
	int r = GetRed(color)+shadow-0x40;
	int g = GetGreen(color)+shadow-0x40;
	int b = GetBlue(color)+shadow-0x40;

	if(r < 0) r = 0;
	else if(r > 255) r = 255;
	if(g < 0) g = 0;
	else if(g > 255) g = 255;
	if(b < 0) b = 0;
	else if(b > 255) b = 255;

	return MakeColor(0xFF,unsigned(r),unsigned(g),unsigned(b));
}
Beispiel #22
0
/**
 *  Calculate the normal terrain color for a given point and triangle
 */
unsigned IngameMinimap::CalcTerrainColor(const MapPoint pt, const unsigned t)
{
    unsigned color = TerrainData::GetColor(gwv.GetWorld().GetLandscapeType(), (t == 0) ? gwv.GetNode(pt).t1 : gwv.GetNode(pt).t2); //-V807

    // Schattierung
    int shadow = gwv.GetNode(pt).shadow;
    int r = GetRed(color) + shadow - 0x40;
    int g = GetGreen(color) + shadow - 0x40;
    int b = GetBlue(color) + shadow - 0x40;

    if(r < 0) r = 0;
    else if(r > 255) r = 255;
    if(g < 0) g = 0;
    else if(g > 255) g = 255;
    if(b < 0) b = 0;
    else if(b > 255) b = 255;

    return MakeColor(0xFF, unsigned(r), unsigned(g), unsigned(b));
}
iwPostWindow::iwPostWindow(GameWorldView& gwv, PostBox& postBox)
    : IngameWindow(CGI_POSTOFFICE, IngameWindow::posLastOrCenter, Extent(254, 295), _("Post office"), LOADER.GetImageN("resource", 41)),
      gwv(gwv), postBox(postBox), showAll(true), curCategory(PostCategory::General), curMsg(nullptr), lastHasMissionGoal(true)
{
    AddImageButton(ID_SHOW_ALL, DrawPoint(18, 25), Extent(35, 35), TC_GREY, LOADER.GetImageN("io", 190));  // Viewer: 191 - Papier
    AddImageButton(ID_SHOW_MIL, DrawPoint(56, 25), Extent(35, 35), TC_GREY, LOADER.GetImageN("io", 30));   // Viewer:  31 - Soldat
    AddImageButton(ID_SHOW_GEO, DrawPoint(91, 25), Extent(35, 35), TC_GREY, LOADER.GetImageN("io", 20));   // Viewer:  21 - Geologe
    AddImageButton(ID_SHOW_ECO, DrawPoint(126, 25), Extent(35, 35), TC_GREY, LOADER.GetImageN("io", 28));  // Viewer:  29 - Wage
    AddImageButton(ID_SHOW_GEN, DrawPoint(161, 25), Extent(35, 35), TC_GREY, LOADER.GetImageN("io", 189)); // Viewer: 190 - Neue Nachricht
    AddImageButton(ID_SHOW_GOAL, DrawPoint(199, 25), Extent(35, 35), TC_GREY, LOADER.GetImageN("io", 79)); // Viewer:  80 - Notiz
    AddImage(0, DrawPoint(126, 151), LOADER.GetImageN("io", 228));
    AddImageButton(ID_HELP, DrawPoint(18, 242), Extent(30, 35), TC_GREY, LOADER.GetImageN("io", 225));     // Viewer: 226 - Hilfe
    AddImageButton(ID_GO_START, DrawPoint(51, 246), Extent(30, 26), TC_GREY, LOADER.GetImageN("io", 102)); // Viewer: 103 - Schnell zurück
    AddImageButton(ID_GO_BACK, DrawPoint(81, 246), Extent(30, 26), TC_GREY, LOADER.GetImageN("io", 103));  // Viewer: 104 - Zurück
    AddImageButton(ID_GO_FWD, DrawPoint(111, 246), Extent(30, 26), TC_GREY, LOADER.GetImageN("io", 104));  // Viewer: 105 - Vor
    AddImageButton(ID_GO_END, DrawPoint(141, 246), Extent(30, 26), TC_GREY, LOADER.GetImageN("io", 105));  // Viewer: 106 - Schnell vor

    // Goto, nur sichtbar wenn Nachricht mit Koordinaten da
    AddImageButton(ID_GOTO, DrawPoint(181, 246), Extent(30, 26), TC_GREY, LOADER.GetImageN("io", 107))->SetVisible(false);
    // Mülleimer, nur sichtbar, wenn Nachricht da
    AddImageButton(ID_DELETE, DrawPoint(211, 246), Extent(30, 26), TC_GREY, LOADER.GetImageN("io", 106))->SetVisible(false);

    AddText(ID_INFO, DrawPoint(127, 228), "", MakeColor(255, 188, 100, 88), FontStyle::CENTER | FontStyle::BOTTOM, SmallFont)
      ->SetVisible(false);

    AddImage(ID_IMG, DrawPoint(127, 155), LOADER.GetImageN("io", 225));

    // Multiline-Teil mit drei leeren Zeilen erzeugen
    ctrlMultiline* text = AddMultiline(ID_TEXT, DrawPoint(126, 141), Extent(200, 0), TC_INVISIBLE, NormalFont,
                                       FontStyle::CENTER | FontStyle::BOTTOM | FontStyle::NO_OUTLINE);
    text->SetNumVisibleLines(4);
    text->ShowBackground(false);

    // Button with OK and deny sign (tick and cross) for contracts
    AddImageButton(ID_ACCEPT, DrawPoint(87, 185), Extent(30, 26), TC_GREEN1, LOADER.GetImageN("io", 32))->SetVisible(false);
    AddImageButton(ID_DENY, DrawPoint(137, 185), Extent(30, 26), TC_RED1, LOADER.GetImageN("io", 40))->SetVisible(false);

    FilterMessages();
    curMsgId = curMsgIdxs.size();
    DisplayPostMessage();
}
Beispiel #24
0
void CDDomWidgetA::PaintMiddleNumber( C2DRender* p2DRender, int x, int y )
{
	if( NULL == p2DRender )
		return;
	if( m_ToBeDominated == DTEAM_NONE )
		return;
	
	DWORD dwTime = GetTimeNumber();
	if( dwTime <= 0 || dwTime > 8 )
	{
		dwTime = 0;
		m_ToBeDominated = DTEAM_NONE;
	}


	CString strTime;
	strTime.Format( "%u", dwTime );
	D3DCOLOR color;
	MakeColor( color, dwTime );
	p2DRender->TextOut( x-11 , y+4, strTime, color, 0xEA000000 );	  
}
	GraphPane::GraphPane(const std::string& name, const AUnit2D& pos, const AUnit2D& dims) :
		Region(name, pos, dims) {
		graphBounds = box2f(float2(0.0f), float2(-1.0f));
		backgroundColor = MakeColor(AlloyApplicationContext()->theme.DARK);
		setRoundCorners(true);
		xAxisLabel = "x";
		yAxisLabel = "y=f(x)";
		cursorPosition.x = -1;
		cursorPosition.y = -1;
		onEvent = [this](const AlloyContext* context, const InputEvent& e) {
			GraphPane* region = this;
			if (context->isMouseOver(region)) {
				cursorPosition = e.cursor;
			}
			else {
				cursorPosition = float2(-1, -1);
			}
			return false;
		};
		Application::addListener(this);
	}
Beispiel #26
0
void MDFN_Surface::Fill(uint8 r, uint8 g, uint8 b, uint8 a)
{
 uint32 color = MakeColor(r, g, b, a);

 if(format.bpp == 16)
 {
  assert(pixels16);

  for(int32 i = 0; i < pitchinpix * h; i++)
   pixels16[i] = color;
 }
#ifdef CONFIG_SUPPORT_32BPP
 else
 {
  assert(pixels);

  for(int32 i = 0; i < pitchinpix * h; i++)
   pixels[i] = color;
 }
#endif
}
Beispiel #27
0
void DebugDrawGlyphCache(GB_Context* gb, const Config& config)
{
    // note this flips y-axis so y is down.
    Matrixf proj = Matrixf::Ortho(0, config.width, config.height, 0, -10, 10);
    glMatrixMode(GL_PROJECTION);
    glLoadMatrixf(reinterpret_cast<float*>(&proj));
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glEnable(GL_TEXTURE_2D);

    const int sheet_gap = 2;
    const int texture_size = gb->cache->texture_size;
    GB_Cache* cache = gb->cache;
    int y = 0;
    for (uint32_t i = 0; i < cache->num_sheets; i++) {
        DrawTexturedQuad(cache->sheet[i].gl_tex_obj, Vector2f(0, y),
                         Vector2f(texture_size, texture_size),
                         Vector2f(0, 0), Vector2f(1, 1),
                         MakeColor(255, 255, 255, 255));
        y += texture_size + sheet_gap;
    }
}
Beispiel #28
0
void GameOverMessage (CControl *ctrl) {
    int fwidth = 500;

    string line;
    float leftframe = (param.x_resolution - fwidth) / 2;
    float topframe = 80;

    TColor backcol = MakeColor (1, 1, 1, 1);
    TColor framecol = MakeColor (0.7, 0.7, 1, 1);

    if (param.use_papercut_font > 0) FT.SetSize (28);
    else FT.SetSize (22);
    if (g_game.raceaborted) {
        DrawMessageFrame (leftframe, topframe, fwidth, 100, 4, backcol, framecol, 0.5);
        FT.SetColor (colDBlue);
        FT.DrawString (CENTER, topframe+30, Trans.Text(25));
    } else {
        DrawMessageFrame (leftframe, topframe, fwidth, 210, 4, backcol, framecol, 0.5);

        if (param.use_papercut_font > 0) FT.SetSize (20);
        else FT.SetSize (14);
        if (g_game.race_result >= 0 || g_game.game_type != CUPRACING) FT.SetColor (colDBlue);
        else FT.SetColor (colDRed);

        line = "Score:  ";
        FT.DrawString (leftframe+80, topframe+15, line);
        line = Int_StrN (g_game.score);
        line += "  pts";
        FT.DrawString (leftframe+240, topframe+15, line);

        line = "Herring:  ";
        FT.DrawString (leftframe+80, topframe+40, line);
        line = Int_StrN (g_game.herring);
        if (g_game.game_type == CUPRACING) {
            line += "  (";
            line += Int_StrN (g_game.herring_req.i);
            line += ")";
        }
        FT.DrawString (leftframe+240, topframe+40, line);

        line = "Time:  ";
        FT.DrawString (leftframe+80, topframe+65, line);
        line = Float_StrN (g_game.time, 2);
        line += "  s";
        if (g_game.game_type == CUPRACING) {
            line += "  (";
            line += Float_StrN (g_game.time_req.x, 2);
            line += ")";
        }
        FT.DrawString (leftframe+240, topframe+65, line);

        line = "Path length:  ";
        FT.DrawString (leftframe+80, topframe+90, line);
        line = Float_StrN (ctrl->way, 2);
        line += "  m";
        FT.DrawString (leftframe+240, topframe+90, line);

        line = "Average speed:  ";
        FT.DrawString (leftframe+80, topframe+115, line);
        line = Float_StrN (ctrl->way / g_game.time * 3.6, 2);
        line += "  km/h";
        FT.DrawString (leftframe+240, topframe+115, line);

        if (param.use_papercut_font > 0) FT.SetSize (28);
        else FT.SetSize (22);
        if (g_game.game_type == CUPRACING) {
            switch (g_game.race_result) {
            case -1:
                FT.DrawString (CENTER, topframe+150, Trans.Text(21));
                break;
            case 0:
                FT.DrawString (CENTER, topframe+150, Trans.Text(22));
                break;
            case 1:
                FT.DrawString (CENTER, topframe+150, Trans.Text(23));
                break;
            case 2:
                FT.DrawString (CENTER, topframe+150,  Trans.Text(24));
                break;
            }
        } else {
            if (highscore_pos < 5) {
                line = "Position ";
                line += Int_StrN (highscore_pos + 1);
                line += " in highscore list";
                FT.DrawString (CENTER, topframe+150, line);
            }
        }
    }
}
Beispiel #29
0
void plot_data (int color)
{
	int pix_num,bckgrd_satus;
	double bckgrd_val;

	GetCtrlVal (ERG_panel, ERG_panel_bckgrd_sub, &bckgrd_satus); 
	if (bckgrd_satus==1)
	{
		GetCtrlVal (ERG_panel, ERG_panel_bckgrd, &pix_num);
		Mean (&data2fit[pix_num-50], 100, &bckgrd_val);
		j=0;
		while (j<10000)
		{
			buffer[j] = data2fit[j]-bckgrd_val;
			j++;
		}
	}
	else
	{
		  j=0;
		while (j<10000)
		{
			buffer[j] = data2fit[j];
			j++;
		}
	}
	
	PlotY (ERG_panel, ERG_panel_scope, buffer, 10000,VAL_DOUBLE , VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, MakeColor(color,color,color));
}
uint32_t GtkToolkitUiSettings::GetSystemColor(SystemColor color)
{
	switch (color)
	{
		case COLOR_BUTTON:
		case COLOR_SCROLLBAR_BACKGROUND:
			return ConvertColor(m_style->bg[GTK_STATE_NORMAL]);
		case COLOR_BUTTON_LIGHT:
			return ConvertColor(m_style->light[GTK_STATE_NORMAL]);
		case COLOR_BUTTON_DARK:
			return ConvertColor(m_style->dark[GTK_STATE_NORMAL]);
		case COLOR_BUTTON_VERYDARK:
			return ConvertColor(m_style->black);
		case COLOR_UI_BACKGROUND:
			return ConvertColor(m_style->bg[GTK_STATE_NORMAL]);
		case COLOR_BACKGROUND:
		case COLOR_SKIN:
			return ConvertColor(m_style->base[GTK_STATE_NORMAL]);
		case COLOR_BACKGROUND_SELECTED:
		case COLOR_BACKGROUND_SELECTED_NOFOCUS:
			return ConvertColor(m_style->base[GTK_STATE_SELECTED]);
		case COLOR_BACKGROUND_HIGHLIGHTED:
			return MakeColor(35, 220, 35); //Green
		case COLOR_BACKGROUND_HIGHLIGHTED_NOFOCUS:
			return MakeColor(255, 225, 35); //Yellow
		case COLOR_BACKGROUND_DISABLED:
			return ConvertColor(m_style->base[GTK_STATE_INSENSITIVE]);
		case COLOR_BUTTON_TEXT:
			return ConvertColor(m_style->fg[GTK_STATE_NORMAL]);
		case COLOR_TEXT:
			return ConvertColor(m_style->text[GTK_STATE_NORMAL]);
		case COLOR_UI_FONT:
			return ConvertColor(m_style->fg[GTK_STATE_NORMAL]);
		case COLOR_TEXT_SELECTED:
		case COLOR_TEXT_SELECTED_NOFOCUS:
		case COLOR_TEXT_HIGHLIGHTED:
		case COLOR_TEXT_HIGHLIGHTED_NOFOCUS:
			return ConvertColor(m_style->fg[GTK_STATE_SELECTED]);
		case COLOR_TEXT_DISABLED:
		case COLOR_UI_DISABLED_FONT:
			return ConvertColor(m_style->fg[GTK_STATE_INSENSITIVE]);
		case COLOR_UI_BUTTON_HOVER:
			return ConvertColor(m_style->bg[GTK_STATE_PRELIGHT]);
		case COLOR_LINK:
			return MakeColor(0, 0, 204);
		case COLOR_VISITED_LINK:
			return MakeColor(128, 0, 128);
		case COLOR_TOOLTIP_BACKGROUND:
			return MakeColor(0xFF, 0xFF, 0xE1);
		case COLOR_TOOLTIP_TEXT:
			return MakeColor(0, 0, 0);
		case COLOR_UI_MENU:
		{
			GtkStyle* style = gtk_style_attach(
					gtk_widget_get_style(m_menu_item),
					gtk_widget_get_parent_window(m_menu_item));
			uint32_t color = ConvertColor(style->fg[GTK_STATE_NORMAL]);
			gtk_style_detach(style);
			return color;
		}
		case COLOR_WORKSPACE:
			return MakeColor(0x80, 0x80, 0x80);
		default:
#ifdef DEBUG
			printf("GtkToolkitUiSettings::GetSystemColor: Unknown color code %d. Using red.\n", color);
			return MakeColor(0xff, 0, 0);
#else
			return MakeColor(0xff, 0xff, 0xff);
#endif
	}
}