当前位置: 首页>>代码示例>>C++>>正文


C++ createRect函数代码示例

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


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

示例1: name

LLView* LLViewerTextEditor::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
	std::string name("text_editor");
	node->getAttributeString("name", name);

	LLRect rect;
	createRect(node, rect, parent, LLRect());

	U32 max_text_length = 255;
	node->getAttributeU32("max_length", max_text_length);

	BOOL allow_embedded_items = FALSE;
	node->getAttributeBOOL("embedded_items", allow_embedded_items);

	LLFontGL* font = LLView::selectFont(node);

	// std::string text = node->getValue();
	std::string text = node->getTextContents().substr(0, max_text_length - 1);

	if (text.size() > max_text_length)
	{
		// Erase everything from max_text_length on.
		text.erase(max_text_length);
	}

	LLViewerTextEditor* text_editor = new LLViewerTextEditor(name, 
								rect,
								max_text_length,
								LLStringUtil::null,
								font,
								allow_embedded_items);

	BOOL ignore_tabs = text_editor->tabsToNextField();
	node->getAttributeBOOL("ignore_tab", ignore_tabs);
	text_editor->setTabsToNextField(ignore_tabs);

	text_editor->setTextEditorParameters(node);

	BOOL hide_scrollbar = FALSE;
	node->getAttributeBOOL("hide_scrollbar",hide_scrollbar);
	text_editor->setHideScrollbarForShortDocs(hide_scrollbar);

	BOOL hide_border = !text_editor->isBorderVisible();
	node->getAttributeBOOL("hide_border", hide_border);
	text_editor->setBorderVisible(!hide_border);

	BOOL parse_html = text_editor->mParseHTML;
	node->getAttributeBOOL("allow_html", parse_html);
	text_editor->setParseHTML(parse_html);
	text_editor->setParseHighlights(TRUE);

	text_editor->initFromXML(node, parent);

	// add text after all parameters have been set
	text_editor->appendStyledText(text, FALSE, FALSE);

	return text_editor;
}
开发者ID:Beeks,项目名称:Ascent,代码行数:58,代码来源:llviewertexteditor.cpp

示例2: checkClick

int Menu::checkClick(const int x, const int y)
{
    for(unsigned int i=0; i < this->buttons.size(); i++)
    {
        if(detectCollision(this->buttons[i]->mouseOverBox, createRect(x, y, 0, 0)))
            return i;
    }
    return -1;
}
开发者ID:Shaptic,项目名称:NPong,代码行数:9,代码来源:MenuCreation.cpp

示例3: name

LLView* LLSpinCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
	LLString name("spinner");
	node->getAttributeString("name", name);

	LLString label;
	node->getAttributeString("label", label);

	LLRect rect;
	createRect(node, rect, parent, LLRect());

	LLFontGL* font = LLView::selectFont(node);

	F32 initial_value = 0.f;
	node->getAttributeF32("initial_val", initial_value);

	F32 min_value = 0.f;
	node->getAttributeF32("min_val", min_value);

	F32 max_value = 1.f; 
	node->getAttributeF32("max_val", max_value);

	F32 increment = 0.1f;
	node->getAttributeF32("increment", increment);

	U32 precision = 3;
	node->getAttributeU32("decimal_digits", precision);
	
	S32 label_width = llmin(40, rect.getWidth() - 40);
	node->getAttributeS32("label_width", label_width);

	LLUICtrlCallback callback = NULL;

	if(label.empty())
	{
		label.assign( node->getValue() );
	}

	LLSpinCtrl* spinner = new LLSpinCtrl(name,
							rect,
							label,
							font,
							callback,
							NULL,
							initial_value, 
							min_value, 
							max_value, 
							increment,
							"",
							label_width);

	spinner->setPrecision(precision);

	spinner->initFromXML(node, parent);

	return spinner;
}
开发者ID:xinyaojiejie,项目名称:Dale,代码行数:57,代码来源:llspinctrl.cpp

示例4: p2_test_overlapping_rects_2

static void p2_test_overlapping_rects_2(void)
{
	// Square centered on 2,2
	struct PC_vertex_ll * r1 = createRect(2,2,4,4);
	
	// Square centered on 4,4
	struct PC_vertex_ll * r2 = createRectCW(4,4,4,4);
	
	enum PC_op_t op = PC_op_union;
	
	bool result = PC_phase_one(r1, r2); 
	PC_phase_two(r1, r2, op);
	
	// Should be:
	/*
	 *
	 *
	 *           R2_2-------------------R2_3
	 *             |                      |
	 *             |                      |
	 *    R1_5--R1_4/R2_1--R1_3           |
	 *     |       |         |            |
	 *     |       |         |            |
	 *     |     R2_0------R1_2/R2_5----R2_4
	 *     |                 |
	 *     |                 |
	 *    R1_0-------------R1_1
	 *
	 */
	
	
	LT_ASSERT(_I(r1, 0)->flag == FLG_NONE);
	LT_ASSERT(_I(r1, 1)->flag == FLG_NONE);
	LT_ASSERT(_I(r1, 2)->flag == FLG_EN);
	LT_ASSERT(_I(r1, 3)->flag == FLG_NONE);
	LT_ASSERT(_I(r1, 4)->flag == FLG_EX);
	LT_ASSERT(_I(r1, 5)->flag == FLG_NONE);
	
	LT_ASSERT(_I(r2, 0)->flag == FLG_NONE);
	LT_ASSERT(_I(r2, 1)->flag == FLG_EX);
	LT_ASSERT(_I(r2, 2)->flag == FLG_NONE);
	LT_ASSERT(_I(r2, 3)->flag == FLG_NONE);
	LT_ASSERT(_I(r2, 4)->flag == FLG_NONE);
	LT_ASSERT(_I(r2, 5)->flag == FLG_EN);
	
	
	LT_ASSERT(no_couples(r1));
	LT_ASSERT(no_couples(r2));
    
    
    PC_free_verticies(r1);
    PC_free_verticies(r2);
}
开发者ID:davidcarne,项目名称:polyclip,代码行数:53,代码来源:phase_2_tests.c

示例5: name

// static
LLView* LLScrollingPanelList::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
    LLString name("scrolling_panel_list");
    node->getAttributeString("name", name);

    LLRect rect;
    createRect(node, rect, parent, LLRect());

    LLScrollingPanelList* scrolling_panel_list = new LLScrollingPanelList(name, rect);
    scrolling_panel_list->initFromXML(node, parent);
    return scrolling_panel_list;
}
开发者ID:Boy,项目名称:netbook,代码行数:13,代码来源:llscrollingpanellist.cpp

示例6: SDL_Program

Mario::Mario(std::string imageURL) : SDL_Program()
{
  //Initialize animation variables
  status = MARIO_STAND;
  frame = 0;
  
  //Create the Mario surface
  marioSurface = loadImage("tokenImages/RobodogPositions.bmp");

  //Initialize movement variables
    marioRect = createRect(marioSurface, SCREEN_WIDTH - TOKEN_LIB_W, SCREEN_HEIGHT - TOKEN_LIB_H - RUN_BUTTON_H - MARIO_HEIGHT);
}
开发者ID:dtamaru,项目名称:CSE20212FinalProject,代码行数:12,代码来源:Mario.cpp

示例7: entity_checkCollisionWithMap

void entity_checkCollisionWithMap(const Entity& entity, sf::Vector2f& movement)
{
	for (auto &obj : level_getCollisions(*entity.level))
	{
		if (obj.GetType() == "solid")
		{
			sf::FloatRect objRect(createRect(OrthogonalToIsometric(obj.GetPosition()), obj.GetSize()));
			if (createRect(OrthogonalToIsometric(entity.objectEntity->GetPosition() + movement), entity.objectEntity->GetSize()).intersects(objRect))
			{
				if (movement.y > 0.f)
					movement.y = 0.f;
				if (movement.y < 0.f)
					movement.y = 0.f;
				if (movement.x > 0)
					movement.x = 0.f;
				if (movement.x < 0)
					movement.x = 0.f;
			}
		}
	}
	for (auto &unit : level_getUnits(*entity.level))
	{
		auto un = unit.GetPropertyString("dead");
		if (unit.GetName() != entity.objectEntity->GetName() && unit.GetPropertyString("dead") == "0")
		{
			sf::FloatRect unitRect(createRect(OrthogonalToIsometric(unit.GetPosition()), unit.GetSize()));
			if (createRect(OrthogonalToIsometric(entity.objectEntity->GetPosition() + movement), entity.objectEntity->GetSize()).intersects(unitRect))
			{
				if (movement.y > 0.f)
					movement.y = 0.f;
				if (movement.y < 0.f)
					movement.y = 0.f;
				if (movement.x > 0)
					movement.x = 0.f;
				if (movement.x < 0)
					movement.x = 0.f;
			}
		}
	}
}
开发者ID:AndrewOvchinnikov,项目名称:DarkRPG,代码行数:40,代码来源:Entity.cpp

示例8: name

LLView* LLPanel::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFactory *factory)
{
	std::string name("panel");
	node->getAttributeString("name", name);

	LLPanel* panelp = factory->createFactoryPanel(name);
	LLFastTimer _(FTM_PANEL_CONSTRUCTION);
	// Fall back on a default panel, if there was no special factory.
	if (!panelp)
	{
		LLRect rect;
		createRect(node, rect, parent, LLRect());
		// create a new panel without a border, by default
		panelp = new LLPanel(name, rect, FALSE);
		// for local registry callbacks; define in constructor, referenced in XUI or postBuild
		panelp->mCommitCallbackRegistrar.pushScope(); 
		panelp->mEnableCallbackRegistrar.pushScope();
		panelp->initPanelXML(node, parent, factory);
		panelp->mCommitCallbackRegistrar.popScope();
		panelp->mEnableCallbackRegistrar.popScope();
		// preserve panel's width and height, but override the location
		const LLRect& panelrect = panelp->getRect();
		S32 w = panelrect.getWidth();
		S32 h = panelrect.getHeight();
		rect.setLeftTopAndSize(rect.mLeft, rect.mTop, w, h);
		panelp->setRect(rect);
	}
	else
	{
		if(!factory->builtPanel(panelp))
		{
			// for local registry callbacks; define in constructor, referenced in XUI or postBuild
			panelp->mCommitCallbackRegistrar.pushScope(); 
			panelp->mEnableCallbackRegistrar.pushScope();
			panelp->initPanelXML(node, parent, factory);
			panelp->mCommitCallbackRegistrar.popScope();
			panelp->mEnableCallbackRegistrar.popScope();
		}
		else
		{
			LLRect new_rect = panelp->getRect();
			// override rectangle with embedding parameters as provided
			panelp->createRect(node, new_rect, parent);
			panelp->setOrigin(new_rect.mLeft, new_rect.mBottom);
			panelp->setShape(new_rect);
			// optionally override follows flags from including nodes
			panelp->parseFollowsFlags(node);
		}
	}

	return panelp;
}
开发者ID:CmdrCupcake,项目名称:SingularityViewer,代码行数:52,代码来源:llpanel.cpp

示例9: label

//static 
LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
	std::string name = "flyout_button";
	node->getAttributeString("name", name);

	std::string label("");
	node->getAttributeString("label", label);

	LLRect rect;
	createRect(node, rect, parent, LLRect());

	LLUICtrlCallback callback = NULL;

	LLFlyoutButton* flyout_button = new LLFlyoutButton(name,
							rect, 
							label,
							callback,
							NULL);

	std::string list_position;
	node->getAttributeString("list_position", list_position);
	if (list_position == "below")
	{
		flyout_button->mListPosition = BELOW;
	}
	else if (list_position == "above")
	{
		flyout_button->mListPosition = ABOVE;
	}
	

	flyout_button->initFromXML(node, parent);

	LLXMLNodePtr child;
	for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
	{
		if (child->hasName("flyout_button_item"))
		{
			std::string label = child->getTextContents();

			std::string value = label;
			child->getAttributeString("value", value);

			flyout_button->add(label, LLSD(value) );
		}
	}

	flyout_button->updateLayout();

	return flyout_button;
}
开发者ID:VirtualReality,项目名称:Viewer,代码行数:52,代码来源:llcombobox.cpp

示例10: name

// static
LLView* LLCheckBoxCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
	std::string name("checkbox");
	node->getAttributeString("name", name);

	std::string label("");
	node->getAttributeString("label", label);

	LLFontGL* font = LLView::selectFont(node);

	BOOL radio_style = FALSE;
	node->getAttributeBOOL("radio_style", radio_style);

	LLUICtrlCallback callback = NULL;

	if (label.empty())
	{
		label.assign(node->getTextContents());
	}

	LLRect rect;
	createRect(node, rect, parent, LLRect());

	LLCheckBoxCtrl* checkbox = new LLCheckboxCtrl(name, 
		rect, 
		label,
		font,
		callback,
		NULL,
		FALSE,
		radio_style); // if true, draw radio button style icons

	BOOL initial_value = checkbox->getValue().asBoolean();
	node->getAttributeBOOL("initial_value", initial_value);

	LLColor4 color;
	color = LLUI::sColorsGroup->getColor( "LabelTextColor" );
	LLUICtrlFactory::getAttributeColor(node,"text_enabled_color", color);
	checkbox->setEnabledColor(color);

	color = LLUI::sColorsGroup->getColor( "LabelDisabledColor" );
	LLUICtrlFactory::getAttributeColor(node,"text_disabled_color", color);
	checkbox->setDisabledColor(color);

	checkbox->setValue(initial_value);

	checkbox->initFromXML(node, parent);

	return checkbox;
}
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:51,代码来源:llcheckboxctrl.cpp

示例11: name

LLView* DOHexEditor::fromXML(LLXMLNodePtr node, LLView *parent, class LLUICtrlFactory *factory)
{
	std::string name("text_editor");
	node->getAttributeString("name", name);

	LLRect rect;
	createRect(node, rect, parent, LLRect());

	DOHexEditor* editor = new DOHexEditor(name, rect);

	editor->initFromXML(node, parent);

	return editor;
}
开发者ID:AGoodPerson,项目名称:Ascent,代码行数:14,代码来源:dohexeditor.cpp

示例12: renderMultiLineText

void Menu::newToggle(const char* text, TOGGLE toggle_type, bool on)
{
    this->buttons.push_back(new Button);

    if(this->centerText)
    {
        this->buttons[LAST]->normalButton = renderMultiLineText(
            this->font, text, this->hlColor, this->fgColor,
            ALIGN_CENTER | TRANSPARENT_BG | CREATE_SURFACE);

        this->buttons[LAST]->highlightedButton = renderMultiLineText(
            this->font, text, this->fgColor, this->hlColor,
            ALIGN_CENTER | TRANSPARENT_BG | CREATE_SURFACE);

        this->buttons[LAST]->x = ((SCREEN_WIDTH / 2) - 
            (this->buttons[LAST]->normalButton->clip_rect.w / 2));

        this->inbetween = this->buttons[LAST]->normalButton->clip_rect.h;
        this->buttons[LAST]->y = this->y;
        this->y += this->inbetween;
    }
    else
    {
        this->buttons[LAST]->normalButton = renderMultiLineText(
            this->font, (string)text, this->hlColor, this->fgColor,
            TRANSPARENT_BG | CREATE_SURFACE);

        this->buttons[LAST]->highlightedButton = renderMultiLineText(
            this->font, (string)text, this->fgColor, this->hlColor,
            TRANSPARENT_BG | CREATE_SURFACE);

        this->inbetween = this->buttons[LAST]->normalButton->clip_rect.h;
        this->buttons[LAST]->x = this->x;
        this->buttons[LAST]->y = this->y;
        this->y += this->inbetween;
    }

    this->buttons[LAST]->mouseOverBox = createRect(this->buttons[LAST]->x,
        this->buttons[LAST]->y,
        this->buttons[LAST]->normalButton->clip_rect.w,
        this->buttons[LAST]->normalButton->clip_rect.h);

    this->buttons[LAST]->type = TOGGLE_MENU;
    this->buttons[LAST]->button_text = new char[strlen(text) + 1];
    strncpy(this->buttons[LAST]->button_text, text, strlen(text) + 1);
    this->buttons[LAST]->action = NO_ACTION;
    this->buttons[LAST]->toggle = toggle_type;
    this->buttons[LAST]->highlights = true;
    this->buttons[LAST]->switch_status = on;
}
开发者ID:Shaptic,项目名称:NPong,代码行数:50,代码来源:MenuCreation.cpp

示例13: p2_test_semi2

static void p2_test_semi2(void)
{
	struct PC_vertex_ll * r1 = createRect(2,2,4,4);
	struct PC_vertex_ll * r2 = createRectCW(4,3,2,2);
	
	enum PC_op_t op = PC_op_union;
	bool result = PC_phase_one(r1, r2); 
	
	
	
	LT_REQUIRE(polySize(r1) == 6); 
	LT_REQUIRE(polySize(r2) == 6);
	
	PC_phase_two(r1, r2, op);
	

	LT_ASSERT(_I(r1, 0)->flag == FLG_NONE);
	LT_ASSERT(_I(r1, 1)->flag == FLG_NONE);
	LT_ASSERT(_I(r1, 2)->flag == FLG_EN);
	LT_ASSERT(_I(r1, 3)->flag == FLG_EX);
	LT_ASSERT(_I(r1, 4)->flag == FLG_EX);
	LT_ASSERT(_I(r1, 5)->flag == FLG_NONE);
	
	LT_ASSERT(_I(r2, 0)->flag == FLG_NONE);
	LT_ASSERT(_I(r2, 1)->flag == FLG_EX);
	LT_ASSERT(_I(r2, 2)->flag == FLG_EX);
	LT_ASSERT(_I(r2, 3)->flag == FLG_NONE);
	LT_ASSERT(_I(r2, 4)->flag == FLG_NONE);
	LT_ASSERT(_I(r2, 5)->flag == FLG_EN);
	
	
	// Test couple creation
	LT_ASSERT(_I(r1, 0)->couple == NULL);
	LT_ASSERT(_I(r1, 1)->couple == NULL);
	LT_ASSERT(_I(r1, 2)->couple == NULL);
	LT_ASSERT(_I(r1, 3)->couple == _I(r1, 4));
	LT_ASSERT(_I(r1, 4)->couple == _I(r1, 3));
	LT_ASSERT(_I(r1, 5)->couple == NULL);
	
	LT_ASSERT(_I(r2, 0)->couple == NULL);
	LT_ASSERT(_I(r2, 1)->couple == _I(r2, 2));
	LT_ASSERT(_I(r2, 2)->couple == _I(r2, 1));
	LT_ASSERT(_I(r2, 3)->couple == NULL);
	LT_ASSERT(_I(r2, 4)->couple == NULL);
	LT_ASSERT(_I(r2, 5)->couple == NULL);
    
    
    PC_free_verticies(r1);
    PC_free_verticies(r2);
}
开发者ID:davidcarne,项目名称:polyclip,代码行数:50,代码来源:phase_2_tests.c

示例14: sval

LLView* LLMediaCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
	LLMediaCtrl::Params p;
	
	BOOL bval;
	LLColor4 color;
	S32 ival;
	LLRect rect;

	std::string sval("web_browser");
	node->getAttributeString("name", sval);
	p.name = sval;
	createRect(node, rect, parent, LLRect());
	p.rect = rect;

	if(node->getAttributeString("start_url", sval ))
		p.start_url = sval;
	if(node->getAttributeString("error_page_url", sval ))
		p.error_page_url = sval;
	if(node->getAttributeString("media_id", sval ))
		p.media_id = sval;
	if(node->getAttributeString("initial_mime_type", sval ))
		p.initial_mime_type = sval;
	if(node->getAttributeBOOL("border_visible", bval))
		p.border_visible = bval;
	if(node->getAttributeBOOL("focus_on_click", bval))
		p.focus_on_click = bval;
	if(node->getAttributeBOOL("decouple_texture_size", bval))
		p.decouple_texture_size = bval;
	if(node->getAttributeBOOL("trusted_content", bval))
		p.trusted_content = bval;
	if(node->getAttributeS32("texture_width", ival))
		p.texture_width = ival;
	if(node->getAttributeBOOL("texture_height", ival))
		p.texture_height = ival;
	if(LLUICtrlFactory::getAttributeColor(node, "caret_color", color))
		p.caret_color = color;

	LLMediaCtrl* web_browser = LLUICtrlFactory::create<LLMediaCtrl>(p,parent);

	web_browser->initFromXML(node, parent);

	if(!p.start_url.getValue().empty())
	{
		web_browser->navigateHome();
	}

	return web_browser;
}
开发者ID:AlericInglewood,项目名称:SingularityViewer,代码行数:49,代码来源:llmediactrl.cpp

示例15: name

//static
LLView* LLMultiSlider::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
    std::string name("multi_slider_bar");
    node->getAttributeString("name", name);

    LLRect rect;
    createRect(node, rect, parent, LLRect());

    F32 initial_value = 0.f;
    node->getAttributeF32("initial_val", initial_value);

    F32 min_value = 0.f;
    node->getAttributeF32("min_val", min_value);

    F32 max_value = 1.f;
    node->getAttributeF32("max_val", max_value);

    F32 increment = 0.1f;
    node->getAttributeF32("increment", increment);

    S32 max_sliders = 1;
    node->getAttributeS32("max_sliders", max_sliders);

    BOOL allow_overlap = FALSE;
    node->getAttributeBOOL("allow_overlap", allow_overlap);

    BOOL draw_track = TRUE;
    node->getAttributeBOOL("draw_track", draw_track);

    BOOL use_triangle = FALSE;
    node->getAttributeBOOL("use_triangle", use_triangle);

    LLMultiSlider* multiSlider = new LLMultiSlider(name,
            rect,
            NULL,
            NULL,
            initial_value,
            min_value,
            max_value,
            increment,
            max_sliders,
            allow_overlap,
            draw_track,
            use_triangle);

    multiSlider->initFromXML(node, parent);

    return multiSlider;
}
开发者ID:Barosonix,项目名称:AstraViewer,代码行数:50,代码来源:llmultislider.cpp


注:本文中的createRect函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。