• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Font函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Font函数的典型用法代码示例。如果您正苦于以下问题:C++ Font函数的具体用法?C++ Font怎么用?C++ Font使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Font函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Component

//==============================================================================
CombSplit::CombSplit ()
    : Component (L"CombSplit"),
      groupComponent (0),
      textButton (0),
      label (0),
      block_sizeslider (0),
      number_of_filesslider (0),
      label2 (0),
      resetbutton (0),
      textButton2 (0)
{
    addAndMakeVisible (groupComponent = new GroupComponent (L"new group",
                                                            L"Comb Split"));
    groupComponent->setTextLabelPosition (Justification::centredLeft);
    groupComponent->setColour (GroupComponent::outlineColourId, Colour (0xb0000000));

    addAndMakeVisible (textButton = new TextButton (L"new button"));
    textButton->setButtonText (L"Do it!");
    textButton->addListener (this);
    textButton->setColour (TextButton::buttonColourId, Colour (0x2ebbbbff));

    addAndMakeVisible (label = new Label (L"new label",
                                          L"Block size (# of bins)"));
    label->setFont (Font (15.0000f, Font::plain));
    label->setJustificationType (Justification::centredLeft);
    label->setEditable (false, false, false);
    label->setColour (Label::backgroundColourId, Colour (0x0));
    label->setColour (Label::textColourId, Colours::black);
    label->setColour (Label::outlineColourId, Colour (0x0));
    label->setColour (TextEditor::textColourId, Colours::black);
    label->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (block_sizeslider = new Slider (L"new slider"));
    block_sizeslider->setRange (0, 99, 1);
    block_sizeslider->setSliderStyle (Slider::LinearHorizontal);
    block_sizeslider->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20);
    block_sizeslider->setColour (Slider::thumbColourId, Colour (0x79ffffff));
    block_sizeslider->setColour (Slider::textBoxBackgroundColourId, Colour (0xffffff));
    block_sizeslider->addListener (this);

    addAndMakeVisible (number_of_filesslider = new Slider (L"new slider"));
    number_of_filesslider->setRange (1, 10, 1);
    number_of_filesslider->setSliderStyle (Slider::LinearHorizontal);
    number_of_filesslider->setTextBoxStyle (Slider::TextBoxLeft, false, 80, 20);
    number_of_filesslider->setColour (Slider::thumbColourId, Colour (0x6effffff));
    number_of_filesslider->setColour (Slider::textBoxBackgroundColourId, Colour (0xffffff));
    number_of_filesslider->addListener (this);

    addAndMakeVisible (label2 = new Label (L"new label",
                                           L"Number of files"));
    label2->setFont (Font (15.0000f, Font::plain));
    label2->setJustificationType (Justification::centredLeft);
    label2->setEditable (false, false, false);
    label2->setColour (Label::backgroundColourId, Colour (0x0));
    label2->setColour (Label::textColourId, Colours::black);
    label2->setColour (Label::outlineColourId, Colour (0x0));
    label2->setColour (TextEditor::textColourId, Colours::black);
    label2->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (resetbutton = new TextButton (L"resetbutton"));
    resetbutton->setButtonText (L"reset");
    resetbutton->addListener (this);
    resetbutton->setColour (TextButton::buttonColourId, Colour (0x35bbbbff));

    addAndMakeVisible (textButton2 = new TextButton (L"new button"));
    textButton2->setButtonText (L"Redo it!");
    textButton2->addListener (this);
    textButton2->setColour (TextButton::buttonColourId, Colour (0x40bbbbff));


    //[UserPreSize]
    //[/UserPreSize]

    setSize (600, 400);


    //[Constructor] You can add your own custom stuff here..
    buttonClicked(resetbutton);
#undef Slider
    //[/Constructor]
}
开发者ID:jeremysalwen,项目名称:mammut-updated,代码行数:82,代码来源:CombSplit.cpp


示例2: Surface

TextBox::TextBox(int x, int y, const Color &textColor, const std::string &text,
	FontName fontName, TextureManager &textureManager)
	: Surface(x, y, 1, 1)
{
	this->fontName = fontName;

	// Split "text" into lines of text.
	this->textLines = [&text]()
	{
		auto temp = std::vector<std::string>();

		// Add one empty string to start.
		temp.push_back(std::string());

		const char newLine = '\n';
		int textLineIndex = 0;
		for (auto &c : text)
		{
			if (c != newLine)
			{
				// std::string has push_back! Yay! Intuition + 1.
				temp.at(textLineIndex).push_back(c);
			}
			else
			{
				temp.push_back(std::string());
				textLineIndex++;
			}
		}

		return temp;
	}();

	// Calculate the proper dimensions of the text box.
	// No need for a "FontSurface" type... just do the heavy lifting in this class.
	auto font = Font(fontName);
	int upperCharWidth = font.getUpperCharacterWidth();
	int upperCharHeight = font.getUpperCharacterHeight();
	int lowerCharWidth = font.getLowerCharacterWidth();
	int lowerCharHeight = font.getLowerCharacterHeight();

	const int newWidth = [](const std::vector<std::string> &lines,
		int upperCharWidth, int lowerCharWidth)
	{
		// Find longest line (in pixels) out of all lines.
		int longestLength = 0;
		for (auto &line : lines)
		{
			// Sum of all character lengths in the current line.
			int linePixels = 0;
			for (auto &c : line)
			{
				linePixels += islower(c) ? lowerCharWidth : upperCharWidth;
			}

			// Check against the current longest line.
			if (linePixels > longestLength)
			{
				longestLength = linePixels;
			}
		}

		// In pixels.
		return longestLength;
	}(this->textLines, upperCharWidth, lowerCharWidth);

	const int newHeight = static_cast<int>(this->textLines.size()) * upperCharHeight;

	// Resize the surface with the proper dimensions for fitting all the text.
	SDL_FreeSurface(this->surface);
	this->surface = [](int width, int height, int colorBits)
	{
		return SDL_CreateRGBSurface(0, width, height, colorBits, 0, 0, 0, 0);
	}(newWidth, newHeight, Surface::DEFAULT_BPP);

	// Make this surface transparent.
	this->setTransparentColor(Color::Transparent);
	this->fill(Color::Transparent);
	
	// Blit each character surface in at the right spot.
	auto point = Int2();
	auto fontSurface = textureManager.getSurface(font.getFontTextureName());
	int upperCharOffsetWidth = font.getUpperCharacterOffsetWidth();
	int upperCharOffsetHeight = font.getUpperCharacterOffsetHeight();
	int lowerCharOffsetWidth = font.getLowerCharacterOffsetWidth();
	int lowerCharOffsetHeight = font.getLowerCharacterOffsetHeight();
	for (auto &line : this->textLines)
	{
		for (auto &c : line)
		{
			int width = islower(c) ? lowerCharWidth : upperCharWidth;
			int height = islower(c) ? lowerCharHeight : upperCharHeight;
			auto letterSurface = [&]()
			{
				auto cellPosition = Font::getCharacterCell(c);
				int offsetWidth = islower(c) ? lowerCharOffsetWidth : upperCharOffsetWidth;
				int offsetHeight = islower(c) ? lowerCharOffsetHeight : upperCharOffsetHeight;

				// Make a copy surface of the font character.
				auto pixelPosition = Int2(
//.........这里部分代码省略.........
开发者ID:basecq,项目名称:OpenTESArena,代码行数:101,代码来源:TextBox.cpp


示例3: return

const Font CtrlrFontManager::getFontFromString (const String &string)
{
    //_DBG(string);

	if (!string.contains (";"))
	{
	    //_DBG("\tno ; in string");
	    if (string == String::empty)
        {
            //_DBG("\tstring is empty, return default font");
            return (Font (15.0f));
        }
		return (Font::fromString(string));
	}

	StringArray fontProps;
	fontProps.addTokens (string, ";", "\"\'");
	Font font;

	if (fontProps[fontTypefaceName] != String::empty)
	{
	    //_DBG("\tfont name not empty: "+fontProps[fontTypefaceName]);

		if (fontProps[fontSet] != String::empty && fontProps[fontSet].getIntValue() >= 0)
		{
		    //_DBG("\tfont set is not empty and >= 0: "+_STR(fontProps[fontSet]));

			/* We need to fetch the typeface for the font from the correct font set */

			Array<Font> &fontSetToUse = getFontSet((const FontSet)fontProps[fontSet].getIntValue());

			for (int i=0; i<fontSetToUse.size(); i++)
			{
				if (fontSetToUse[i].getTypefaceName() == fontProps[fontTypefaceName])
				{
				    //_DBG("\tgot font from set, index: "+_STR(i));

					font = fontSetToUse[i];
					break;
				}
			}
		}
		else
		{
			/* The font set is not specified, fall back to JUCE to find the typeface name
				this will actualy be the OS set */
			font.setTypefaceName (fontProps[fontTypefaceName]);
		}

		font.setHeight (fontProps[fontHeight].getFloatValue());

		font.setBold (false);
        font.setUnderline (false);
        font.setItalic (false);

		if (fontProps[fontBold] != String::empty)
			font.setBold (fontProps[fontBold].getIntValue() ? true : false);

		if (fontProps[fontItalic] != String::empty)
			font.setItalic (fontProps[fontItalic].getIntValue() ? true : false);

		if (fontProps[fontUnderline] != String::empty)
			font.setUnderline (fontProps[fontUnderline].getIntValue() ? true : false);

		if (fontProps[fontKerning] != String::empty)
			font.setExtraKerningFactor (fontProps[fontKerning].getFloatValue());

		if (fontProps[fontHorizontalScale] != String::empty)
			font.setHorizontalScale (fontProps[fontHorizontalScale].getFloatValue());
	}
	return (font);
}
开发者ID:noscript,项目名称:ctrlr,代码行数:72,代码来源:CtrlrFontManager.cpp


示例4: deviceManager

//==============================================================================
AudioDemoPlaybackPage::AudioDemoPlaybackPage (AudioDeviceManager& deviceManager_)
    : deviceManager (deviceManager_),
      thread ("audio file preview"),
      directoryList (0, thread),
      zoomLabel (0),
      thumbnail (0),
      startStopButton (0),
      fileTreeComp (0),
      explanation (0),
      zoomSlider (0)
{
    addAndMakeVisible (zoomLabel = new Label (String::empty,
                                              T("zoom:")));
    zoomLabel->setFont (Font (15.0000f, Font::plain));
    zoomLabel->setJustificationType (Justification::centredRight);
    zoomLabel->setEditable (false, false, false);
    zoomLabel->setColour (TextEditor::textColourId, Colours::black);
    zoomLabel->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (thumbnail = new DemoThumbnailComp());

    addAndMakeVisible (startStopButton = new TextButton (String::empty));
    startStopButton->setButtonText (T("Play/Stop"));
    startStopButton->addButtonListener (this);
    startStopButton->setColour (TextButton::buttonColourId, Colour (0xff79ed7f));

    addAndMakeVisible (fileTreeComp = new FileTreeComponent (directoryList));

    addAndMakeVisible (explanation = new Label (String::empty,
                                                T("Select an audio file in the treeview above, and this page will display its waveform, and let you play it..")));
    explanation->setFont (Font (14.0000f, Font::plain));
    explanation->setJustificationType (Justification::bottomRight);
    explanation->setEditable (false, false, false);
    explanation->setColour (TextEditor::textColourId, Colours::black);
    explanation->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (zoomSlider = new Slider (String::empty));
    zoomSlider->setRange (0, 1, 0);
    zoomSlider->setSliderStyle (Slider::LinearHorizontal);
    zoomSlider->setTextBoxStyle (Slider::NoTextBox, false, 80, 20);
    zoomSlider->addListener (this);
    zoomSlider->setSkewFactor (2);


    //[UserPreSize]
    //[/UserPreSize]

    setSize (600, 400);

    //[Constructor] You can add your own custom stuff here..
    directoryList.setDirectory (File::getSpecialLocation (File::userHomeDirectory), true, true);
    thread.startThread (3);

    fileTreeComp->setColour (FileTreeComponent::backgroundColourId, Colours::white);
    fileTreeComp->addListener (this);

    deviceManager.addAudioCallback (&audioSourcePlayer);
    audioSourcePlayer.setSource (&transportSource);
    currentAudioFileSource = 0;
    //[/Constructor]
}
开发者ID:alessandropetrolati,项目名称:juced,代码行数:62,代码来源:AudioDemoPlaybackPage.cpp


示例5: edoGaduComponent

//==============================================================================
EdoGaduSearch::EdoGaduSearch (EdoGadu *_edoGaduComponent)
    : edoGaduComponent(_edoGaduComponent),
      inpUin (0),
      label (0),
      inpFristName (0),
      label2 (0),
      inpLastName (0),
      label3 (0),
      label4 (0),
      inpNickName (0),
      label5 (0),
      inpCity (0),
      inpSex (0),
      label6 (0),
      label7 (0),
      inpBirthYear (0),
      searchResult (0),
      btnSearch (0),
      searchRunning (0)
{
    addAndMakeVisible (inpUin = new TextEditor (T("new text editor")));
    inpUin->setMultiLine (false);
    inpUin->setReturnKeyStartsNewLine (false);
    inpUin->setReadOnly (false);
    inpUin->setScrollbarsShown (true);
    inpUin->setCaretVisible (true);
    inpUin->setPopupMenuEnabled (true);
    inpUin->setColour (TextEditor::backgroundColourId, Colour (0x97ffffff));
    inpUin->setColour (TextEditor::outlineColourId, Colours::black);
    inpUin->setColour (TextEditor::shadowColourId, Colour (0x0));
    inpUin->setText (String::empty);

    addAndMakeVisible (label = new Label (T("new label"),
                                          T("UIN")));
    label->setFont (Font (18.0000f, Font::bold));
    label->setJustificationType (Justification::centred);
    label->setEditable (false, false, false);
    label->setColour (TextEditor::textColourId, Colours::black);
    label->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (inpFristName = new TextEditor (T("new text editor")));
    inpFristName->setMultiLine (false);
    inpFristName->setReturnKeyStartsNewLine (false);
    inpFristName->setReadOnly (false);
    inpFristName->setScrollbarsShown (true);
    inpFristName->setCaretVisible (true);
    inpFristName->setPopupMenuEnabled (true);
    inpFristName->setColour (TextEditor::backgroundColourId, Colour (0x97ffffff));
    inpFristName->setColour (TextEditor::outlineColourId, Colours::black);
    inpFristName->setColour (TextEditor::shadowColourId, Colour (0x0));
    inpFristName->setText (String::empty);

    addAndMakeVisible (label2 = new Label (T("new label"),
                                           T("First Name")));
    label2->setFont (Font (18.0000f, Font::bold));
    label2->setJustificationType (Justification::centred);
    label2->setEditable (false, false, false);
    label2->setColour (TextEditor::textColourId, Colours::black);
    label2->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (inpLastName = new TextEditor (T("new text editor")));
    inpLastName->setMultiLine (false);
    inpLastName->setReturnKeyStartsNewLine (false);
    inpLastName->setReadOnly (false);
    inpLastName->setScrollbarsShown (true);
    inpLastName->setCaretVisible (true);
    inpLastName->setPopupMenuEnabled (true);
    inpLastName->setColour (TextEditor::backgroundColourId, Colour (0x97ffffff));
    inpLastName->setColour (TextEditor::outlineColourId, Colours::black);
    inpLastName->setColour (TextEditor::shadowColourId, Colour (0x0));
    inpLastName->setText (String::empty);

    addAndMakeVisible (label3 = new Label (T("new label"),
                                           T("Last Name")));
    label3->setFont (Font (18.0000f, Font::bold));
    label3->setJustificationType (Justification::centred);
    label3->setEditable (false, false, false);
    label3->setColour (TextEditor::textColourId, Colours::black);
    label3->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (label4 = new Label (T("new label"),
                                           T("Nick Name")));
    label4->setFont (Font (18.0000f, Font::bold));
    label4->setJustificationType (Justification::centred);
    label4->setEditable (false, false, false);
    label4->setColour (TextEditor::textColourId, Colours::black);
    label4->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (inpNickName = new TextEditor (T("new text editor")));
    inpNickName->setMultiLine (false);
    inpNickName->setReturnKeyStartsNewLine (false);
    inpNickName->setReadOnly (false);
    inpNickName->setScrollbarsShown (true);
    inpNickName->setCaretVisible (true);
    inpNickName->setPopupMenuEnabled (true);
    inpNickName->setColour (TextEditor::backgroundColourId, Colour (0x97ffffff));
    inpNickName->setColour (TextEditor::outlineColourId, Colours::black);
    inpNickName->setColour (TextEditor::shadowColourId, Colour (0x0));
    inpNickName->setText (String::empty);
//.........这里部分代码省略.........
开发者ID:orisha85,项目名称:edoapp,代码行数:101,代码来源:EdoGaduSearch.cpp


示例6: Font

const Font StatusBar::getFont() {
    return Font(Font::getDefaultMonospacedFontName(), (float)kFontSize, Font::plain);
}
开发者ID:EQ4,项目名称:TeragonGuiComponents,代码行数:3,代码来源:StatusBar.cpp


示例7: AudioProcessorEditor

//==============================================================================
mlrVSTGUI::mlrVSTGUI (mlrVSTAudioProcessor* owner, const int &newNumChannels, const int &newNumStrips)
    : AudioProcessorEditor (owner),

    // Communication ////////////////////////
    parent(owner),
    // Style / positioning objects //////////
    myLookAndFeel(), overrideLF(),

    // Fonts ///////////////////////////////////////////////////////
    fontSize(12.f), defaultFont("ProggyCleanTT", 18.f, Font::plain),

    // Volume controls //////////////////////////////////////////////////
    masterGainSlider("master gain"), masterSliderLabel("master", "mstr"),
    slidersArray(), slidersMuteBtnArray(),

    // Tempo controls ///////////////////////////////////////
    bpmSlider("bpm slider"), bpmLabel(),
    quantiseSettingsCbox("quantise settings"),
    quantiseLabel("quantise label", "quant."),

    // Buttons //////////////////////////////////
    loadFilesBtn("load samples", "load samples"),
    sampleStripToggle("sample strip toggle", DrawableButton::ImageRaw),
    patternStripToggle("pattern strip toggle", DrawableButton::ImageRaw),
    sampleImg(), patternImg(),

    // Record / Resample / Pattern UI ////////////////////////////////////////
    precountLbl("precount", "precount"), recordLengthLbl("length", "length"), bankLbl("bank", "bank"),
    recordPrecountSldr(), recordLengthSldr(), recordBankSldr(),
    resamplePrecountSldr(), resampleLengthSldr(), resampleBankSldr(),
    patternPrecountSldr(), patternLengthSldr(), patternBankSldr(),
    recordBtn("record", Colours::black, Colours::white),
    resampleBtn("resample", Colours::black, Colours::white),
    patternBtn("pattern", Colours::black, Colours::white),

    // branding
    vstNameLbl("vst label", "mlrVST"),

    // Misc ///////////////////////////////////////////
    lastDisplayedPosition(),
    debugButton("loadfile", DrawableButton::ImageRaw),    // temporary button

    // Presets //////////////////////////////////////////////////
    presetLabel("presets", "presets"), presetCbox(),
    presetPrevBtn("prev", 0.25, Colours::black, Colours::white),
    presetNextBtn("next", 0.75, Colours::black, Colours::white),
    addPresetBtn("add", "add preset"),
    toggleSetlistBtn("setlist"),
    presetPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725),
    presetPanel(presetPanelBounds, owner),


    // Settings ///////////////////////////////////////
    numChannels(newNumChannels), useExternalTempo(true),
    toggleSettingsBtn("settings"),
    settingsPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725),
    settingsPanel(settingsPanelBounds, owner, this),

    // Mappings //////////////////////////////////////
    mappingPanelBounds(294, PAD_AMOUNT, THUMBNAIL_WIDTH, 725),
    toggleMappingBtn("mappings"),
    mappingPanel(mappingPanelBounds, owner),

    // SampleStrip controls ///////////////////////////
    sampleStripControlArray(), numStrips(newNumStrips),
    waveformControlHeight( (GUI_HEIGHT - numStrips * PAD_AMOUNT) / numStrips),
    waveformControlWidth(THUMBNAIL_WIDTH),

    // Overlays //////////////////////////////
    patternStripArray(), hintOverlay(owner)
{
    DBG("GUI loaded " << " strips of height " << waveformControlHeight);

    parent->addChangeListener(this);

    // these are compile time constants
    setSize(GUI_WIDTH, GUI_HEIGHT);
    setWantsKeyboardFocus(true);

    int xPosition = PAD_AMOUNT;
    int yPosition = PAD_AMOUNT;

    // set up volume sliders
    buildSliders(xPosition, yPosition);

    // add the bpm slider and quantise settings
    setupTempoUI(xPosition, yPosition);

    // set up the various panels (settings, mapping, etc)
    // and the buttons that control them
    setupPanels(xPosition, yPosition);

    // preset associated UI elements
    setupPresetUI(xPosition, yPosition);


    // useful UI debugging components
    addAndMakeVisible(&debugButton);
    debugButton.addListener(this);
//.........这里部分代码省略.........
开发者ID:grimtraveller,项目名称:mlrVST,代码行数:101,代码来源:mlrVSTGUI.cpp


示例8: addAndMakeVisible

//==============================================================================
OscillatorEditor::OscillatorEditor ()
{
    //[Constructor_pre] You can add your own custom stuff here..
    //[/Constructor_pre]

    addAndMakeVisible (m_waveformTypeSlider = new Slider ("Waveform Type Slider"));
    m_waveformTypeSlider->setRange (0, 1, 0);
    m_waveformTypeSlider->setSliderStyle (Slider::RotaryVerticalDrag);
    m_waveformTypeSlider->setTextBoxStyle (Slider::NoTextBox, true, 80, 20);
    m_waveformTypeSlider->setColour (Slider::thumbColourId, Colour (0xff1de9b6));
    m_waveformTypeSlider->setColour (Slider::trackColourId, Colour (0x00000000));
    m_waveformTypeSlider->setColour (Slider::rotarySliderFillColourId, Colour (0xff1de9b6));
    m_waveformTypeSlider->setColour (Slider::rotarySliderOutlineColourId, Colour (0xff212121));
    m_waveformTypeSlider->setColour (Slider::textBoxTextColourId, Colour (0xff212121));
    m_waveformTypeSlider->setColour (Slider::textBoxBackgroundColourId, Colour (0x00000000));
    m_waveformTypeSlider->setColour (Slider::textBoxHighlightColourId, Colour (0xff1de9b6));
    m_waveformTypeSlider->setColour (Slider::textBoxOutlineColourId, Colour (0x00000000));
    m_waveformTypeSlider->addListener (this);

    addAndMakeVisible (m_detuneLabel = new Label ("Detune Label",
                                                  TRANS("DETUNE")));
    m_detuneLabel->setFont (Font ("Avenir Next", 14.00f, Font::plain));
    m_detuneLabel->setJustificationType (Justification::centred);
    m_detuneLabel->setEditable (false, false, false);
    m_detuneLabel->setColour (Label::textColourId, Colour (0xff212121));
    m_detuneLabel->setColour (TextEditor::textColourId, Colour (0xff212121));
    m_detuneLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
    m_detuneLabel->setColour (TextEditor::highlightColourId, Colour (0xff1de9b6));

    addAndMakeVisible (m_waveTypeLabel = new Label ("Waveform Type Label",
                                                    TRANS("WAVE")));
    m_waveTypeLabel->setFont (Font ("Avenir Next", 14.00f, Font::plain));
    m_waveTypeLabel->setJustificationType (Justification::centred);
    m_waveTypeLabel->setEditable (false, false, false);
    m_waveTypeLabel->setColour (Label::textColourId, Colour (0xff212121));
    m_waveTypeLabel->setColour (TextEditor::textColourId, Colour (0xff212121));
    m_waveTypeLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
    m_waveTypeLabel->setColour (TextEditor::highlightColourId, Colour (0xff1de9b6));

    addAndMakeVisible (m_detuneSlider = new Slider ("Detune Slider"));
    m_detuneSlider->setRange (0, 1, 0.0104166);
    m_detuneSlider->setSliderStyle (Slider::RotaryVerticalDrag);
    m_detuneSlider->setTextBoxStyle (Slider::NoTextBox, true, 80, 20);
    m_detuneSlider->setColour (Slider::thumbColourId, Colour (0xff1de9b6));
    m_detuneSlider->setColour (Slider::trackColourId, Colour (0x00000000));
    m_detuneSlider->setColour (Slider::rotarySliderFillColourId, Colour (0xff1de9b6));
    m_detuneSlider->setColour (Slider::rotarySliderOutlineColourId, Colour (0xff212121));
    m_detuneSlider->setColour (Slider::textBoxTextColourId, Colour (0xff212121));
    m_detuneSlider->setColour (Slider::textBoxBackgroundColourId, Colour (0x00000000));
    m_detuneSlider->setColour (Slider::textBoxHighlightColourId, Colour (0xff1de9b6));
    m_detuneSlider->setColour (Slider::textBoxOutlineColourId, Colour (0x00000000));
    m_detuneSlider->addListener (this);

    addAndMakeVisible (m_distortionSlider = new Slider ("Distortion Slider"));
    m_distortionSlider->setRange (0, 1, 0);
    m_distortionSlider->setSliderStyle (Slider::RotaryVerticalDrag);
    m_distortionSlider->setTextBoxStyle (Slider::NoTextBox, true, 80, 20);
    m_distortionSlider->setColour (Slider::thumbColourId, Colour (0xff1de9b6));
    m_distortionSlider->setColour (Slider::trackColourId, Colour (0x00000000));
    m_distortionSlider->setColour (Slider::rotarySliderFillColourId, Colour (0xff1de9b6));
    m_distortionSlider->setColour (Slider::rotarySliderOutlineColourId, Colour (0xff212121));
    m_distortionSlider->setColour (Slider::textBoxTextColourId, Colour (0xff212121));
    m_distortionSlider->setColour (Slider::textBoxBackgroundColourId, Colour (0x00000000));
    m_distortionSlider->setColour (Slider::textBoxHighlightColourId, Colour (0xff1de9b6));
    m_distortionSlider->setColour (Slider::textBoxOutlineColourId, Colour (0x00000000));
    m_distortionSlider->addListener (this);

    addAndMakeVisible (m_distLabel = new Label ("Distortion Label",
                                                TRANS("DIST.")));
    m_distLabel->setFont (Font ("Avenir Next", 14.00f, Font::plain));
    m_distLabel->setJustificationType (Justification::centred);
    m_distLabel->setEditable (false, false, false);
    m_distLabel->setColour (Label::textColourId, Colour (0xff212121));
    m_distLabel->setColour (TextEditor::textColourId, Colour (0xff212121));
    m_distLabel->setColour (TextEditor::backgroundColourId, Colour (0x00000000));
    m_distLabel->setColour (TextEditor::highlightColourId, Colour (0xff1de9b6));


    //[UserPreSize]
    m_detuneSlider->setValue(0.5);
    //[/UserPreSize]

    setSize (176, 68);


    //[Constructor] You can add your own custom stuff here..
    //[/Constructor]
}
开发者ID:nick-thompson,项目名称:Artifakt,代码行数:89,代码来源:OscillatorEditor.cpp


示例9: GlyphsDemo

 GlyphsDemo (ControllersComponent& cc)
     : GraphicsDemoBase (cc, "Glyphs")
 {
     glyphs.addFittedText (Font (20.0f), "The Quick Brown Fox Jumped Over The Lazy Dog",
                           -120, -50, 240, 100, Justification::centred, 2, 1.0f);
 }
开发者ID:CraigAlbright,项目名称:JUCE,代码行数:6,代码来源:GraphicsDemo.cpp


示例10: main


//.........这里部分代码省略.........
	if(teams[0].getStatus() == 3 || teams[1].getStatus() == 3)  {
		teams[0].changeStatus(3);
		teams[1].changeStatus(3);
		teams[0].clearCaught();
		teams[1].clearCaught();
		teams[0].changeInit(false);
		teams[1].changeInit(false);
		if(teams[0].lineUp(FIELDW, FIELDH, YARDSIZE) )
			teams[0].changeStatus(0);
		if(teams[1].lineUp(FIELDW, FIELDH, YARDSIZE) )
			teams[1].changeStatus(0);
		disc.restart();
	}
	
	//teams[0].sortClosest(disc);
	//teams[1].sortClosest(disc);
	if(test.isKeyDown('z') && !zkey) {
		teams[1].nextSelected();
		zkey = true;
	}
	if(test.isKeyDown('7') && !nkey)  {
		teams[0].nextSelected();
		nkey = true;
	}
	
	if(!test.isKeyDown('z') && zkey)
		zkey = false;
	if(!test.isKeyDown('7') && nkey)
		nkey = false;

	
	if(teams[0].getInit()+teams[1].getInit() && (teams[1].getCaught()-1!= teams[1].isSelected()) )  {
		if(test.isKeyDown(NamedKey::LEFT_ARROW))  {
			teams[1].move(teams[1].isSelected(), -8, 0, FIELDW, FIELDH, YARDSIZE);
		}
		if(test.isKeyDown(NamedKey::RIGHT_ARROW))  {
			teams[1].move(teams[1].isSelected(), 8, 0, FIELDW, FIELDH, YARDSIZE);
		}
		if(test.isKeyDown(NamedKey::UP_ARROW))  {
			teams[1].move(teams[1].isSelected(), 0,-8, FIELDW, FIELDH, YARDSIZE);
		}
		if(test.isKeyDown(NamedKey::DOWN_ARROW))  {
			teams[1].move(teams[1].isSelected(), 0, 8, FIELDW, FIELDH, YARDSIZE);
		}
	}
	if(teams[0].getInit()+teams[1].getInit() && (teams[0].getCaught()-1!=teams[0].isSelected()) )  {
		if(test.isKeyDown('1'))  {
			  teams[0].move(teams[0].isSelected(), -8, 0, FIELDW, FIELDH, YARDSIZE);
		}
		if(test.isKeyDown('3'))  {
			 teams[0].move(teams[0].isSelected(), 8, 0, FIELDW, FIELDH, YARDSIZE);
		}
		if(test.isKeyDown('5'))  {
			  teams[0].move(teams[0].isSelected(), 0, -8, FIELDW, FIELDH, YARDSIZE);
		}
		if(test.isKeyDown('2'))  {
			  teams[0].move(teams[0].isSelected(), 0, 8, FIELDW, FIELDH, YARDSIZE);
		}
	}

	teams[0].decisiveMove(disc, teams[1], teams[0].getInit()+teams[1].getInit(), FIELDW, FIELDH, YARDSIZE);
	teams[1].decisiveMove(disc, teams[0], teams[0].getInit()+teams[1].getInit(), FIELDW, FIELDH, YARDSIZE);

	teams[0].drawTeam(test, x, y);
	teams[1].drawTeam(test, x, y);

	disc.drawFrisbee(test, x, y);

	//Scoreboard
	//test.drawRectangleFilled(Style::BLACK, 0, test.getHeight()*6/7, test.getWidth(), test.getHeight() );
	test.drawText( Style(Color::WHITE, 2), Font(Font::ROMAN, 16), 5, test.getHeight()-42, "Fish"); 
	test.drawText( Style(Color::WHITE, 2), Font(Font::ROMAN, 16), 160, test.getHeight()-42, test.numberToString(teams[0].getScore() ) ); 
	test.drawText( Style(Color::WHITE, 2), Font(Font::ROMAN, 16), 5, test.getHeight()-17, "Veggies"); 
	test.drawText( Style(Color::WHITE, 2), Font(Font::ROMAN, 16), 160, test.getHeight()-17, test.numberToString(teams[1].getScore() ));

	//Powerbar
	test.drawText( Style(Color::WHITE, 1.5), Font(Font::ROMAN, 10), test.getWidth()/3+40, test.getHeight()-40, "Power:");
	test.drawRectangleFilled(Style(Color(255,145,0), 1), test.getWidth()/3-10, test.getHeight()-33, test.getWidth()/3-10+(power*16.666), test.getHeight()-21);
	test.drawRectangleOutline(Style(Color::WHITE, 1), test.getWidth()/3-10, test.getHeight()-33, test.getWidth()/3 + 140, test.getHeight()-21);
	
	//Heightbar
	test.drawLine( Style(Color::WHITE, 5), test.getWidth()/3 +202.5+(27.5*cos(height)), test.getHeight()-35+(27.5*sin(height)),
	test.getWidth()/3+202.5+(27.5*cos(height+PI)), test.getHeight()-35+(27.5*sin(height+PI)));
	
	//Feild Map
	test.drawRectangleFilled(Style::GREEN, test.getWidth()*3/4, test.getHeight()-55, test.getWidth()*3/4+(FIELDW/YARDSIZE), test.getHeight()-55+(FIELDH/YARDSIZE));
	test.drawRectangleOutline(Style(Color::WHITE, 1), test.getWidth()*3/4, test.getHeight()-55, test.getWidth()*3/4+(FIELDW/YARDSIZE), test.getHeight()-55+(FIELDH/YARDSIZE)); 
	test.drawRectangleOutline(Style(Color::WHITE, 1), test.getWidth()*3/4+(ENDZONE/YARDSIZE), test.getHeight()-55, test.getWidth()*3/4+(FIELDW-ENDZONE)/YARDSIZE, test.getHeight()-55+(FIELDH/YARDSIZE));

	teams[0].drawPixels(test, YARDSIZE);
	teams[1].drawPixels(test, YARDSIZE);

	disc.drawPixel(test, YARDSIZE);

	test.flipPage();

  }

  return 0;
}
开发者ID:keithhackbarth,项目名称:Ultimate-Frisbee-Computer-Game,代码行数:101,代码来源:utlimate.cpp


示例11: Font

GraphViewer::GraphViewer()
{

    labelFont = Font("Paragraph", 50, Font::plain);
    rootNum = 0;
}
开发者ID:jperge,项目名称:GUI_Jan7_2016,代码行数:6,代码来源:GraphViewer.cpp


示例12: Font

Font JucerTreeViewBase::getFont() const
{
    return Font (getItemHeight() * 0.6f);
}
开发者ID:lauyoume,项目名称:JUCE,代码行数:4,代码来源:jucer_JucerTreeViewBase.cpp


示例13: Exception

	Font Font::load(Canvas &canvas, const std::string &family_name, const FontDescription &reference_desc, FontFamily &font_family, const XMLResourceDocument &doc, std::function<Resource<Sprite>(Canvas &, const std::string &)> cb_get_sprite)
	{
		DomElement font_element;
		XMLResourceNode resource;

		resource = doc.get_resource(family_name);
		font_element = resource.get_element();

		DomElement sprite_element = font_element.named_item("sprite").to_element();

		if (!sprite_element.is_null())
		{
			if (!sprite_element.has_attribute("glyphs"))
				throw Exception(string_format("Font resource %1 has no 'glyphs' attribute.", resource.get_name()));

			if (!sprite_element.has_attribute("letters"))
				throw Exception(string_format("Font resource %1 has no 'letters' attribute.", resource.get_name()));

			if (!cb_get_sprite)
				throw Exception(string_format("Font resource %1 requires a sprite loader callback specified.", resource.get_name()));
				
			Resource<Sprite> spr_glyphs = cb_get_sprite(canvas, sprite_element.get_attribute("glyphs"));

			const std::string &letters = sprite_element.get_attribute("letters");

			int spacelen = StringHelp::text_to_int(sprite_element.get_attribute("spacelen", "-1"));
			bool monospace = StringHelp::text_to_bool(sprite_element.get_attribute("monospace", "false"));

			// Modify the default font metrics, if specified

			float height = 0.0f;
			float line_height = 0.0f;
			float ascent = 0.0f;
			float descent = 0.0f;
			float internal_leading = 0.0f;
			float external_leading = 0.0f;

			if (sprite_element.has_attribute("height"))
				height = StringHelp::text_to_float(sprite_element.get_attribute("height", "0"));

			if (sprite_element.has_attribute("line_height"))
				line_height = StringHelp::text_to_float(sprite_element.get_attribute("line_height", "0"));

			if (sprite_element.has_attribute("ascent"))
				ascent = StringHelp::text_to_float(sprite_element.get_attribute("ascent", "0"));

			if (sprite_element.has_attribute("descent"))
				descent = StringHelp::text_to_float(sprite_element.get_attribute("descent", "0"));

			if (sprite_element.has_attribute("internal_leading"))
				internal_leading = StringHelp::text_to_float(sprite_element.get_attribute("internal_leading", "0"));

			if (sprite_element.has_attribute("external_leading"))
				external_leading = StringHelp::text_to_float(sprite_element.get_attribute("external_leading", "0"));

			FontMetrics font_metrics(height, ascent, descent, internal_leading, external_leading, line_height, canvas.get_pixel_ratio());

			font_family.add(canvas, spr_glyphs.get(), letters, spacelen, monospace, font_metrics);

			FontDescription desc = reference_desc.clone();
			return Font(font_family, desc);
		}

		DomElement ttf_element = font_element.named_item("ttf").to_element();
		if (ttf_element.is_null())
			ttf_element = font_element.named_item("freetype").to_element();

		if (!ttf_element.is_null())
		{
			FontDescription desc = reference_desc.clone();

			std::string filename;
			if (ttf_element.has_attribute("file"))
			{
				filename = PathHelp::combine(resource.get_base_path(), ttf_element.get_attribute("file"));
			}

			if (!ttf_element.has_attribute("typeface"))
				throw Exception(string_format("Font resource %1 has no 'typeface' attribute.", resource.get_name()));

			std::string font_typeface_name = ttf_element.get_attribute("typeface");

			if (ttf_element.has_attribute("height"))
				desc.set_height(ttf_element.get_attribute_int("height", 0));

			if (ttf_element.has_attribute("average_width"))
				desc.set_average_width(ttf_element.get_attribute_int("average_width", 0));

			if (ttf_element.has_attribute("anti_alias"))
				desc.set_anti_alias(ttf_element.get_attribute_bool("anti_alias", true));

			if (ttf_element.has_attribute("subpixel"))
				desc.set_subpixel(ttf_element.get_attribute_bool("subpixel", true));

			if (filename.empty())
			{
				font_family.add(font_typeface_name, desc);
				return Font(font_family, desc);
			}
			else
//.........这里部分代码省略.........
开发者ID:tornadocean,项目名称:ClanLib,代码行数:101,代码来源:font_xml.cpp


示例14: grpTextLayoutEditor

//==============================================================================
WindowComponent::WindowComponent ()
    : grpTextLayoutEditor (0),
      grpLayout (0),
      lblWordWrap (0),
      lblReadingDirection (0),
      lblJustification (0),
      lblLineSpacing (0),
      cmbWordWrap (0),
      cmbReadingDirection (0),
      cmbJustification (0),
      slLineSpacing (0),
      grpFont (0),
      lblFontFamily (0),
      lblFontStyle (0),
      tbUnderlined (0),
      tbStrikethrough (0),
      cmbFontFamily (0),
      cmbFontStyle (0),
      grpColor (0),
      ceColor (0),
      lblColor (0),
      grpDbgCaret (0),
      lblCaretPos (0),
      slCaretPos (0),
      lblCaretSelStart (0),
      slCaretSelStart (0),
      slCaretSelEnd (0),
      lblCaretSelEnd (0),
      grpDbgRanges (0),
      txtDbgRanges (0),
      txtEditor (0),
      tbDbgRanges (0),
      slFontSize (0),
      lblFontSize (0),
      grpDbgActions (0),
      tbR1C1 (0),
      tbR2C1 (0),
      tbR3C1 (0),
      tbR4C1 (0),
      tbR1C2 (0),
      tbR2C2 (0),
      tbR3C2 (0),
      tbR4C2 (0),
      tbR1C3 (0),
      tbR2C3 (0),
      tbR3C3 (0),
      tbR4C7 (0),
      tbR1C4 (0),
      tbR1C5 (0),
      tbR2C4 (0),
      tbR3C4 (0),
      tbR4C8 (0),
      tbR2C5 (0),
      tbR3C5 (0),
      tbR4C9 (0),
      tbR5C1 (0),
      tbR5C2 (0),
      tbR5C3 (0),
      tbR5C4 (0),
      tbR5C5 (0)
{
    addAndMakeVisible (grpTextLayoutEditor = new GroupComponent (L"grpTextLayoutEditor",
                                                                 L"Text Layout Editor"));

    addAndMakeVisible (grpLayout = new GroupComponent (L"grpLayout",
                                                       L"Layout"));

    addAndMakeVisible (lblWordWrap = new Label (L"lblWordWrap",
                                                L"Word Wrap:"));
    lblWordWrap->setFont (Font (15.0000f));
    lblWordWrap->setJustificationType (Justification::centredLeft);
    lblWordWrap->setEditable (false, false, false);
    lblWordWrap->setColour (TextEditor::textColourId, Colours::black);
    lblWordWrap->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (lblReadingDirection = new Label (L"lblReadingDirection",
                                                        L"Reading Direction:"));
    lblReadingDirection->setFont (Font (15.0000f));
    lblReadingDirection->setJustificationType (Justification::centredLeft);
    lblReadingDirection->setEditable (false, false, false);
    lblReadingDirection->setColour (TextEditor::textColourId, Colours::black);
    lblReadingDirection->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (lblJustification = new Label (L"lblJustification",
                                                     L"Justification:"));
    lblJustification->setFont (Font (15.0000f));
    lblJustification->setJustificationType (Justification::centredLeft);
    lblJustification->setEditable (false, false, false);
    lblJustification->setColour (TextEditor::textColourId, Colours::black);
    lblJustification->setColour (TextEditor::backgroundColourId, Colour (0x0));

    addAndMakeVisible (lblLineSpacing = new Label (L"lblLineSpacing",
                                                   L"Line Spacing:"));
    lblLineSpacing->setFont (Font (15.0000f));
    lblLineSpacing->setJustificationType (Justification::centredLeft);
    lblLineSpacing->setEditable (false, false, false);
    lblLineSpacing->setColour (TextEditor::textColourId, Colours::black);
    lblLineSpacing->setColour (TextEditor::backgroundColourId, Colour (0x0));

//.........这里部分代码省略.........
开发者ID:sonic59,项目名称:JuceEditor,代码行数:101,代码来源:WindowComponent.cpp


示例15: paint

void HintOverlay::paint(Graphics &g)
{
    // see which button has been pressed
    const int modifierStatus = processor->getModifierBtnState();

    // if no button is pressed then don't display the hint
    if (modifierStatus == MappingEngine::rmNoBtn) return;

    // start with the background colour
    g.setColour(Colours::black.withAlpha(0.5f));
    g.fillRect(overlayPaintBounds);

    // TODO: should be not hardcoded.
    const int numMappings = 8;


    int buttonPadding;

    if (numMappings > 8)
    {
        buttonPadding = PAD_AMOUNT/2;
        g.setFont(Font("Verdana", 12.f, Font::plain));
    }
    else
    {
        buttonPadding = PAD_AMOUNT;
        g.setFont(Font("Verdana", 16.f, Font::plain));
    }

    const int buttonSize = (overlayPaintBounds.getWidth() - (numMappings + 1) * buttonPadding) / numMappings;


    for (int i = 0; i < numMappings; ++i)
    {
        const float xPos = (float) ((buttonPadding + buttonSize)*i + buttonPadding);
        const float yPos = (overlayPaintBounds.getHeight() - buttonSize) / 2.0f;

        // highlight any mappings that are held
        if (processor->isColumnHeld(i))
            g.setColour(Colours::orange);
        else
            g.setColour(Colours::white.withAlpha(0.9f));

        g.fillRoundedRectangle(xPos, yPos, (float) buttonSize, (float) buttonSize, buttonSize/10.0f);

        if (i > 7) break;

        // get the ID of the mapping associated with this type of modifier button
        const int currentMapping = processor->getMonomeMapping(modifierStatus, i);
        // and find out what its name is
        const String mappingName = processor->mappingEngine.getMappingName(modifierStatus, currentMapping);


        g.setColour(Colours::black);

        //g.drawMultiLineText(mappingName, xPos+2, yPos+10, buttonSize);
        g.drawFittedText(mappingName, (int) (xPos) + 1, (int) (yPos) + 1,
            buttonSize-2, buttonSize-2, Justification::centred, 4, 1.0f);

    }
}
开发者ID:grimtraveller,项目名称:mlrVST,代码行数:61,代码来源:HintOverlay.cpp


示例16: addAndMakeVisible

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FontPlatformData函数代码示例发布时间:2022-05-30
下一篇:
C++ Fmt函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap