コード例 #1
0
RDPlayMeter::RDPlayMeter(RDSegMeter::Orientation orient,QWidget *parent)
  : QWidget(parent)
{
  meter_label=QString("");
  setBackgroundColor(black);
  orientation=orient;
  makeFont();
  meter=new RDSegMeter(orientation,this);
  meter->setSegmentSize(5);
  meter->setSegmentGap(1);
}
コード例 #2
0
ファイル: Canvas.cpp プロジェクト: Unitrunker/Tile
void Canvas::privateDrawString(const rect_t &box, color_t fore, color_t back, const Font& font, align_t align, const string_t &text)
{
	UINT ta = 0;
	point_t pt = {0};
	RECT rc = {0};
	SIZE size = {0};

	if ( _bmp.IsNull() )
	{
		_bmp.CreateCompatibleBitmap(m_hDC, box.wide, box.high);
	}
	else if ( _bmp.GetSize(size) && (size.cx < box.wide || size.cy < box.high) )
	{
		_bmp.DeleteObject();
		_bmp.CreateCompatibleBitmap(m_hDC, box.wide, box.high);
	}

	_dc.SelectBitmap(_bmp);
	HFONT hFont = makeFont(font);
	_dc.SelectFont(hFont);
	_dc.SetTextColor(fore);
	_dc.SetBkColor(back);

	if ( (align & eLeft) && (align & eRight) )
	{
		pt.x = box.wide / 2;
		pt.y = 0;
		ta = TA_CENTER;
	}
	else if (align & eLeft)
	{
		pt.x = 0;
		pt.y = 0;
		ta = TA_LEFT;
	}
	else if (align & eRight)
	{
		pt.x = box.x + box.wide;
		pt.y = 0;
		ta = TA_RIGHT;
	}
	_dc.SetTextAlign(ta);
	rc.right = box.wide;
	rc.bottom = box.high;
	_dc.ExtTextOut(pt.x, pt.y, ETO_CLIPPED|ETO_OPAQUE, &rc, text.c_str(), text.size(), 0);
}
コード例 #3
0
ファイル: Label.cpp プロジェクト: owenwp/guitarstorm
Label::Label(string f, string t, Alignment a)
{
	text = t;
	hasNew = false;
	align = a;
	color = vec(1,1,1,1);
	tints = 0;
	width = 0;
	
	makeFont(f);
	
	for(int i=0; i<text.length(); i++)
	{
		if(i+1 < text.length())
			width += font->kerning[text[i]][text[i+1]];
		else
			width += font->kerning[text[i]][' '];
	}
}
コード例 #4
0
ファイル: font.cpp プロジェクト: harkal/sylphis3d
void CBitmapFont::renderString(const std::string &str, F32 x, F32 y, F32 size){
	if(!mTextures.size())
		makeFont();
	F32 w,h;
	stringSize(str, &w, &h);
	if(x != -9999.0 && y != -9999.0){
		pen.x = x;
		pen.y = y + 16;
	}
	F32 startx = 0;

	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	for(S32 i = 0 ; i < str.size() ; i++){
        if(str[i] == '\n'){
            pen.x = startx;
            pen.y += getFontSize() * 64.0 * 1.4 / dpi;
        } else
            renderChar(str[i]);
	}
	glDisable(GL_BLEND);
}
コード例 #5
0
ファイル: initialization.c プロジェクト: ChrisCooper/SPQR
/*  initializeAllObjects()

Loads all images, sounds, etc.
Operations are quite self-explanatory

*/
void initializeAllObjects()
{
	screenBuffer = create_bitmap(1024, 768);
	loadBackground = makeBitmap("Images/Loading Background.gif");
	mousePic = makeBitmap("Images/GameMouse.gif");
   font15 = makeFont("Text/Hand15.pcx");
	loadAllObjects();

   showLoadingBar("Building Sounds");

   buildingSound[EMPTY] = makeSample("Sound/Building/BUILD1.wav");
   buildingSound[ROAD] = makeSample("Sound/Building/BUILD1.wav");
   buildingSound[MARKET] = makeSample("Sound/Building/COIN.wav");
   buildingSound[FARM] = makeSample("Sound/Building/GRANARY1.wav");
   buildingSound[FOUNTAIN] = makeSample("Sound/Building/FOUNTAIN.wav");
   buildingSound[THEATRE] = makeSample("Sound/Building/ART_PIT.wav");
   buildingSound[TEMPLE] = makeSample("Sound/Building/ORACLE.wav");
   buildingSound[POTTERSHOP] = makeSample("Sound/Building/CLAY_PIT.wav");
   buildingSound[BARBERSHOP] = makeSample("Sound/Building/BARBER.wav");
   buildingSound[FURNITUREWORKSHOP] = makeSample("Sound/Building/FORUM.wav");
   buildingSound[WINEPRESS] = makeSample("Sound/Building/wine_workshop.wav");
   buildingSound[BATHHOUSE] = makeSample("Sound/Building/BATHS.wav");
   buildingSound[SLAVETRADER] = makeSample("Sound/Building/CLINIC.wav");
   buildingSound[OLIVEPRESS] = makeSample("Sound/Building/MINE.wav");
   buildingSound[ACADEMY] = makeSample("Sound/Building/FORUM.wav");
   buildingSound[TENT] = makeSample("Sound/Building/HOUSING.wav");



   selector = makeBitmap("Images/Selector.gif");


	showLoadingBar("People");


	personPic[0] = makeBitmap("Images/Person0.gif");
	personPic[1] = makeBitmap("Images/Person1.gif");
	personPic[2] = makeBitmap("Images/Person2.gif");
	personPic[3] = makeBitmap("Images/Person3.gif");
	personPic[4] = makeBitmap("Images/Person4.gif");
	personPic[5] = makeBitmap("Images/Person5.gif");

	infoFile = fopen("Text/InfoFile.txt", "w");

	HUD = makeBitmap("Images/HUD.bmp");

   int tY[NUMHUDBUTTONS] = {49, 100, 151, 202, 254, 304, 355, 401, 452, 508, 559, 610, 661, 712};
	for (int i = 0; i < NUMHUDBUTTONS; i++)
	{
		resourceButton[i].left = 968;
		resourceButton[i].top = tY[i];
		resourceButton[i].width = 34;
		resourceButton[i].height = 34;
	}

	menuButton.left = 309;
	menuButton.top = 0;
	menuButton.width = 77;
	menuButton.height = 33;

	buildingButton.left = 802;
	buildingButton.top = 42;
	buildingButton.width = 63;
	buildingButton.height = 115;

	personButton.left = 867;
	personButton.top = 42;
	personButton.width = 63;
	personButton.height = 115;

	placmentOutline = makeBitmap("Images/placmentOutline.bmp");

	showLoadingBar("Ambient Sounds");

   ambientSound[0] = makeSample("Sound/Bird0.wav");
   ambientSound[1] = makeSample("Sound/Bird1.wav");
   ambientSound[2] = makeSample("Sound/Bird2.wav");
   ambientSound[3] = makeSample("Sound/Bird3.wav");
   ambientSound[4] = makeSample("Sound/Bird4.wav");
   ambientSound[5] = makeSample("Sound/Bird5.wav");
   ambientSound[6] = makeSample("Sound/Bird6.wav");
   ambientSound[7] = makeSample("Sound/Bird7.wav");

    font70 = makeFont("Text/Hand70.pcx");
    font15 = makeFont("Text/Hand15.pcx");

	resourceColour[FOOD] = makecol(255, 255,0);
	resourceColour[WATER] = makecol(0,0,255);
	resourceColour[ENTERTAINMENT] = makecol(255 ,0,0);
	resourceColour[RELIGION] = makecol(170, 170, 170);
	resourceColour[POTTERY] = makecol(230, 196, 113);
	resourceColour[BARBER] = makecol(214, 214, 214);
	resourceColour[FURNITURE] = makecol(94, 74,0);
	resourceColour[WINE] = makecol(255, 43, 124);
	resourceColour[BATHING] = makecol(0,0,255);
	resourceColour[SLAVES] = makecol(255,100,100);
	resourceColour[OLIVE_OIL] = makecol(0, 143, 75);
	resourceColour[EDUCATION] = makecol(255,255,255);


	showLoadingBar("Resource Icons");

	resourceIcon[0] = makeBitmap("Images/Icon0.gif");
	resourceIcon[1] = makeBitmap("Images/Icon1.gif");
	resourceIcon[2] = makeBitmap("Images/Icon2.gif");
	resourceIcon[3] = makeBitmap("Images/Icon3.gif");
	resourceIcon[4] = makeBitmap("Images/Icon4.gif");
	resourceIcon[5] = makeBitmap("Images/Icon5.gif");
	resourceIcon[6] = makeBitmap("Images/Icon6.gif");
	resourceIcon[7] = makeBitmap("Images/Icon7.gif");
	resourceIcon[8] = makeBitmap("Images/Icon8.gif");
	resourceIcon[9] = makeBitmap("Images/Icon9.gif");
	resourceIcon[10] = makeBitmap("Images/Icon10.gif");
	resourceIcon[11] = makeBitmap("Images/Icon11.gif");

	draw_sprite(screenBuffer, loadBackground, 0, 0);
	rectfill(screenBuffer, 209, 524, 209 + (int)(((float)((float)loadingPhase)/(float)(loadingPhases)) * (810 - 209)), 531, makecol(255, 0, 0));
	textprintf_centre_ex(screenBuffer, font15, 509, 482, 0, -1, "Loading Complete!       Press any key to continue");
	textprintf_centre_ex(screenBuffer, font15, 510, 480, makecol(255, 255, 255), -1, "Loading Complete!       Press any key to continue");
	draw_sprite(screenBuffer, mousePic, mouseX, mouseY);
	blit(screenBuffer, screen, 0,0,0,0,1024,768);
   clear_bitmap(screenBuffer);
	destroy_bitmap(loadBackground);

	readkey();
}
コード例 #6
0
ファイル: fonttosfnt.c プロジェクト: Bluerise/bitrig-xenocara
int
main(int argc, char **argv)
{
    int i;
    int rc;
    char *output = NULL;
    FontPtr font;

    i = 1;
    while(i < argc) {
        if(argv[i][0] != '-')
            break;

        if(argv[i][1] == 'o') {
            if(argv[i][2] == '\0') {
                output = sprintf_alloc("%s", argv[i + 1]);
                i += 2;
            } else {
                output = sprintf_alloc("%s", argv[i] + 2);
                i++;
            }
        } else if(strcmp(argv[i], "-v") == 0) {
            verbose_flag = 1;
            i++;
        } else if(strcmp(argv[i], "-c") == 0) {
            crop_flag = 0;
            i++;
        } else if(strcmp(argv[i], "-b") == 0) {
            bit_aligned_flag = 0;
            i++;
        } else if(strcmp(argv[i], "-r") == 0) {
            reencode_flag = 0;
            i++;
        } else if(strcmp(argv[i], "-g") == 0) {
            if(argc <= i + 1) {
                usage();
                exit(1);
            }
            glyph_flag = atoi(argv[i + 1]);
            i += 2;
        } else if(strcmp(argv[i], "-m") == 0) {
            if(argc <= i + 1) {
                usage();
                exit(1);
            }
            metrics_flag = atoi(argv[i + 1]);
            i += 2;
        } else if(strcmp(argv[i], "--") == 0) {
            i++;
            break;
        } else {
            usage();
            exit(1);
        }
    }

    if(output == NULL) {
        usage();
        exit(1);
    }

    font = makeFont();

    while(i < argc) {
        rc = readFile(argv[i], font);
        if(rc != 0)
            exit(1);
        i++;
    }

    writeFile(output, font);
    return 0;
}