예제 #1
0
	GUIStatusBar::GUIStatusBar(const PrivatelyConstruct& dummy,
		const String& style, const GUIDimensions& dimensions)
		:GUIElementContainer(dimensions, style)
	{
		mPanel = GUIPanel::create();
		mBgPanel = GUIPanel::create(1);
		_registerChildElement(mPanel);
		_registerChildElement(mBgPanel);

		mBackground = GUITexture::create(GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(getGUIBackgroundTypeName()));
		mMessage = GUIButton::create(HString(L""), GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(getGUIMessageTypeName()));
		mScene = GUILabel::create(HString(L"Scene: Unnamed"), GUIOptions(GUIOption::fixedWidth(150)));
		mProject = GUILabel::create(HString(L"Project: None"), GUIOptions(GUIOption::fixedWidth(200)));
		mCompiling = GUILabel::create(HString(L"Compiling..."), GUIOptions(GUIOption::fixedWidth(100)));

		GUILayoutY* vertLayout = mPanel->addNewElement<GUILayoutY>();
		vertLayout->addNewElement<GUIFixedSpace>(3);
		GUILayoutX* horzLayout = vertLayout->addNewElement<GUILayoutX>();

		horzLayout->addNewElement<GUIFixedSpace>(10);
		horzLayout->addElement(mMessage);
		horzLayout->addNewElement<GUIFlexibleSpace>();
		horzLayout->addElement(mScene);
		horzLayout->addNewElement<GUIFixedSpace>(10);
		horzLayout->addElement(mProject);
		horzLayout->addNewElement<GUIFixedSpace>(10);
		horzLayout->addElement(mCompiling);
		horzLayout->addNewElement<GUIFixedSpace>(10);

		mBgPanel->addElement(mBackground);
		mCompiling->setActive(false);

		mLogEntryAddedConn = gDebug().onLogModified.connect(std::bind(&GUIStatusBar::logModified, this));
		mMessageBtnPressedConn = mMessage->onClick.connect(std::bind(&GUIStatusBar::messageBtnClicked, this));
	}
예제 #2
0
	GUIVector2Field::GUIVector2Field(const PrivatelyConstruct& dummy, const GUIContent& labelContent, 
		UINT32 labelWidth, const String& style, const GUIDimensions& dimensions, bool withLabel)
		:TGUIField(dummy, labelContent, labelWidth, style, dimensions, withLabel),
		mFieldX(nullptr), mFieldY(nullptr)
	{
		mFieldX = GUIFloatField::create(HString(L"X"), ELEMENT_LABEL_WIDTH, getSubStyleName(getFloatFieldStyleType()));
		mFieldY = GUIFloatField::create(HString(L"Y"), ELEMENT_LABEL_WIDTH, getSubStyleName(getFloatFieldStyleType()));

		mFieldX->onValueChanged.connect(std::bind(&GUIVector2Field::valueChanged, this, _1));
		mFieldY->onValueChanged.connect(std::bind(&GUIVector2Field::valueChanged, this, _1));
		mFieldX->onConfirm.connect(std::bind(&GUIVector2Field::inputConfirmed, this));
		mFieldY->onConfirm.connect(std::bind(&GUIVector2Field::inputConfirmed, this));

		mLayout->removeElement(mLabel);

		GUILayout* layout = mLayout->addNewElement<GUILayoutY>();

		layout->addElement(mLabel);
		mLabel->resetDimensions();

		GUILayout* elementLayout = layout->addNewElement<GUILayoutX>();

		elementLayout->addElement(mFieldX);
		elementLayout->addElement(mFieldY);
	}
	ScriptEditorWidget::ScriptEditorWidget(const String& ns, const String& type, UINT32 defaultWidth, 
		UINT32 defaultHeight, EditorWidgetContainer& parentContainer)
		: EditorWidgetBase(HString(toWString(type)), ns + "." + type, defaultWidth, defaultHeight, parentContainer)
		, mNamespace(ns), mTypename(type), mOnInitializeThunk(nullptr), mOnDestroyThunk(nullptr), mUpdateThunk(nullptr)
		, mManagedInstance(nullptr), mGetDisplayName(nullptr), mScriptOwner(nullptr), mContentsPanel(nullptr)
		, mIsInitialized(false)
	{
		if(createManagedInstance())
		{
			if (mGetDisplayName != nullptr)
			{
				MonoObject* displayNameMono = mGetDisplayName->invokeVirtual(mManagedInstance, nullptr);
				ScriptHString* scriptHString = ScriptHString::toNative(displayNameMono);

				if (scriptHString != nullptr)
				{
					mDisplayName = HString(scriptHString->getInternalValue());
					parentContainer.refreshWidgetNames();
				}
			}
		}
	}
	void GUIGameObjectField::setValue(const HGameObject& value, bool triggerEvent)
	{
		if (value)
		{
			if (mInstanceId == value.getInstanceId())
				return;

			mInstanceId = value->getInstanceId();
			mDropButton->setContent(GUIContent(HString(toWString(value->getName()) + L" (" + toWString(mType) + L")")));
		}
		else
		{
			if (mInstanceId == 0)
				return;

			mInstanceId = 0;
			mDropButton->setContent(GUIContent(HString(L"None (" + toWString(mType) + L")")));
		}

		if (triggerEvent)
			onValueChanged(value);
	}
예제 #5
0
	GUIScrollBar::GUIScrollBar(bool horizontal, const String& styleName, const GUIDimensions& dimensions)
		:GUIElement(styleName, dimensions), mHorizontal(horizontal)
	{
		mImageSprite = bs_new<ImageSprite>();

		if(mHorizontal)
		{
			mLayout = GUILayoutX::create();
			_registerChildElement(mLayout);

			mUpBtn = GUIButton::create(HString(L""), "ScrollLeftBtn");
			mDownBtn = GUIButton::create(HString(L""), "ScrollRightBtn");

			mHandleBtn = GUISliderHandle::create(mHorizontal, false, "ScrollBarHorzBtn");
		}
		else
		{
			mLayout = GUILayoutY::create();
			_registerChildElement(mLayout);

			mUpBtn = GUIButton::create(HString(L""), "ScrollUpBtn");
			mDownBtn = GUIButton::create(HString(L""), "ScrollDownBtn");

			mHandleBtn = GUISliderHandle::create(mHorizontal, false, "ScrollBarVertBtn");
		}

		mLayout->addNewElement<GUIFixedSpace>(2);
		mLayout->addElement(mUpBtn);
		mLayout->addElement(mHandleBtn);
		mLayout->addElement(mDownBtn);
		mLayout->addNewElement<GUIFixedSpace>(2);

		mHandleBtn->onHandleMoved.connect(std::bind(&GUIScrollBar::handleMoved, this, _1));

		mUpBtn->onClick.connect(std::bind(&GUIScrollBar::upButtonClicked, this));
		mDownBtn->onClick.connect(std::bind(&GUIScrollBar::downButtonClicked, this));
	}
예제 #6
0
	GUITabbedTitleBar::GUITabbedTitleBar(const String& backgroundStyle, const String& tabBtnStyle, 
		const String& maxBtnStyle, const String& closeBtnStyle, const GUIDimensions& dimensions)
		: GUIElementContainer(dimensions), mUniqueTabIdx(0), mActiveTabIdx(0), mBackgroundImage(nullptr), mMaxBtn(nullptr)
		, mCloseBtn(nullptr), mTempDraggedWidget(nullptr), mTempDraggedTabIdx(0), mDragInProgress(false)
		, mDraggedBtn(nullptr), mDragBtnOffset(0), mInitialDragOffset(0), mBackgroundStyle(backgroundStyle)
		, mCloseBtnStyle(closeBtnStyle), mMaximizeBtnStyle(maxBtnStyle), mTabBtnStyle(tabBtnStyle)
	{
		if(mBackgroundStyle == StringUtil::BLANK)
			mBackgroundStyle = "TabBarBackground";

		if(mMaximizeBtnStyle == StringUtil::BLANK)
			mMaximizeBtnStyle = "WinMaximizeBtn";

		if(mCloseBtnStyle == StringUtil::BLANK)
			mCloseBtnStyle = "WinCloseBtn";

		if(mTabBtnStyle == StringUtil::BLANK)
			mTabBtnStyle = "TabbedBarBtn";

		mMaxBtn = GUIButton::create(HString(L""), mMaximizeBtnStyle);
		mMaxBtn->_setElementDepth(1);
		_registerChildElement(mMaxBtn);

		mCloseBtn = GUIButton::create(HString(L""), mCloseBtnStyle);
		mCloseBtn->_setElementDepth(1);
		_registerChildElement(mCloseBtn);

		mBackgroundImage = GUITexture::create(mBackgroundStyle);
		mBackgroundImage->_setElementDepth(mMaxBtn->_getRenderElementDepthRange() + 3);
		_registerChildElement(mBackgroundImage);

		mCloseBtn->onClick.connect(std::bind(&GUITabbedTitleBar::tabClosed, this));
		mMaxBtn->onClick.connect(std::bind(&GUITabbedTitleBar::tabMaximize, this));

		mTabToggleGroup = GUIToggle::createToggleGroup();
	}
예제 #7
0
	void GUIStatusBar::setScene(const WString& name, bool modified)
	{
		WStringStream content;
		content << L"Scene: ";

		if (name.size() > 15)
			content << name.substr(0, 15) << L"...";
		else
			content << name;

		if (modified)
			content << L"*";

		mScene->setContent(HString(content.str()));
	}
예제 #8
0
	void GUIStatusBar::setProject(const WString& name, bool modified)
	{
		WStringStream content;
		content << L"Project: ";

		if (name.size() > 20)
			content << name.substr(0, 20) << L"...";
		else
			content << name;

		if (modified)
			content << L"*";

		mProject->setContent(HString(content.str()));
	}
예제 #9
0
namespace Helios
{

  DEFINE_CASTING(StarSystemSimulation);
  DEF_SIMULATIONTYPE_FACTORY_REG(StarSystemSimulation, HString("starsystemsimulation"));

  //------------------------------------------------------------------------------

  StarSystemSimulation::StarSystemSimulation()
  {

  } 

  //------------------------------------------------------------------------------

  StarSystemSimulation::~StarSystemSimulation() 
  {
  };

  //------------------------------------------------------------------------------

  void StarSystemSimulation::InitClass(Entity *simulationOwner, const  WParamItem &simulationCfg)
  {    
    base::InitClass(simulationOwner, simulationCfg);
  }

  //------------------------------------------------------------------------------

  void StarSystemSimulation::Simulate(Entity *simulationParent, float deltaT) 
  {
    base::Simulate(simulationParent, deltaT);

    CheckNull(simulationParent);
    ObejctState *simulationState = simulationParent->GetSimulationState();
    CheckNull(simulationState);

    Matrix4 translateToPosition;
    translateToPosition.SetIdentityMatrix();
    translateToPosition.SetPosition(GGame->GetCamera()->GetPosition());

    simulationState->_frame = translateToPosition;
  }

  //------------------------------------------------------------------------------

} // Helios namespace
	GUIGameObjectField::GUIGameObjectField(const PrivatelyConstruct& dummy, const String& typeNamespace, const String& type, const GUIContent& labelContent, UINT32 labelWidth,
		const String& style, const GUIDimensions& dimensions, bool withLabel)
		: GUIElementContainer(dimensions, style), mLabel(nullptr), mDropButton(nullptr), mClearButton(nullptr), mType(type)
		, mNamespace(typeNamespace), mInstanceId(0)
	{
		mLayout = GUILayoutX::create();
		_registerChildElement(mLayout);

		if(withLabel)
		{
			mLabel = GUILabel::create(labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), getSubStyleName(BuiltinEditorResources::ObjectFieldLabelStyleName));
			mLayout->addElement(mLabel);
		}

		mDropButton = GUIDropButton::create((UINT32)DragAndDropType::SceneObject, GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(BuiltinEditorResources::ObjectFieldDropBtnStyleName));
		mClearButton = GUIButton::create(HString(L""), getSubStyleName(BuiltinEditorResources::ObjectFieldClearBtnStyleName));
		mClearButton->onClick.connect(std::bind(&GUIGameObjectField::onClearButtonClicked, this));

		mLayout->addElement(mDropButton);
		mLayout->addElement(mClearButton);

		mDropButton->onDataDropped.connect(std::bind(&GUIGameObjectField::dataDropped, this, _1));
		mDropButton->onClick.connect(std::bind(&GUIGameObjectField::onDropButtonClicked, this));
	}
예제 #11
0
	void GUIStatusBar::logModified()
	{
		LogEntry entry;
		if(!gDebug().getLog().getLastEntry(entry))
		{
			GUIContent messageContent(HString(L""));
			mMessage->setContent(messageContent);

			return;
		}

		HSpriteTexture iconTexture;
		Color textColor = COLOR_INFO;

		UINT32 logChannel = entry.getChannel();
		switch (logChannel)
		{
		case (UINT32)DebugChannel::Debug:
			iconTexture = BuiltinEditorResources::instance().getLogMessageIcon(LogMessageIcon::Info, 16, false);
			break;
		case (UINT32)DebugChannel::Warning:
		case (UINT32)DebugChannel::CompilerWarning:
			iconTexture = BuiltinEditorResources::instance().getLogMessageIcon(LogMessageIcon::Warning, 16, false);
			textColor = COLOR_WARNING;
			break;
		case (UINT32)DebugChannel::Error:
		case (UINT32)DebugChannel::CompilerError:
			iconTexture = BuiltinEditorResources::instance().getLogMessageIcon(LogMessageIcon::Error, 16, false);
			textColor = COLOR_ERROR;
			break;
		}

		WString message = toWString(entry.getMessage());
		size_t lfPos = message.find_first_of('\n');
		size_t crPos = message.find_first_of('\r');
		size_t newlinePos;

		if (lfPos != WString::npos)
		{
			if (crPos != WString::npos)
				newlinePos = std::min(lfPos, crPos);
			else
				newlinePos = lfPos;
		}
		else if (crPos != WString::npos)
			newlinePos = crPos;
		else
			newlinePos = -1;

		if (newlinePos == -1)
		{
			GUIContent messageContent(HString(message), iconTexture);
			mMessage->setContent(messageContent);
			mMessage->setTint(textColor);
		}
		else
		{
			WString firstLine = message.substr(0, newlinePos);

			GUIContent messageContent(HString(firstLine), iconTexture);
			mMessage->setContent(messageContent);
			mMessage->setTint(textColor);
		}		
	}
예제 #12
0
	GUIDropButton::GUIDropButton(UINT32 dragType, const String& styleName, const GUIDimensions& dimensions)
		:GUIButtonBase(styleName, GUIContent(HString(L"None")), dimensions), mDragType(dragType)
	{

	}
예제 #13
0
bool DemoHandler::processRequest ()
{
    char Buf [1024];

    // Set Response Line
    m_Response.getRLine () = "HTTP/1.1 200 ok\r\n";

    //Set Some Headeres

    HMap &  MapO = m_Response.getHeaders ();

    MapO [ HString("Content-type")] = HString ("text/html") ;

    MapO [ HString("Date")] = HString ("Wed, 22 Oct 2003 12:00:00 GMT"); 

    // Prepare Body String

    HString & StrBody = m_Response.getPartBody();
    
    StrBody.erase ();

    StrBody.append ( "<HTML><BODY BGCOLOR=\"#ffffff\">\r\n"
                     "<H2> This is demo HHTP Server W_Test."
                     "</H2>"
                     "<H2> I am based on Proactor framework."
                     "</H2>"
                     "<H2> I can print input request data."
                     "</H2>" 
                    );

    StrBody.append ( "<P>=======REQUEST=========<P>" );

    StrBody.append ( m_Request.getRLine() ) ;

    sprintf ( Buf , "<P> Command Enum Value=%d MajVer=%d MinVer=%d" ,
                    m_Request.getRequestCode (),
                    m_Request.getMajorVer (),
                    m_Request.getMinorVer ()
                    );
    StrBody.append ( Buf );

    StrBody.append ( "<P> URI=" );
    StrBody.append ( m_Request.getURI () );

    StrBody.append ( "<P>=======HEADERS=========<P>" );

    HMapItr Itr1 ( m_Request.getHeaders() );
    HMapItr Itr2 ( m_Request.getHeaders() );
    
    for ( Itr1.begin(), Itr2.end(); Itr1 != Itr2 ; ++Itr1 )
    {
        StrBody.append ( Itr1.key() );
        StrBody.append ( "=");

        StrBody.append ( Itr1.value() );
        StrBody.append ( "<P>" );
    }

    StrBody.append ( "<P>=========BODY=========<P>" );
    
    StrBody.append ( m_Request.getPartBody () );
    StrBody.append ( "<P>" );

    StrBody.append ( "<br> <form action=\"/main.html\" method=post>" 
    "<input type=\"text\" name=\"FirstName\" value=\"\" size=30> First Name"
    "<p>"
    "<input type=\"text\" name=\"LastName\" value=\"\" size=30> Last Name"
    "<p>"
    "<input type=\"submit\" name=\"Submit\" suze=30>"
    "<p>" );


    StrBody.append ( "</BODY></HTML>\r\n" );
    StrBody.append ( "\r\n" );

    //Set More Headeres

    sprintf ( Buf , "%d" , StrBody.size () );
    MapO [ HString("Content-Length")] = HString ( Buf );
    
    return true;
}