예제 #1
0
void IGLUShaderVariable::operator= ( int4 val )
{
	// Check for a valid shader index
	if ( m_varIdx < 0 ) return;

	// Check for type mismatches
	if ( m_isAttribute )
	{
		AssignmentToAttribute( "ivec4" );
		return;
	}
	if ( m_varType != GL_INT_VEC4 && m_varType != GL_UNSIGNED_INT_VEC4 )
		TypeMismatch( "ivec4" );

	// Ensure this program is currently bound, or setting shader values fails!
	m_parent->PushProgram();

	// For types of variable that can be assigned from our input value, assign them here
	if ( m_varType == GL_INT_VEC4 )
		glUniform4iv( m_varIdx, 1, val.GetConstDataPtr() ); 
	if ( m_varType == GL_UNSIGNED_INT_VEC4 )
		glUniform4ui( m_varIdx, val.X(), val.Y(), val.Z(), val.W() );

	// We have a short "program stack" so make sure to pop off.
	m_parent->PopProgram();
}	
예제 #2
0
	UIStatic::UIStatic(UIDialogPtr const & dialog, int ID, std::wstring const & strText, int4 const & coord_size, bool bIsDefault)
					: UIControl(UIStatic::Type, dialog),
						text_(strText)
	{
		this->InitDefaultElements();

		// Set the ID and list index
		this->SetID(ID);
		this->SetLocation(coord_size.x(), coord_size.y());
		this->SetSize(coord_size.z(), coord_size.w());
		this->SetIsDefault(bIsDefault);
	}
예제 #3
0
	UIProgressBar::UIProgressBar(UIDialogPtr const & dialog, int ID, int progress, int4 const & coord_size, uint8_t hotkey, bool bIsDefault)
					: UIControl(UIProgressBar::Type, dialog),
						progress_(progress)
	{
		this->InitDefaultElements();

		// Set the ID and list index
		this->SetID(ID);
		this->SetLocation(coord_size.x(), coord_size.y());
		this->SetSize(coord_size.z(), coord_size.w());
		this->SetHotkey(hotkey);
		this->SetIsDefault(bIsDefault);
	}
예제 #4
0
	UICheckBox::UICheckBox(UIDialogPtr const & dialog, int ID, std::wstring const & strText, int4 const & coord_size, bool bChecked, uint8_t hotkey, bool bIsDefault)
					: UIControl(UICheckBox::Type, dialog),
						checked_(bChecked), pressed_(false),
						text_(strText)
	{
		this->InitDefaultElements();

		// Set the ID and list index
		this->SetID(ID);
		this->SetLocation(coord_size.x(), coord_size.y());
		this->SetSize(coord_size.z(), coord_size.w());
		this->SetHotkey(hotkey);
		this->SetIsDefault(bIsDefault);
	}
예제 #5
0
	UIPolylineEditBox::UIPolylineEditBox(UIDialogPtr const & dialog, int ID, int4 const & coord_size, uint8_t hotkey, bool bIsDefault)
					: UIControl(UIPolylineEditBox::Type, dialog),
						active_pt_(-1),
						move_point_(false)
	{
		this->InitDefaultElements();

		// Set the ID and list index
		this->SetID(ID);
		this->SetLocation(coord_size.x(), coord_size.y());
		this->SetSize(coord_size.z(), coord_size.w());
		this->SetHotkey(hotkey);
		this->SetIsDefault(bIsDefault);
	}
예제 #6
0
파일: UISlider.cpp 프로젝트: Chenmxs/KlayGE
	UISlider::UISlider(UIDialogPtr const & dialog, int ID, int4 const & coord_size, int min, int max, int value, bool bIsDefault)
					: UIControl(UISlider::Type, dialog),
						value_(value), min_(min), max_(max),
						pressed_(false)
	{
		this->InitDefaultElements();

		// Set the ID and list index
		this->SetID(ID);
		this->SetLocation(coord_size.x(), coord_size.y());
		this->SetSize(coord_size.z(), coord_size.w());
		this->SetIsDefault(bIsDefault);

		this->UpdateRects();
	}
예제 #7
0
	UITexButton::UITexButton(UIDialogPtr const & dialog, int ID, TexturePtr const & tex, int4 const & coord_size, uint8_t hotkey, bool bIsDefault)
					: UIControl(UITexButton::Type, dialog),
						pressed_(false)
	{
		tex_index_ = UIManager::Instance().AddTexture(tex);

		this->InitDefaultElements();

		// Set the ID and list index
		this->SetID(ID);
		this->SetLocation(coord_size.x(), coord_size.y());
		this->SetSize(coord_size.z(), coord_size.w());
		this->SetHotkey(hotkey);
		this->SetIsDefault(bIsDefault);
	}
예제 #8
0
	UIListBox::UIListBox(UIDialogPtr const & dialog, int ID, int4 const & coord_size, STYLE dwStyle)
						: UIControl(UIListBox::Type, dialog),
							scroll_bar_(dialog),
							sb_width_(16), border_(6), margin_(5), text_height_(0),
							style_(dwStyle),
							selected_(-1), sel_start_(0),
							drag_(false)

	{
		this->InitDefaultElements();

		this->GetDialog()->InitControl(scroll_bar_);

		// Set the ID and position
		this->SetID(ID);
		this->SetLocation(coord_size.x(), coord_size.y());
		this->SetSize(coord_size.z(), coord_size.w());
	}
예제 #9
0
	UIComboBox::UIComboBox(UIDialogPtr const & dialog, int ID, int4 const & coord_size, uint8_t hotkey, bool bIsDefault)
						: UIControl(UIComboBox::Type, dialog),
							selected_(-1), focused_(-1),
							drop_height_(100), scroll_bar_(dialog),
							sb_width_(16), opened_(false),
							pressed_(false)
	{
		this->InitDefaultElements();

		this->GetDialog()->InitControl(scroll_bar_);

		// Set the ID and list index
		this->SetID(ID);
		this->SetLocation(coord_size.x(), coord_size.y());
		this->SetSize(coord_size.z(), coord_size.w());
		this->SetHotkey(hotkey);
		this->SetIsDefault(bIsDefault);
	}
예제 #10
0
	UIScrollBar::UIScrollBar(UIDialogPtr const & dialog, int ID, int4 const & coord_size, int nTrackStart, int nTrackEnd, int nTrackPos, int nPageSize)
					: UIControl(UIScrollBar::Type, dialog),
						show_thumb_(true), drag_(false),
						position_(nTrackPos), page_size_(nPageSize),
						start_(nTrackStart), end_(nTrackEnd),
						arrow_(CLEAR), arrow_ts_(0)
	{
		up_button_rc_ = IRect(0, 0, 0, 0);
		down_button_rc_ = IRect(0, 0, 0, 0);
		track_rc_ = IRect(0, 0, 0, 0);
		thumb_rc_ = IRect(0, 0, 0, 0);

		this->InitDefaultElements();

		// Set the ID and position
		this->SetID(ID);
		this->SetLocation(coord_size.x(), coord_size.y());
		this->SetSize(coord_size.z(), coord_size.w());
	}
예제 #11
0
	UIEditBox::UIEditBox(UIDialogPtr const & dialog, int ID, std::wstring const & strText, int4 const & coord_size, bool bIsDefault)
					: UIControl(UIEditBox::Type, dialog),
						border_(5),	// Default border width
						spacing_(4),	// Default spacing
#ifdef KLAYGE_PLATFORM_WINDOWS
#ifdef KLAYGE_PLATFORM_WINDOWS_DESKTOP
						blink_time_(GetCaretBlinkTime() * 0.001f),
#else
						blink_time_(1),
#endif
#else
						blink_time_(1),
#endif
						last_blink_time_(timer_.current_time()),
						caret_on_(true),
						caret_pos_(0),
						insert_mode_(true),
						sel_start_(0),
						first_visible_(0),
						text_color_(16.0f / 255, 16.0f / 255, 16.0f / 255, 1),
						sel_text_color_(1, 1, 1, 1),
						sel_bk_color_(40.0f / 255, 50.0f / 255, 92.0f / 255, 1),
						caret_color_(0, 0, 0, 1),
						mouse_drag_(false)
	{
		hide_caret_ = false;

		this->InitDefaultElements();

		// Set the ID and position
		this->SetID(ID);
		this->SetLocation(coord_size.x(), coord_size.y());
		this->SetSize(coord_size.z(), coord_size.w());
		this->SetIsDefault(bIsDefault);

		this->SetText(strText);
	}