예제 #1
0
void HSGameGuide::DrawRect( const GameGuide_Guide& guide )
{
	//HSAssert(m_pShape,"");
	CCLog("%.2f   ,%.2f",HSOffset::ShaderOffset()->OffsetX(),HSOffset::ShaderOffset()->OffsetY());
	CCPoint pos = ccp(guide.modepos().x(),guide.modepos().y());
	float lx =  pos.x - guide.w() / 2.f;
	float ly =  pos.y - guide.h() / 2.f + HSOffset::ShaderOffset()->OffsetY();

	CCRect ccRect(lx,ly,guide.w(),guide.h());

// 	CCPoint vertRect[4] = {CCPointZero};
// 	vertRect[0] = ccp(ccRect.getMinX(),ccRect.getMaxY());
// 	vertRect[1] = ccp(ccRect.getMaxX(),ccRect.getMaxY());
// 	vertRect[2] = ccp(ccRect.getMaxX(),ccRect.getMinY());
// 	vertRect[3] = ccp(ccRect.getMinX(),ccRect.getMinY());
// 
// 	ccColor4F green = {0, 1, 0, 1};
// 	m_pShape->clear();
// 	m_pShape->drawPolygon(vertRect,4,green,0,green);
	//m_pShape->setPosition(pos);

	//HSTool::SetPointScale(pos);

	//if (m_currentGuide.isintercepttouch())
	{
		if (m_currentGuide.isintercepttouch())
		{
			this->AddDefaultEvent();
		}else{
			m_ListerEvent.SetRect(ccRect,pos);
		}
	}

}
예제 #2
0
void HSGameGuide::DrawRound( const GameGuide_Guide& guide )
{
	return;
	HSAssert(m_pShape,"");

	const int MAXVERTCOUNT = 100;

	ccColor4F green = {0, 1, 0, 1};

	float fRadius = guide.w() / 2.f;
	float coef = 2.f * (float)M_PI/ MAXVERTCOUNT;
	CCPoint circle[MAXVERTCOUNT];
	for(unsigned int i = 0;i <MAXVERTCOUNT; i++) 
	{
		float rads = i * coef;
		circle[i].x = fRadius * cosf(rads);
		circle[i].y = fRadius * sinf(rads);
	}

	//CCPoint pos = ccp(guide.modepos().x(),guide.modepos().y());
	m_pShape->drawPolygon(circle, MAXVERTCOUNT, green, 0, green);
	//m_pShape->setPosition(pos);

	

	//HSTool::SetPointScale(pos);
	/**
	CCSprite* pHand = CCSprite::create("Image/hand.png");
	pHand->setAnchorPoint(ccp(0.0f,1.0f));
	pHand->setPosition(pos);
	this->addChild(pHand);
	m_nodeList.push_back(pHand);*/

	//if (m_currentGuide.isintercepttouch())
	{
		if (m_currentGuide.isintercepttouch())
		{
			this->AddDefaultEvent();
		}else{
			CCPoint pos = ccp(guide.modepos().x(),guide.modepos().y());
			float lx =  pos.x - guide.w() / 2.f;
			float ly =  pos.y - guide.h() / 2.f;
			CCRect ccRect(lx,ly,guide.w(),guide.h());
			m_ListerEvent.SetRect(ccRect,pos);
		}
	}
	
}
예제 #3
0
BView* PrefsWindow::constructColourBox(BRect frame)
{
	BBox* colourBox = new BBox(frame);
	colourBox->SetLabel("TexView");

	float	offset = 30.0f,
			texViewWidth = 280.0f,
			texHeight = 200.0f,
			adjust = 5.0f,
			cbheight = 14.0f,
			cbspacing = 10.0f,
			bwidth = 80.0f,
			bheight = 30.0f,
			bspacing = 10.0f	
			;
			
	BRect bounds = colourBox->Bounds();
	
	float texViewX1 = bounds.right - texViewWidth - (offset * 2.0f / 3.0f);
	float texViewX2 = bounds.right - (offset * 2.0f / 3.0f) - B_V_SCROLL_BAR_WIDTH;
	BRect texViewRect(texViewX1, offset - adjust, texViewX2, offset + texHeight - adjust);	
	BRect texViewTextRect(texViewRect);
		
	/*TexView *texView = new TexView(texViewRect, texViewTextRect, prefs);
	BString sampleText = "Welcome to \\betex!\\\\\n%This is a Comment\n$Phe\\alpha r the Calculus$\n\\subsection{About \\betex}\n\\betex is \\textbf{cool}!\\\\\n``To Be Or Not To Be\'\'\n";
	texView->SetText(sampleText.String(),sampleText.Length());
	texView->MakeEditable(false);
	texView->MakeSelectable(false);
	
	BScrollView *texViewScroll = new BScrollView("textViewScroll", texView, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW|B_FRAME_EVENTS|B_NAVIGABLE, false, true, B_FANCY_BORDER);
	texViewScroll->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	colourBox->AddChild(texViewScroll);	
	texView->SetTextRect(texView->Bounds());*/	
	
	//fg colour button
	BRect ccRect((offset*2/3),offset-adjust,offset+150,offset+cbheight-adjust);	
	rgb_color fgColour;
	ColourButton *fgColourButton = new ColourButton(ccRect, GetPrefsMessage(K_FG_COLOUR), fgColour," Text");
	colourBox->AddChild(fgColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color bgColour;
	ColourButton *bgColourButton = new ColourButton(ccRect, GetPrefsMessage(K_BG_COLOUR), bgColour, "Background");
	colourBox->AddChild(bgColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color genericCmdColour;
	ColourButton *genericCmdColourButton = new ColourButton(ccRect, GetPrefsMessage(K_GEN_CMD_COLOUR), genericCmdColour, "Generic Commands");
	colourBox->AddChild(genericCmdColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color formatCmdColour;
	ColourButton *formatCmdColourButton  = new ColourButton(ccRect, GetPrefsMessage(K_FORMAT_CMD_COLOUR), formatCmdColour, "Formatting Commands");
	colourBox->AddChild(formatCmdColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color specialCmdColour;
	ColourButton *specialCmdColourButton = new ColourButton(ccRect, GetPrefsMessage(K_SPECIAL_CMD_COLOUR), specialCmdColour, "Special Commands");
	colourBox->AddChild(specialCmdColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color mathModeColour;
	ColourButton *mathModeColourButton = new ColourButton(ccRect, GetPrefsMessage(K_MATH_MODE_COLOUR), mathModeColour, "Math Mode");
	colourBox->AddChild(mathModeColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color commaColour;
	ColourButton *commaColourButton = new ColourButton(ccRect, GetPrefsMessage(K_COMMA_COLOUR), commaColour, "Quotation Marks");
	colourBox->AddChild(commaColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color commentColour;
	ColourButton *commentColourButton = new ColourButton(ccRect,GetPrefsMessage(K_COMMENT_COLOUR),commentColour,"Comments");
	colourBox->AddChild(commentColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	rgb_color puncSymbolColour;
	ColourButton *puncSymbolColourButton = new ColourButton(ccRect,GetPrefsMessage(K_PUNC_SYMBOL_COLOUR),puncSymbolColour,"Punctuation / Symbols");
	colourBox->AddChild(puncSymbolColourButton);
	
	ccRect.OffsetBy(0,cbheight+cbspacing);
	//rgb_color htmlColour;
	//ColourButton *htmlColourButton = new ColourButton(ccRect,GetPrefsMessage(K_HTML_COLOUR), htmlColour,"Urls");
	//colourBox->AddChild(htmlColourButton);
	
	BRect cbRect = colourBox->Bounds();
	BRect cbbtnRect(cbRect.right - bspacing - bwidth, cbRect.bottom - bspacing - bheight, cbRect.right - bspacing, cbRect.bottom - bspacing);
	BButton *resetColourDefaults = new BButton(cbbtnRect,"fResetColorDefaults","Defaults",new BMessage(PrefsConstants::K_PREFS_VIEW_RESET_COLOUR_DEFAULTS));
	colourBox->AddChild(resetColourDefaults);
	
	float	sliderWidth = 300.0f,
			vertOffset = 50.0f,
			minVal = 5.0f,
			maxVal = 30.0f
			;		
	BRect sliderFrame(ccRect.left, ccRect.top + vertOffset, ccRect.left + sliderWidth, ccRect.top + vertOffset + 100.0f);
	BSlider *fontSizeSlider = new BSlider(sliderFrame, K_FONT_SIZE, "Font Size", GetPrefsMessage(K_FONT_SIZE), minVal, maxVal);
	colourBox->AddChild(fontSizeSlider);
	
	fontSizeSlider->SetBarColor(ui_color(B_WINDOW_TAB_COLOR));
	fontSizeSlider->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fontSizeSlider->SetHashMarkCount(26);
	float fontSize = 12.0f;
	fontSizeSlider->SetValue(fontSize);
	fontSizeSlider->SetLimitLabels("Small","Large");
	fontSizeSlider->SetModificationMessage(GetPrefsMessage(K_FONT_SIZE));
		
	rgb_color fire_r = {223,0,50};
	const rgb_color* fillcolor = &fire_r;
	fontSizeSlider->UseFillColor(true,fillcolor);
	
	return colourBox;
}