Beispiel #1
0
  //
  // Process a StandardCursors scope
  //
  void ProcessStandardCursors(FScope *fScope)
  {
    FScope *sScope;

    while ((sScope = fScope->NextFunction()) != NULL)
    {
      switch (sScope->NameCrc())
      {
        case 0x8F651465: // "Default"
          standardCrs[DEFAULT] = FindByName(sScope->NextArgString());
          break;

        case 0x23C19271: // "IBeam"
          standardCrs[IBEAM] = FindByName(sScope->NextArgString());
          break;

        case 0x6E758990: // "Wait"
          standardCrs[WAIT] = FindByName(sScope->NextArgString());
          break;

        case 0x65D94636: // "No"
          standardCrs[NO] = FindByName(sScope->NextArgString());
          break;

        default:
        {
          LOG_ERR(("Unknown standard cursor type [%s]", sScope->NameStr()));
          break;
        }
      }
    }
  }
void ResourcePackerScreen::LoadResources()
{
	inputGfxDirectory = FileSystem::RealPath("/Sources/dava.framework/Tools/ResourceEditor/DataSource/Gfx/");
    Logger::Debug("%s", inputGfxDirectory.c_str());
	outputGfxDirectory = FileSystem::RealPath(inputGfxDirectory + "/../../Data/Gfx");
	excludeDirectory = FileSystem::RealPath(inputGfxDirectory + "/../");
	
	// PackResources();
	
	UIYamlLoader::Load(this, "~res:/Screens/ResourcePackerScreen.yaml");
	
	resourceTree = SafeRetain(dynamic_cast<UIFileTree*>(FindByName("resourceTree")));
	resourceTree->SetDelegate(this);
	resourceTree->SetFolderNavigation(true);
	resourceTree->SetPath(outputGfxDirectory, ".txt");
	
	// Resource Tree Setup
//	resourceTree = new UIFileTree(Rect(0, 0, 200, 600));
//	resourceTree->SetPath(outputGfxDirectory, ".txt");
//	AddControl(resourceTree);
//	resourceTree->SetDelegate(this);

	//resourceTree->GetBackground()->SetDrawType(UIControlBackground::DRAW_FILL);
	//resourceTree->GetBackground()->SetColor(Color(0.3, 0.3, 0.3, 1.0f));
	
	// SpriteEditor setup
	spriteEditor = SafeRetain(dynamic_cast<UISpriteEditor*> (FindByName("spriteEditor")));
//	spriteEditor = new UISpriteEditor(Rect(220, 0, GetScreenWidth() - 230, 500));
//	spriteEditor->GetBackground()->SetDrawType(UIControlBackground::DRAW_FILL);
//	spriteEditor->GetBackground()->SetColor(Color(0.5, 0.5, 0.5, 1.0f));
//	spriteEditor->
}
Beispiel #3
0
void UISlider::LoadFromYamlNodeCompleted()
{
    AttachToSubcontrols();
    if (!spritesEmbedded)
    {
        // Old Yaml format is used - have to take their data and remove subcontrols.
        UIControl* minBgControl = FindByName(UISLIDER_MIN_SPRITE_CONTROL_NAME, false);
        CopyBackgroundAndRemoveControl(minBgControl, minBackground);

        UIControl* maxBgControl = FindByName(UISLIDER_MAX_SPRITE_CONTROL_NAME, false);
        CopyBackgroundAndRemoveControl(maxBgControl, maxBackground);
    }

    SyncThumbWithSprite();
}
Beispiel #4
0
void LoadingState::Enter(){
	m_viewport = FindByName("PlayState")->GetViewport();
	m_game_object_manager = new GameObjectManager;
	m_game_object_manager->Init(m_physics_engine, m_scene_manager, m_input_manager, m_viewport, m_sound_manager, m_message_system, NULL);

	OverlayDef menuBackground;
	
	if (m_level == "try") { 
		menuBackground.overlay_name = "LoadingDay";
		menuBackground.cont_name = "Loading/Background2"; 
	}
	else if (m_level == "Dayarea") { 
		menuBackground.overlay_name = "LoadingNight";
		menuBackground.cont_name = "Loading/Background3"; 
	}
	else if (m_level == "NightArea") { //so this is like the "end graphics"
		menuBackground.overlay_name = "LoadingNight";
		menuBackground.cont_name = "Loading/Background3"; 
	}
	else{
		menuBackground.overlay_name = "LoadingFirst";
		menuBackground.cont_name = "Loading/Background1"; 
	}
	m_game_object_manager->CreateGameObject(GAME_OBJECT_OVERLAY, Ogre::Vector3(0,0,0), &menuBackground);
}
Beispiel #5
0
bool eFileTypeZIP::Contain(const char* name, char* contain_path, char* contain_name) const
{
	char n[xIo::MAX_PATH_LEN];
	strcpy(n, name);
	int l = strlen(n);
	for(int i = 0; i < l; ++i)
	{
		if(n[i] == '/' || n[i] == '\\')
		{
			char c = n[i];
			n[i] = 0;
			const eFileType* t = FindByName(n);
			if(t == this) // zip
			{
				FILE* f = fopen(n, "rb");
				if(f)
				{
					fclose(f);
					strcpy(contain_path, n);
					strcpy(contain_name, n + i + 1);
					return true;
				}
			}
			n[i] = c;
		}
	}
	return false;
}
size_t
DWARFMappedHash::MemoryTable::FindCompleteObjCClassByName (const char *name,
                                                           DIEArray &die_offsets,
                                                           bool must_be_implementation)
{
    DIEInfoArray die_info_array;
    if (FindByName(name, die_info_array))
    {
        if (must_be_implementation && GetHeader().header_data.ContainsAtom (eAtomTypeTypeFlags))
        {
            // If we have two atoms, then we have the DIE offset and
            // the type flags so we can find the objective C class
            // efficiently.
            DWARFMappedHash::ExtractTypesFromDIEArray (die_info_array, 
                                                       UINT32_MAX,
                                                       eTypeFlagClassIsImplementation,
                                                       die_offsets);
        }
        else
        {
            // We don't only want the one true definition, so try and see
            // what we can find, and only return class or struct DIEs.
            // If we do have the full implementation, then return it alone,
            // else return all possible matches.
            const bool return_implementation_only_if_available = true;
            DWARFMappedHash::ExtractClassOrStructDIEArray (die_info_array, 
                                                           return_implementation_only_if_available,
                                                           die_offsets);
        }
    }
    return die_offsets.size();
}
Beispiel #7
0
void MergeRules(FcitxXkbRules* rules, FcitxXkbRules* rulesextra)
{
    utarray_concat(rules->modelInfos, rulesextra->modelInfos);
    utarray_concat(rules->optionGroupInfos, rulesextra->optionGroupInfos);

    FcitxXkbLayoutInfo* layoutInfo;
    UT_array toAdd;
    utarray_init(&toAdd, fcitx_ptr_icd);
    for (layoutInfo = (FcitxXkbLayoutInfo*) utarray_front(rulesextra->layoutInfos);
         layoutInfo != NULL;
         layoutInfo = (FcitxXkbLayoutInfo*) utarray_next(rulesextra->layoutInfos, layoutInfo))
    {
        FcitxXkbLayoutInfo* l = FindByName(rules, layoutInfo->name);
        if (l) {
            utarray_concat(l->languages, layoutInfo->languages);
            utarray_concat(l->variantInfos, layoutInfo->variantInfos);
        }
        else
            utarray_push_back(&toAdd, &layoutInfo);
    }

    unsigned int i;
    for(i = 0;i < utarray_len(&toAdd);i++) {
        FcitxXkbLayoutInfo* p = *(FcitxXkbLayoutInfo**)utarray_eltptr(&toAdd, i);
        utarray_push_back(rules->layoutInfos, p);
    }

    utarray_done(&toAdd);
    FcitxXkbRulesFree(rulesextra);
}
size_t
DWARFMappedHash::MemoryTable::FindByName (const char *name, DIEArray &die_offsets)
{
    DIEInfoArray die_info_array;
    if (FindByName(name, die_info_array))
        DWARFMappedHash::ExtractDIEArray (die_info_array, die_offsets);
    return die_info_array.size();
}
Beispiel #9
0
void MenuState::ChangeStateToPlayState()
{
	m_parent->ShowLoadingScreen("LoadingFirst");
	m_parent->PauseUpdate(true);
	std::function<void()> func = [this] { m_parent->PauseUpdate(false); ChangeState(FindByName("PlayState")); };
	m_fade->SetFadeInCallBack(func);
	m_fade->FadeIn(VariableManager::GetSingletonPtr()->GetAsFloat("Fade_in_timer"));
}
List<UIControl* >& UIScrollBar::GetRealChildren()
{
	List<UIControl* >& realChildren = UIControl::GetRealChildren();
	
	realChildren.remove(FindByName(UISCROLLBAR_SLIDER_NAME));

	return realChildren;
}
void UIScrollBar::LoadFromYamlNodeCompleted()
{
	slider = SafeRetain(FindByName(UISCROLLBAR_SLIDER_NAME));
	if (!slider)
	{
		InitControls();
	}
}
Beispiel #12
0
void
AllLinuxInputDevices::Remove(const char *name)
{
  if (!CheckName(name))
    return;

  auto i = FindByName(name);
  if (i != devices.end())
    devices.erase(i);
}
Beispiel #13
0
PHPSetterGetterEntry::Vec_t PHPRefactoring::GetGetters(IEditor* editor) const
{
    PHPSetterGetterEntry::Vec_t getters, candidates;
    if(!editor) {
        return getters;
    }

    // Parse until the current position
    wxString text = editor->GetTextRange(0, editor->GetCurrentPosition());
    PHPSourceFile sourceFile(text);
    sourceFile.SetParseFunctionBody(true);
    sourceFile.SetFilename(editor->GetFileName());
    sourceFile.Parse();

    const PHPEntityClass* scopeAtPoint = sourceFile.Class()->Cast<PHPEntityClass>();
    if(!scopeAtPoint) {
        return getters;
    }

    // filter out
    const PHPEntityBase::List_t& children = scopeAtPoint->GetChildren();
    PHPEntityBase::List_t::const_iterator iter = children.begin();

    PHPEntityBase::List_t members, functions;
    for(; iter != children.end(); ++iter) {
        PHPEntityBase::Ptr_t child = *iter;
        if(child->Is(kEntityTypeFunction)) {
            functions.push_back(child);
        } else if(child->Is(kEntityTypeVariable) && child->Cast<PHPEntityVariable>()->IsMember() &&
                  !child->Cast<PHPEntityVariable>()->IsConst() && !child->Cast<PHPEntityVariable>()->IsStatic()) {
            // a member of a class
            members.push_back(child);
        }
    }

    if(members.empty()) {
        return getters;
    }

    // Prepare list of candidates
    PHPEntityBase::List_t::iterator membersIter = members.begin();
    for(; membersIter != members.end(); ++membersIter) {
        PHPSetterGetterEntry candidate(*membersIter);

        // make sure we don't add setters that already exist
        if(FindByName(functions, candidate.GetGetter(kSG_NameOnly))) {
            continue;
        }
        candidates.push_back(candidate);
    }

    getters.swap(candidates);
    return getters;
}
size_t
DWARFMappedHash::MemoryTable::FindByNameAndTagAndQualifiedNameHash (const char *name,
                                                                    const dw_tag_t tag,
                                                                    const uint32_t qualified_name_hash,
                                                                    DIEArray &die_offsets)
{
    DIEInfoArray die_info_array;
    if (FindByName(name, die_info_array))
        DWARFMappedHash::ExtractDIEArray (die_info_array, tag, qualified_name_hash, die_offsets);
    return die_info_array.size();
}
Beispiel #15
0
void UISlider::AttachToSubcontrols()
{
    if (!thumbButton)
    {
        thumbButton = FindByName(UISLIDER_THUMB_SPRITE_CONTROL_NAME);
        DVASSERT(thumbButton);
        thumbButton->Retain();
    }

    InitInactiveParts(thumbButton->GetBackground()->GetSprite());
}
Beispiel #16
0
afs_int32
NameToID(struct ubik_trans *at, char aname[PR_MAXNAMELEN], afs_int32 *aid)
{
    afs_int32 temp;
    struct prentry tentry;

    temp = FindByName(at, aname, &tentry);
    if (!temp)
	return PRNOENT;
    *aid = tentry.id;
    return PRSUCCESS;
}
Beispiel #17
0
ERet FxUtil_SetStateBlock(const HContext _context,
						  const FxLibrary& effect,
						  const char* stateBlock)
{
	const FxStateBlock* pStateBlock = FindByName( effect.m_stateBlocks, stateBlock );
	if( pStateBlock ) {
		llgl::SetRasterizerState( _context, pStateBlock->rasterizerState );
		llgl::SetDepthStencilState( _context, pStateBlock->depthStencilState, pStateBlock->stencilRef );
		llgl::SetBlendState( _context, pStateBlock->blendState, pStateBlock->blendFactor.ToPtr(), pStateBlock->sampleMask );
		return ALL_OK;
	}
	return ERR_OBJECT_NOT_FOUND;
}
Beispiel #18
0
ERet rxMaterial::Slow_SetUniform( const char* name, const void* data )
{
	FxShader* shader = m_shader;
	mxASSERT(shader->localCBs.Num()==1);
	const FxCBuffer& rCB = shader->localCBs[0];
	const FxUniform* pUniform = FindByName( rCB.uniforms, name );
	if( !pUniform ) {
		return ERR_OBJECT_NOT_FOUND;
	}
	void* pDestination = m_uniforms.ToPtr();
	pDestination = mxAddByteOffset( pDestination, pUniform->offset );
	memcpy( pDestination, data, pUniform->size );
	return ALL_OK;
}
Beispiel #19
0
const wxExLexer wxExLexers::FindByText(const wxString& text) const
{
  // Add automatic lexers if text starts with some special tokens.
  const wxString text_lowercase = text.Lower();

  if (text_lowercase.StartsWith("<html>"))
  {
    return FindByName("hypertext");
  }
  else if (text_lowercase.StartsWith("<?xml"))
  {
    return FindByName("xml");
  }
  // cpp files like #include <map> really do not have a .h extension 
  // (e.g. /usr/include/c++/3.3.5/map) so add here.
  else if (text_lowercase.StartsWith("//"))
  {
    return FindByName("cpp");
  }
  else if (text_lowercase.StartsWith("<?php"))
  {
    return FindByName("phpscript");
  }
  else
  {
    // If there is a Shell Language Indicator,
    // match with bash.
    const wxRegEx re("#!.*/bin/.*");
    
    if (re.Matches(text_lowercase))
    {
      return FindByName("bash");
    }
  }

  return wxExLexer();
}
Beispiel #20
0
void ZSList::SendEmoteMessageRaw(const char* to, uint32 to_guilddbid, int16 to_minstatus, uint32 type, const char* message) {
	if (!message)
		return;
	ServerPacket* pack = new ServerPacket;

	pack->opcode = ServerOP_EmoteMessage;
	pack->size = sizeof(ServerEmoteMessage_Struct)+strlen(message)+1;
	pack->pBuffer = new uchar[pack->size];
	memset(pack->pBuffer, 0, pack->size);
	ServerEmoteMessage_Struct* sem = (ServerEmoteMessage_Struct*) pack->pBuffer;

	if (to) {
		if (to[0] == '*') {
			Console* con = console_list.FindByAccountName(&to[1]);
			if (con)
				con->SendEmoteMessageRaw(to, to_guilddbid, to_minstatus, type, message);
			delete pack;
			return;
		}
		strcpy((char *) sem->to, to);
	}
	else {
		sem->to[0] = 0;
	}

	sem->guilddbid = to_guilddbid;
	sem->minstatus = to_minstatus;
	sem->type = type;
	strcpy(&sem->message[0], message);
	char tempto[64]={0};
	if(to)
		strn0cpy(tempto,to,64);
	pack->Deflate();
	if (tempto[0] == 0) {
		SendPacket(pack);
		if (to_guilddbid == 0)
			console_list.SendEmoteMessageRaw(type, message);
	}
	else {
		ZoneServer* zs = FindByName(to);

		if (zs != 0)
			zs->SendPacket(pack);
		else
			SendPacket(pack);
	}
	delete pack;
}
Beispiel #21
0
    void MetaConfig::LoadFrom(const MetaConfigLoader &loader)
    {
        ESS_ASSERT(m_completed);

        for(int i = 0; i < loader.getCount(); ++i)
        {
            QString name = loader.NameAt(i);
            IConfigField *pF = FindByName(name, m_namesIgnoreCase);
            if (pF == 0) 
			{
				ESS_THROW_MSG(UnknownFieldName, name.toStdString());
				return;  // dummi 				
			}

            pF->set(loader.ValueAt(i));
        }
    }
Beispiel #22
0
void
AllLinuxInputDevices::Add(const char *name)
{
  if (!CheckName(name))
    return;

#ifdef HAVE_INOTIFY
  auto i = FindByName(name);
  if (i != devices.end())
    /* already have that one */
    return;
#endif

  StaticString<64> path;
  path.Format("/dev/input/%s", name);

  devices.emplace_back(name, io_loop, queue, merge);
  if (!devices.back().device.Open(path))
    devices.pop_back();
}
Beispiel #23
0
bool wxExLexers::ShowDialog(
  wxWindow* parent,
  wxString& lexer,
  const wxString& caption,
  bool show_modal) const
{
  wxArrayString s;

  for (
    auto it = m_Lexers.begin();
    it != m_Lexers.end();
    ++it)
  {
    s.Add(it->first);
  } 

  s.Add(wxEmptyString);

  wxSingleChoiceDialog dlg(
    parent, 
    _("Input") + ":", 
    caption, 
    s);

  const int index = s.Index(lexer);
  
  if (index != wxNOT_FOUND)
  {
    dlg.SetSelection(index);
  }

  if (show_modal && dlg.ShowModal() == wxID_CANCEL)
  {
    return false;
  }

  lexer = FindByName(dlg.GetStringSelection()).GetDisplayLexer();

  return true;
}
Beispiel #24
0
ERet FxSlow_SetUniform( FxShader* shader, const char* name, const void* data )
{
	mxASSERT_PTR(shader);
	mxASSERT_PTR(name);
	mxASSERT_PTR(data);
	for( int iCB = 0; iCB < shader->localCBs.Num(); iCB++ )
	{
		FxCBuffer& cbuffer = shader->localCBs[ iCB ];
		const FxUniform* pUniform = FindByName( cbuffer.uniforms, name );
		if( !pUniform ) {
			return ERR_OBJECT_NOT_FOUND;
		}
		FxBackingStore& backingStore = cbuffer.backingStore;
		if( !backingStore.data.Num() ) {
			return ERR_INVALID_FUNCTION_CALL;
		}
		void* pDestination = backingStore.data.ToPtr();
		pDestination = mxAddByteOffset( pDestination, pUniform->offset );
		memcpy( pDestination, data, pUniform->size );
		backingStore.dirty = true;
	}
	return ALL_OK;
}
Beispiel #25
0
void ZSList::SOPZoneBootup(const char* adminname, uint32 ZoneServerID, const char* zonename, bool iMakeStatic) {
	ZoneServer* zs = 0;
	ZoneServer* zs2 = 0;
	uint32 zoneid;
	if (!(zoneid = database.GetZoneID(zonename)))
		SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zone '%s' not found in 'zone' table. Typo protection=ON.", zonename);
	else {
		if (ZoneServerID != 0)
			zs = FindByID(ZoneServerID);
		else
			SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: ServerID must be specified");

		if (zs == 0)
			SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zoneserver not found");
		else {
			zs2 = FindByName(zonename);
			if (zs2 != 0)
				SendEmoteMessage(adminname, 0, 0, 0, "Error: SOP_ZoneBootup: zone '%s' already being hosted by ZoneServer #%i", zonename, zs2->GetID());
			else {
				zs->TriggerBootup(zoneid, 0, adminname, iMakeStatic);
			}
		}
	}
}
Beispiel #26
0
void UIScrollViewTest::LoadResources()
{
	Font *font = FTFont::Create("~res:/Fonts/korinna.ttf");
    DVASSERT(font);
	font->SetSize(14);
    font->SetColor(Color::White());

    UIYamlLoader::Load( this, "~res:/UI/Test/ScrollScreen.yaml" );
	scrollView = DynamicTypeCheck<UIScrollView *>( FindByName( "Scrollview" ) );
	
	UIControl* innerControl = FindByName("UIControl1");
	if (innerControl)
	{
		innerControl->SetSprite("~res:/Gfx/UI/HorizontalScroll", 0);
		innerControl->GetBackground()->SetDrawType(UIControlBackground::DRAW_SCALE_TO_RECT);
	}
	
    UIControl *control = FindByName("HorizontalScrollbar");
    if( control )
    {
        UIScrollBar *horizontalScrollbar = DynamicTypeCheck<UIScrollBar *>( control );
        horizontalScrollbar->GetSlider()->SetSprite("~res:/Gfx/UI/HorizontalScroll", 0);
        horizontalScrollbar->GetSlider()->GetBackground()->SetDrawType(UIControlBackground::DRAW_STRETCH_HORIZONTAL);
		horizontalScrollbar->GetSlider()->GetBackground()->SetLeftRightStretchCap(10);
        horizontalScrollbar->SetOrientation( UIScrollBar::ORIENTATION_HORIZONTAL );
        horizontalScrollbar->SetDelegate(scrollView);
    }
	
    control = FindByName("VerticalScrollbar");
    if( control )
    {
        UIScrollBar *verticalScrollbar = DynamicTypeCheck<UIScrollBar *>( control );
        verticalScrollbar->GetSlider()->SetSprite("~res:/Gfx/UI/VerticalScroll", 0);
        verticalScrollbar->GetSlider()->GetBackground()->SetDrawType(UIControlBackground::DRAW_STRETCH_VERTICAL);
        verticalScrollbar->GetSlider()->GetBackground()->SetTopBottomStretchCap(10);
        verticalScrollbar->SetOrientation( UIScrollBar::ORIENTATION_VERTICAL );
        verticalScrollbar->SetDelegate(scrollView);
    }
	
	UIControl *testControl4 = new UIControl(Rect(1200, 1400, 250, 250));
	testControl4->SetDebugDraw(true);
	testControl4->GetBackground()->SetColor(Color(0.3333, 0.3333, 0.5555, 1.0000));
	testControl4->GetBackground()->SetDrawType(UIControlBackground::DRAW_FILL);
	testControl4->SetName("CONTROL_4");
	testControl4->AddEvent(UIControl::EVENT_TOUCH_UP_INSIDE, Message(this, &UIScrollViewTest::ButtonPressed));
	scrollView->AddControlToContainer(testControl4);

	UIControl *testControlChild = new UIControl(Rect(100, 100, 150, 150));
	testControlChild->SetDebugDraw(true);
	testControlChild->GetBackground()->SetColor(Color(0.3333, 0.3333, 0.5555, 1.0000));
	testControlChild->GetBackground()->SetDrawType(UIControlBackground::DRAW_FILL);
	testControlChild->SetName("CONTROL_3");
	testControlChild->AddEvent(UIControl::EVENT_TOUCH_UP_INSIDE, Message(this, &UIScrollViewTest::ButtonPressed));
	
	UIControl *testControl = new UIControl(Rect(50, 0, 150, 150));
	testControl->SetDebugDraw(true);
	testControl->GetBackground()->SetColor(Color(0.3333, 0.6667, 0.4980, 1.0000));
	testControl->GetBackground()->SetDrawType(UIControlBackground::DRAW_FILL);
	testControl->SetName("CONTROL_2");
	testControl->AddEvent(UIControl::EVENT_TOUCH_UP_INSIDE, Message(this, &UIScrollViewTest::ButtonPressed));
	testControl->AddControl(testControlChild);
	
	UIButton *testButton = new UIButton(Rect(10, 50, 250, 100));
	testButton->SetDebugDraw(true);
	testButton->SetStateFont(STATE_NORMAL, font);
	testButton->SetStateText(STATE_NORMAL, L"First button");
	testButton->GetBackground()->SetColor(Color(0.6667, 0.6667, 0.4980, 1.0000));
	testButton->GetBackground()->SetDrawType(UIControlBackground::DRAW_FILL);
	testButton->SetName("CONTROL_1");
	testButton->AddEvent(UIControl::EVENT_TOUCH_UP_INSIDE, Message(this, &UIScrollViewTest::ButtonPressed));
	testButton->AddControl(testControl);
	
	scrollView->AddControlToContainer(testButton);
	
	testMessageText = new UIStaticText(Rect(10, 10, 300, 30));
	testMessageText->SetFont(font);
	testMessageText->SetTextColor(Color(0.0, 1.0, 0.0, 1.0));
	testMessageText->GetBackground()->SetColor(Color(0.5, 0.0, 0.25, 1.0));
	testMessageText->GetBackground()->SetDrawType(UIControlBackground::DRAW_FILL);
	AddControl(testMessageText);
	
	finishTestBtn = new UIButton(Rect(10, 310, 300, 30));
	finishTestBtn->SetStateFont(0xFF, font);
	finishTestBtn->SetStateFontColor(0xFF, Color(1.0, 0.0, 0.0, 0.75));
	finishTestBtn->SetStateText(0xFF, L"Finish test");

	finishTestBtn->SetDebugDraw(true);
	finishTestBtn->AddEvent(UIControl::EVENT_TOUCH_UP_INSIDE, Message(this, &UIScrollViewTest::ButtonPressed));
	AddControl(finishTestBtn);
}
Beispiel #27
0
void WinState::ChangeToMenuState() {
    ChangeState(FindByName("MenuState"));
}
Beispiel #28
0
int Apollo::StringList::IsSet(const String& sKey)
{
  Elem* e = FindByName(sKey);
  return (e != 0);
}
Beispiel #29
0
void InitGUI()
{
	gui = new GUI();

	// initting main menu
	gui->mainmenu = new GUIcontrol("MainMenu");
	gui->mainmenu->SetTexture(&textures[FindByName(textures, "mainscreen")]);
	gui->mainmenu->SetPos(0, 0);
	gui->mainmenu->SetPatternCount(1);
	gui->mainmenu->SetPatternWidth(gui->mainmenu->tex->width);
	gui->mainmenu->SetPatternHeight(gui->mainmenu->tex->height);
	gui->mainmenu->SetCurrentPattern(0);
	gui->mainmenu->SetVisible(true);
	gui->mainmenu->SetColor(255, 255, 255, 255);

	gui->difficultymenu = new GUIcontrol("difficultymenu");
	gui->difficultymenu->SetTexture(&textures[FindByName(textures, "mainscreen")]);
	gui->difficultymenu->SetPos(0, 0);
	gui->difficultymenu->SetPatternCount(1);
	gui->difficultymenu->SetPatternWidth(gui->mainmenu->tex->width);
	gui->difficultymenu->SetPatternHeight(gui->mainmenu->tex->height);
	gui->difficultymenu->SetCurrentPattern(0);
	gui->difficultymenu->SetVisible(true);
	gui->difficultymenu->SetColor(255, 255, 255, 255);
	gui->difficultymenu->SetVisible(false);

	gui->AddControl(gui->mainmenu);
	gui->AddControl(gui->difficultymenu);

	GUIcontrol* easybutton = new GUIcontrol("EasyButton");
	easybutton->SetTexture(&textures[FindByName(textures, "button_long")]);
	easybutton->SetPos(250, 150);
	easybutton->SetPatternCount(3);
	easybutton->SetPatternWidth(220);
	easybutton->SetPatternHeight(30);
	easybutton->SetCurrentPattern(0);
	easybutton->SetVisible(true);
	easybutton->SetColor(255, 255, 255, 255);
	easybutton->SetCaptionFont(&fonts[0]);
	easybutton->SetCaptionColor(255, 255, 255, 255);
	easybutton->SetCaptionPos(30, 7);
	easybutton->SetCaption("Easy");

	GUIcontrol* mediumbutton = new GUIcontrol("MediumButton");
	mediumbutton->SetTexture(&textures[FindByName(textures, "button_long")]);
	mediumbutton->SetPos(250, 190);
	mediumbutton->SetPatternCount(3);
	mediumbutton->SetPatternWidth(220);
	mediumbutton->SetPatternHeight(30);
	mediumbutton->SetCurrentPattern(0);
	mediumbutton->SetVisible(true);
	mediumbutton->SetColor(255, 255, 255, 255);
	mediumbutton->SetCaptionFont(&fonts[0]);
	mediumbutton->SetCaptionColor(255, 255, 255, 255);
	mediumbutton->SetCaptionPos(30, 7);
	mediumbutton->SetCaption("Medium");

	GUIcontrol* hardbutton = new GUIcontrol("HardButton");
	hardbutton->SetTexture(&textures[FindByName(textures, "button_long")]);
	hardbutton->SetPos(250, 230);
	hardbutton->SetPatternCount(3);
	hardbutton->SetPatternWidth(220);
	hardbutton->SetPatternHeight(30);
	hardbutton->SetCurrentPattern(0);
	hardbutton->SetVisible(true);
	hardbutton->SetColor(255, 255, 255, 255);
	hardbutton->SetCaptionFont(&fonts[0]);
	hardbutton->SetCaptionColor(255, 255, 255, 255);
	hardbutton->SetCaptionPos(30, 7);
	hardbutton->SetCaption("Hard");

	GUIcontrol* impossiblebutton = new GUIcontrol("ImpossibleButton");
	impossiblebutton->SetTexture(&textures[FindByName(textures, "button_long")]);
	impossiblebutton->SetPos(250, 270);
	impossiblebutton->SetPatternCount(3);
	impossiblebutton->SetPatternWidth(220);
	impossiblebutton->SetPatternHeight(30);
	impossiblebutton->SetCurrentPattern(0);
	impossiblebutton->SetVisible(true);
	impossiblebutton->SetColor(255, 255, 255, 255);
	impossiblebutton->SetCaptionFont(&fonts[0]);
	impossiblebutton->SetCaptionColor(255, 255, 255, 255);
	impossiblebutton->SetCaptionPos(30, 7);
	impossiblebutton->SetCaption("Impossible");

	GUIcontrol* backbutton = new GUIcontrol("BackButton");
	backbutton->SetTexture(&textures[FindByName(textures, "button_long")]);
	backbutton->SetPos(250, 330);
	backbutton->SetPatternCount(3);
	backbutton->SetPatternWidth(220);
	backbutton->SetPatternHeight(30);
	backbutton->SetCurrentPattern(0);
	backbutton->SetVisible(true);
	backbutton->SetColor(255, 255, 255, 255);
	backbutton->SetCaptionFont(&fonts[0]);
	backbutton->SetCaptionColor(255, 255, 255, 255);
	backbutton->SetCaptionPos(30, 7);
	backbutton->SetCaption("Back");
	backbutton->SetPrevious(gui->mainmenu);
	backbutton->SetAction(actOpenPrevious);


	gui->difficultymenu->AddChild(easybutton);
	gui->difficultymenu->AddChild(mediumbutton);
	gui->difficultymenu->AddChild(hardbutton);
	gui->difficultymenu->AddChild(impossiblebutton);
	gui->difficultymenu->AddChild(backbutton);

	GUIcontrol* startbutton = new GUIcontrol("StartButton");
	startbutton->SetTexture(&textures[FindByName(textures, "button_long")]);
	startbutton->SetPos(30, 250);
	startbutton->SetPatternCount(3);
	startbutton->SetPatternWidth(220);
	startbutton->SetPatternHeight(30);
	startbutton->SetCurrentPattern(0);
	startbutton->SetVisible(true);
	startbutton->SetColor(255, 255, 255, 255);
	startbutton->SetCaptionFont(&fonts[0]);
	startbutton->SetCaptionColor(255, 255, 255, 255);
	startbutton->SetCaptionPos(30, 7);
	startbutton->SetCaption("New game");
	startbutton->SetAction(actOpenNext);
	startbutton->SetNext(gui->difficultymenu);

	GUIcontrol* loadbutton = new GUIcontrol("LoadButton");
	loadbutton->SetTexture(&textures[FindByName(textures, "button_long")]);
	loadbutton->SetPos(30, 290);
	loadbutton->SetPatternCount(3);
	loadbutton->SetPatternWidth(220);
	loadbutton->SetPatternHeight(30);
	loadbutton->SetCurrentPattern(0);
	loadbutton->SetVisible(true);
	loadbutton->SetColor(255, 255, 255, 255);
	loadbutton->SetCaptionFont(&fonts[0]);
	loadbutton->SetCaptionColor(255, 255, 255, 255);
	loadbutton->SetCaptionPos(30, 7);
	loadbutton->SetCaption("Load game");
	GUIcontrol* optionsbutton = new GUIcontrol("OptionsButton");
	optionsbutton->SetTexture(&textures[FindByName(textures, "button_long")]);
	optionsbutton->SetPos(30, 330);
	optionsbutton->SetPatternCount(3);
	optionsbutton->SetPatternWidth(220);
	optionsbutton->SetPatternHeight(30);
	optionsbutton->SetCurrentPattern(0);
	optionsbutton->SetVisible(true);
	optionsbutton->SetColor(255, 255, 255, 255);
	optionsbutton->SetCaptionFont(&fonts[0]);
	optionsbutton->SetCaptionColor(255, 255, 255, 255);
	optionsbutton->SetCaptionPos(30, 7);
	optionsbutton->SetCaption("Options");
	GUIcontrol* creditsbutton = new GUIcontrol("CreditsButton");
	creditsbutton->SetTexture(&textures[FindByName(textures, "button_long")]);
	creditsbutton->SetPos(30, 370);
	creditsbutton->SetPatternCount(3);
	creditsbutton->SetPatternWidth(220);
	creditsbutton->SetPatternHeight(30);
	creditsbutton->SetCurrentPattern(0);
	creditsbutton->SetVisible(true);
	creditsbutton->SetColor(255, 255, 255, 255);
	creditsbutton->SetCaptionFont(&fonts[0]);
	creditsbutton->SetCaptionColor(255, 255, 255, 255);
	creditsbutton->SetCaptionPos(30, 7);
	creditsbutton->SetCaption("Credits");
	GUIcontrol* exitbutton = new GUIcontrol("ExitButton");
	exitbutton->SetTexture(&textures[FindByName(textures, "button_long")]);
	exitbutton->SetPos(30, 410);
	exitbutton->SetPatternCount(3);
	exitbutton->SetPatternWidth(220);
	exitbutton->SetPatternHeight(30);
	exitbutton->SetCurrentPattern(0);
	exitbutton->SetVisible(true);
	exitbutton->SetColor(255, 255, 255, 255);
	exitbutton->SetCaptionFont(&fonts[0]);
	exitbutton->SetCaptionColor(255, 255, 255, 255);
	exitbutton->SetCaptionPos(30, 7);
	exitbutton->SetCaption("Exit");
	exitbutton->SetClose(true);
	gui->mainmenu->AddChild(startbutton);
	gui->mainmenu->AddChild(loadbutton);
	gui->mainmenu->AddChild(optionsbutton);
	gui->mainmenu->AddChild(creditsbutton);
	gui->mainmenu->AddChild(exitbutton);

	//gui->mainmenu->SetVisible(false);


	

	//gui = new GUI();
	//gui->ShowMessage("Hello player", "Open Orion", GUI_WARNING);
	//gui->ShowMessage("bugaga", "Test", GUI_NOTIFY);
}