Ejemplo n.º 1
0
nuiButton::nuiButton(const nglImage& rImage)
  : nuiSimpleContainer(), mEventSink(this)
{
  if (SetObjectClass(_T("nuiButton")))
  {
    InitAttributes();
  }
  mClicked = false;
  mPressed = false;
  mAutoRepeat = false;
  mRepeatDelay = 0.5;
  mRepeatMinDelay = 0.01;
  mpAutoRepeatTimer = NULL;
  mActivationOffset = DEFAULT_ACTIVATION_OFFSET;
  SetRedrawOnHover(true);
  EnableInteractiveDecoration(true);

  nuiImage* pImage = new nuiImage(rImage);
  AddChild(pImage);
  pImage->SetPosition(nuiCenter);
  
  SetBorders(mDefaultBorders);
  SetWantKeyboardFocus(true);
  SetFocusVisible(true);
  mpTask = NULL;
  
  NUI_ADD_EVENT(ButtonPressed);
  NUI_ADD_EVENT(ButtonDePressed);
  NUI_ADD_EVENT(ButtonDePressedInactive);
  NUI_ADD_EVENT(Activated);
}
Ejemplo n.º 2
0
nuiButton::nuiButton(nuiDecoration* pDeco, bool AlreadyAcquired)
: nuiSimpleContainer(), mEventSink(this)
{
  if (SetObjectClass(_T("nuiButton")))
  {
    InitAttributes();
  }
  mClicked = false;
  mPressed = false;
  mAutoRepeat = false;
  mRepeatDelay = 0.5;
  mRepeatMinDelay = 0.01;
  mpAutoRepeatTimer = NULL;
  mActivationOffset = DEFAULT_ACTIVATION_OFFSET;
  SetRedrawOnHover(true);
  EnableInteractiveDecoration(true);
  
  SetDecoration(pDeco, eDecorationOverdraw, AlreadyAcquired);
  
  SetBorders(mDefaultBorders);
  SetWantKeyboardFocus(true);
  SetFocusVisible(true);
  mpTask = NULL;
  
  NUI_ADD_EVENT(ButtonPressed);
  NUI_ADD_EVENT(ButtonDePressed);
  NUI_ADD_EVENT(ButtonDePressedInactive);
  NUI_ADD_EVENT(Activated);
}
Ejemplo n.º 3
0
nuiSlider::nuiSlider(nuiOrientation orientation, const nuiRange& rRange)
: nuiSimpleContainer(),
mRange(rRange),
mSliderSink(this)
{
  if (SetObjectClass(_T("nuiSlider")))
    InitAttributes();
  
  mOrientation = orientation;
  mClicked = false;
  mThumbClicked = false;
  mDrawBackground = true;
  mAutoAdjustHandle = true;
  mRange.SetPageSize(0);
  mInteractiveValueChanged = false;
  
  mFineSensitivityRatio = mDefaultFineSensitivityRatio;
  mFineSensitivityKey = mDefaultFineSensitivityKey;
  
  mSliderSink.Connect(mRange.Changed, &nuiSlider::DoInvalidate);
  mSliderSink.Connect(mRange.ValueChanged, &nuiSlider::DoInvalidate);
  
  mpHandle = NULL;
  mpBackground = NULL;
  SetHandleOffset(0);
  SetHandlePosMin(0);
  SetHandlePosMax(100);
  
  SetWantKeyboardFocus(true);
  
  NUI_ADD_EVENT(ValueChanged);
  NUI_ADD_EVENT(InteractiveValueChanged);
}
Ejemplo n.º 4
0
nuiMetaDecoration::nuiMetaDecoration(const nglString& rName)
: nuiDecoration(rName)
{
  if (SetObjectClass(_T("nuiMetaDecoration")))
    InitAttributes();

}
Ejemplo n.º 5
0
void nuiSprite::Init()
{
  CheckValid();
  if (SetObjectClass(_T("nuiSprite")))
  {
    InitAttributes();
  }
  
  // static counter
  mSpriteCounter++;
  
  mpParent = NULL;
  mpMatrixNodes = NULL;
  mCurrentAnimation = 0;
  mCurrentFrame = 0;
  mSpeed = 1.0f;
  mScale = 1.0f;
  mScaleX = 1.0f;
  mScaleY = 1.0f;
  
  // Init Matrixes:
  mpScale = new nuiMatrixNode_Scale();
  mpPosition = new nuiMatrixNode_Translation();
  mpPivot = new nuiMatrixNode_Pivot();
  AddMatrixNode(mpPosition);
  AddMatrixNode(mpPivot);
  AddMatrixNode(mpScale);
}
Ejemplo n.º 6
0
FrameEditor::FrameEditor(ElementDesc* pDesc, ElementInspector* pInspector)
: mEventSink(this)
{
	InitAttributes();
	
  mpFrame = NULL;
  mpDesc = pDesc;
	mpInspector = pInspector;
  mpFrameView = NULL;

  
  mEventSink.Connect(mpDesc->CommitChanges, &FrameEditor::OnCommitChanges);

  nuiVBox* pBox = new nuiVBox();
  pBox->SetExpand(nuiExpandShrinkAndGrow);
  AddChild(pBox);
  pBox->AddCell(new nuiSeparator(nuiHorizontal));
  
  nglString str;
  str.Add(_T("nuiFrame editor (")).Add(pDesc->GetName()).Add(_T(")"));
  nuiLabel* pLabel = new nuiLabel(str, nuiFont::GetFont(24));
  pLabel->SetTextColor(nuiColor(_T("lightgray")));
  pBox->AddCell(pLabel, nuiCenter);
  pBox->AddCell(new nuiSeparator(nuiHorizontal));
  
  nuiSplitter* pSplitter = new nuiSplitter(nuiHorizontal, eModePixel);
  pSplitter->SetMasterChild(false);

  pBox->AddCell(pSplitter);
  pBox->SetCellExpand(pBox->GetNbCells()-1, nuiExpandShrinkAndGrow);

  pSplitter->SetHandlePos(200);

  // Frame view:
  mpPictureHolder = new nuiSimpleContainer();
  nuiScrollView* pScrollView = new nuiScrollView();
  pScrollView->AddChild(mpPictureHolder);
  pSplitter->AddChild(pScrollView);
  
  mpFrameViewHolder = new nuiScrollView();
  pSplitter->AddChild(mpFrameViewHolder);
  
  const nuiXMLNode* pNode = mpDesc->GetXML();
  if (pNode)
  {
    mpFrame = new nuiFrame(pDesc->GetName());
    if (mpFrame->Load(pNode))
    {
      UpdateFrameViews(false);
    } 
  }

  if (!mpFrame)
  {
    mpFrameViewHolder->AddChild(new nuiLabel(_T("Drop an image file here...")));
  }
  
  mDrawDndFrame = false;
}
Ejemplo n.º 7
0
nuiKnob::nuiKnob(const nuiRange& rRange)
  : nuiSimpleContainer(),
    mKnobSink(this)
{
  if (SetObjectClass(_T("nuiKnob")))
    InitAttributes();
  Init(rRange);
}
Ejemplo n.º 8
0
nuiHyperLink::nuiHyperLink(const nglString& rURL, const nglString& rLabel)
  : nuiLabel(rLabel.IsNull() ? rURL : rLabel),
    mURL(rURL)
{
  if (SetObjectClass(_T("nuiHyperLink")))
    InitAttributes();
    
  SetTextColor(nuiColor(_T("nuiHyperLink")));
}
Ejemplo n.º 9
0
nuiHyperLink::nuiHyperLink()
: nuiLabel(_T("")),
mURL(_T(""))
{
  if (SetObjectClass(_T("nuiHyperLink")))
    InitAttributes();

  SetTextColor(nuiColor(_T("nuiHyperLink")));
}
Ejemplo n.º 10
0
//*********************************************************************************
//
// TITLLthread
//
//*********************************************************************************
TITLLthread::TITLLthread(const nglString& rName)
  : TITthread(rName)
{
  mLockedA = false;
  mLockedB = false;
  mLockedC = false;

  if (SetObjectClass(_T("TITLLThread")))
    InitAttributes();
}
Ejemplo n.º 11
0
BOOL VectorFileRenderRegion::StartRender()
{
	// Call base class first.
	if (!RenderRegion::StartRender())
		return FALSE;

	InitAttributes();

	return TRUE;
}
Ejemplo n.º 12
0
nuiFrame::nuiFrame(const nglString& rName)
: nuiDecoration(rName),
  mpTexture(NULL)
{
  if (SetObjectClass(_T("nuiFrame")))
    InitAttributes();
  mColor = nuiColor(255,255,255);
  mUseWidgetFrameColor = false;
  mDebug = false;
  mInterpolated = true;
}
Ejemplo n.º 13
0
nuiImageDecoration::nuiImageDecoration(const nglString& rName)
: nuiDecoration(rName),
  mpTexture(NULL),
  mPosition(nuiCenter),
  mColor(255,255,255,255),
  mRepeatX(false),
  mRepeatY(false)
{
  if (SetObjectClass(_T("nuiImageDecoration")))
    InitAttributes();
}
Ejemplo n.º 14
0
nuiImageDecoration::nuiImageDecoration(const nglString& rName, nuiTexture* pTexture, const nuiRect& rClientRect, nuiPosition position, const nuiColor& rColor)
: nuiDecoration(rName),
  mpTexture(pTexture),
  mPosition(position),
  mClientRect(rClientRect),
  mColor(rColor),
  mRepeatX(false),
  mRepeatY(false)
{
  if (SetObjectClass(_T("nuiImageDecoration")))
    InitAttributes();
}
Ejemplo n.º 15
0
MainWindow::MainWindow(const nglContextInfo& rContextInfo, const nglWindowInfo& rInfo )
  : nuiMainWindow(rContextInfo, rInfo, NULL, nglPath((_T("../data")))),
	mWinSink(this)
{

  //nuiTopLevel::EnablePartialRedraw(false);
  SetDebugMode(true);

	InitAttributes();	
  
  LoadCSS(_T("rsrc:/css/yapuka.css"));
}
Ejemplo n.º 16
0
nuiColorDecoration::nuiColorDecoration(const nglString& rName, const nuiColor& rFillColor, float strokeSize, const nuiColor& rStrokeColor, nuiShapeMode ShapeMode, nuiBlendFunc BlendFunc, const nuiRect& rClientRect)
: nuiDecoration(rName)
{
  if (SetObjectClass(_T("nuiColorDecoration")))
    InitAttributes();

  mStrokeSize = strokeSize;
  mFillColor = rFillColor;
  mStrokeColor = rStrokeColor;
  mShapeMode = ShapeMode;
  mBlendFunc = BlendFunc;
  mClientRect = rClientRect;
}
Ejemplo n.º 17
0
nuiColorDecoration::nuiColorDecoration(const nglString& rName)
: nuiDecoration(rName)
{
  if (SetObjectClass(_T("nuiColorDecoration")))
    InitAttributes();

  mStrokeSize = 0;
  mFillColor = nuiColor(0,0,0);
  mStrokeColor = nuiColor(0,0,0);
  mShapeMode = eFillShape;
  mBlendFunc = nuiBlendTransp;
  mClientRect = nuiRect(0,0,0,0);
}
Ejemplo n.º 18
0
nuiLabel::nuiLabel(const nglString& Text, const nglString& rObjectName, nuiTheme::FontStyle FontStyle)
: nuiWidget(rObjectName), mLabelSink(this)
{
  InitDefaultValues();
  
  if (SetObjectClass(_T("nuiLabel")))
    InitAttributes();
  
  InitProperties();
  
  SetFont(FontStyle);
  SetText(Text);
}
Ejemplo n.º 19
0
nuiStateDecoration::nuiStateDecoration(const nglString& rName, const nglString& rUp, const nglString& rDown, const nglString& rUpHoverOn,  const nglString& rDownHoverOn, const nglString& rDisabled, const nglString& rDisabledSelected)
  : nuiDecoration(rName), mClientRect(0,0,0,0), mUseSourceClientRect(false)
{
  if (SetObjectClass(_T("nuiStateDecoration")))
    InitAttributes();

  SetState(nuiStateEnabled  | nuiStateReleased | nuiStateHoverOff, GetDecoration(rUp));
  SetState(nuiStateEnabled  | nuiStateReleased | nuiStateHoverOn,  GetDecoration(rUpHoverOn));  
  SetState(nuiStateEnabled  | nuiStatePressed | nuiStateHoverOff,  GetDecoration(rDown));
  SetState(nuiStateEnabled  | nuiStatePressed | nuiStateHoverOn,  GetDecoration(rDownHoverOn));
  SetState(nuiStateDisabled | nuiStateReleased, GetDecoration(rDisabled));
  SetState(nuiStateDisabled | nuiStateSelected, GetDecoration(rDisabledSelected));
  SetState(nuiStateDisabled | nuiStatePressed, GetDecoration(rDisabledSelected));
} 
Ejemplo n.º 20
0
nuiFrame::nuiFrame(const nglString& rName, nuiTexture* pTexture, const nuiRect& rClientRect, const nuiColor& rColor)
: nuiDecoration(rName),
  mpTexture(pTexture),
  mColor(rColor),
  mUseWidgetFrameColor(false),
  mClientRect(rClientRect)
{
  if (SetObjectClass(_T("nuiFrame")))
    InitAttributes();
  mDebug = false;
  mInterpolated = true;
  if (mpTexture)
    mTexturePath = mpTexture->GetSource();
}
Ejemplo n.º 21
0
nuiLabel::nuiLabel(const nglString& Text, nuiFont* pFont, bool AlreadyAcquired)
  : nuiWidget(),
    mLabelSink(this)
{
  InitDefaultValues();

  if (SetObjectClass(_T("nuiLabel")))
    InitAttributes();

  InitProperties();

  SetText(Text);
  SetFont(pFont, AlreadyAcquired);
}
Ejemplo n.º 22
0
nuiFrame::nuiFrame(const nglString& rName, const nglPath& rTexturePath, const nuiRect& rClientRect, const nuiColor& rColor)
: nuiDecoration(rName),
  mpTexture(NULL),
  mColor(rColor),
  mUseWidgetFrameColor(false),
  mClientRect(rClientRect)
{
  if (SetObjectClass(_T("nuiFrame")))
    InitAttributes();
	
  SetTexturePath(rTexturePath.GetPathName());
  mDebug = false;
  mInterpolated = true;
}
Ejemplo n.º 23
0
nuiImageDecoration::nuiImageDecoration(const nglString& rName, const nglPath& rTexturePath, const nuiRect& rClientRect, nuiPosition position, const nuiColor& rColor)
: nuiDecoration(rName),
  mpTexture(NULL),
  mPosition(position),
  mClientRect(rClientRect),
  mColor(rColor),
  mRepeatX(false),
  mRepeatY(false)
{
  if (SetObjectClass(_T("nuiImageDecoration")))
    InitAttributes();
	
  mpTexture = nuiTexture::GetTexture(rTexturePath);
  if (mpTexture)
    SetProperty(_T("Texture"), rTexturePath.GetPathName());
}
Ejemplo n.º 24
0
nuiGradientDecoration::nuiGradientDecoration(const nglString& rName)
: nuiDecoration(rName),
  mColor1(128, 128, 128),
  mColor2(0, 0, 0),
  mClientRect(0, 0, 0, 0),
  mStrokeSize(1),
  mStrokeColor(64, 64, 64),
  mShapeMode(eFillShape),
  mOrientation(nuiVertical)
{
  if (SetObjectClass(_T("nuiGradientDecoration")))
    InitAttributes();
  mGradientType = nuiGradient2Colors;
  mUserOffsets = false;
  InitOffsets();
}
Ejemplo n.º 25
0
nuiDecoration::nuiDecoration(const nglString& rName)
{
    if (SetObjectClass(_T("nuiDecoration")))
        InitAttributes();

    SetObjectName(rName);

    mUseWidgetAlpha = true;
    mBorderEnabled = true;
    mRedrawOnHover = false;


    mLayer = eLayerBack;

    AddDecoration(this);
}
Ejemplo n.º 26
0
void nuiFileTree::Init(const nglPath& rPath, const nglPath& rRootPath, const std::list<nglString>& rFilters, bool showHiddenFiles)
{
  if (SetObjectClass(_T("nuiFileTree")))
    InitAttributes();
  SetObjectName(_T("nuiFileTree"));
  
  mpFileBox = NULL;
  mpTreeView = NULL;
  
  mShowHiddenFiles = showHiddenFiles;
  mFilters = rFilters;
  mpCurrentTree = NULL;
  
  SetRootPath(rRootPath);
  SetPath(rPath);  
}
Ejemplo n.º 27
0
nuiGradientDecoration::nuiGradientDecoration(const nglString& rName, const nuiColor& rColor1, const nuiColor& rColor2, uint strokeSize, const nuiColor& rStrokeColor, nuiShapeMode shapeMode, nuiOrientation orientation, const nuiRect& rClientRect)
: nuiDecoration(rName),
  mColor1(rColor1),
  mColor2(rColor2),
  mStrokeSize(strokeSize),
  mStrokeColor(rStrokeColor),
  mShapeMode(shapeMode),
  mOrientation(orientation)
{
  if (SetObjectClass(_T("nuiGradientDecoration")))
    InitAttributes();

  mClientRect = rClientRect;
  mGradientType = nuiGradient2Colors;
  mUserOffsets = false;
  InitOffsets();
}
Ejemplo n.º 28
0
nuiHugeImage::nuiHugeImage(const nglPath& rImagePath)
{
  if (SetObjectClass(_T("nuiHugeImage")))
  {
    InitAttributes();
  }

  
  mClicked = false;
  mZoom = 1.0f;
  mMinZoom = 0.2f;
  mMaxZoom = 1.0f;
  mX = 0.0f;
  mY = 0.0f;

  mpZoom = new nuiAttributeAnimation();
  mpZoom->SetTargetObject(this);
  mpZoom->SetTargetAttribute(_T("Zoom"));
  mpZoom->SetCaptureStartOnPlay(true);
  mpZoom->SetEndValue(mMaxZoom);
  mpZoom->SetEasing(nuiEasingSinus);
  mpZoom->SetDuration(1.0f);
  AddAnimation(_T("Zoom"), mpZoom);
  
  mpPanX = new nuiAttributeAnimation();
  mpPanX->SetTargetObject(this);
  mpPanX->SetTargetAttribute(_T("CenterX"));
  mpPanX->SetCaptureStartOnPlay(true);
  mpPanX->SetEndValue(0);
  mpPanX->SetEasing(nuiEasingSinus);
  mpPanX->SetDuration(1.0f);
  AddAnimation(_T("PanX"), mpPanX);

  mpPanY = new nuiAttributeAnimation();
  mpPanY->SetTargetObject(this);
  mpPanY->SetTargetAttribute(_T("CenterY"));
  mpPanY->SetCaptureStartOnPlay(true);
  mpPanY->SetEndValue(0);
  mpPanY->SetEasing(nuiEasingSinus);
  mpPanY->SetDuration(1.0f);
  AddAnimation(_T("PanY"), mpPanY);
  
  InitImage();
  Load(rImagePath);
  //StartAnimation(_T("Zoom"));
}
Ejemplo n.º 29
0
nuiBorderDecoration::nuiBorderDecoration(const nglString& rName)
: nuiDecoration(rName)
{
  if (SetObjectClass(_T("nuiBorderDecoration")))
    InitAttributes();

  mStrokeSize = 0;
  mStrokeColor = nuiColor(0,0,0);
  mBorderType = eBorderAll;
  mBorderMode = eBorderNormal;
  mBlendFunc = nuiBlendTransp;
  mClientRect = nuiRect(0,0,0,0);
  
  mUseStrokeGlobalColor = true;
  mUseStrokeLeftColor  = false;
  mUseStrokeRightColor  = false;
  mUseStrokeTopColor  = false;
  mUseStrokeBottomColor  = false;
}
Ejemplo n.º 30
0
int main(int argc, char** argv)
{
	//int result;
	OS_Init();
	LoggerCreate(TRUE,"log.txt",LOGGER_APPEND,LOGGER_LEVEL_ALL,LOGGER_FORMAT_C);
	LoggerInfo("Initializing game");
	if(SDL_Init(SDL_INIT_EVERYTHING))
		GameCrash("Initialized SDL failed");
	LoggerInfo("SDL initialized");
	MathInit();
	RM_InitResourceManager();
	PMD_Init();
	RE_InitWindow(WINDOW_WIDTH,WINDOW_HEIGHT);
	IN_InitInput();	
	InitEntities();
	InitAttributes();
	GameMainLoop();
	GameClose();
	return 0;
}