/**
 * Initialize an EGL context for the current display.
 */
int Engine::InitDisplay()
{
    if( !initialized_resources_ )
    {
        gl_context_->Init( app_->window );
        LoadResources();
        initialized_resources_ = true;
    }
    else
    {
        // initialize OpenGL ES and EGL
        if( EGL_SUCCESS != gl_context_->Resume( app_->window ) )
        {
            UnloadResources();
            LoadResources();
        }
    }

    ShowUI();

    // Initialize GL state.
    glEnable( GL_CULL_FACE );
    glEnable( GL_DEPTH_TEST );
    glDepthFunc( GL_LEQUAL );

    //Note that screen size might have been changed
    glViewport( 0, 0, gl_context_->GetScreenWidth(), gl_context_->GetScreenHeight() );
    renderer_.UpdateViewport();

    tap_camera_.SetFlip( 1.f, -1.f, -1.f );
    tap_camera_.SetPinchTransformFactor( 10.f, 10.f, 8.f );

    return 0;
}
/**
 * Initialize an EGL context for the current display.
 */
int Engine::InitDisplay(const int32_t cmd) {
  if (!initialized_resources_) {
    startup_mutex_.lock();
    gl_context_->Init(app_->window);
    InitUI();
    LoadResources();
    initialized_resources_ = true;
    startup_mutex_.unlock();
  } else {
    // initialize OpenGL ES and EGL
    if (EGL_SUCCESS != gl_context_->Resume(app_->window)) {
      UnloadResources();
      LoadResources();
    }

    jui_helper::JUIWindow::GetInstance()->Resume(app_->activity, cmd);
  }

  // Enable culling OpenGL state
  glEnable(GL_CULL_FACE);

  // Enabled depth test OpenGL state
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);

  // Note that screen size might have been changed
  glViewport(0, 0, gl_context_->GetScreenWidth(),
             gl_context_->GetScreenHeight());
  renderer_.UpdateViewport();

  tap_camera_.SetFlip(1.f, -1.f, -1.f);
  tap_camera_.SetPinchTransformFactor(2.f, 2.f, 8.f);

  return 0;
}
Esempio n. 3
0
bool ResourceGUIBackend::LoadCommandLine(int argc,const char** argv)
{
  for(int i=1;i<argc;i++) {
    if(argv[i][0] == '-') {
      if(0==strcmp(argv[i],"-l")) {
	LoadResources(argv[i+1],*resources);
	i++;
      }
      else {
	printf("Unknown option %s",argv[i]);
	return 0;
      }
    }
    else {
      const char* ext=FileExtension(argv[i]);
      if(0==strcmp(ext,"xml")) {
	TiXmlDocument doc;
	if(!doc.LoadFile(argv[i])) {
	  printf("Error loading XML file %s\n",argv[i]);
	  return false;
	}
	if(0 == strcmp(doc.RootElement()->Value(),"world")) {
	  XmlWorld xmlWorld;
	  if(!xmlWorld.Load(doc.RootElement(),GetFilePath(argv[i]))) {
	    printf("Error loading world file %s\n",argv[i]);
	    return 0;
	  }
	  if(!xmlWorld.GetWorld(*world)) {
	    printf("Error loading world from %s\n",argv[i]);
	    return 0;
	  }
	}
	else if(0 == strcmp(doc.RootElement()->Value(),"resource_library")) {
	  LoadResources(doc.RootElement(),*resources);
	}
	else {
	  if(!LoadItem(argv[i],*resources))
	    return 0;
	}
      }
      else {
	//try loading into the world
	const char* ext = FileExtension(argv[i]);
	if(world->CanLoadElementExt(ext) && world->LoadElement(argv[i])>= 0) {
	  //loaded successfully
	}
	else {
	  //failed, now try resource library load
	  if(!LoadItem(argv[i],*resources))
	    return 0;
	}
      }
    }
  }
  return true;
}
Esempio n. 4
0
void UIScreen::LoadGroup()
{
	//Logger::Debug("load group started");
	//uint64 loadGroupStart = SystemTimer::Instance()->AbsoluteMS();
	if (groupId < 0)
	{
		if (isLoaded)return;
		
		LoadResources();
		isLoaded = true;
	}else
	{
		for (List<UIScreen*>::iterator t = appScreens.begin(); t != appScreens.end(); ++t)
		{
			UIScreen * screen = *t;
			if ((screen->groupId == groupId) && (!screen->isLoaded))
			{
				screen->LoadResources();
				screen->isLoaded = true;
			}
		}
	}
	//uint64 loadGroupEnd = SystemTimer::Instance()->AbsoluteMS();
	//Logger::Debug("load group finished: %lld", loadGroupEnd - loadGroupStart);
}
Esempio n. 5
0
void ResourceManager::Tick( float /*time*/ ) {
	if( !m_resources_loaded ) {
		LoadResources();
	}


}
Esempio n. 6
0
    void World::Update()
    {
        if(m_state == IDLE)
        {
            if(LoadResources())
            {

            }
        }
        else if(m_state == PLAYING)
        {
            if(!IsBallInBounds())
            {
                ChangeState(GAMEOVER);
            }
            else
            {
                UpdateBall();
                UpdatePlayer1();
                UpdatePlayer2(); 
            }
        }
        else if(m_state == GAMEOVER)
        {
            if(HasBallCollideLeft())
            {
                m_player2.UpdateScore(1);
            }
            else if(HasBallCollideRight())
            {
                m_player1.UpdateScore(1);
            }
            Restart();
        }
    }
Esempio n. 7
0
int
LoadDisplayResources( struct display *d )
{
	int i, ret;
	char **ent;

	if (Setjmp( cnftalk.errjmp ))
		return -1; /* may memleak */
	if ((ret = startConfig( GC_gDisplay, &d->cfg.dep, FALSE )) <= 0)
		return ret;
	GSendStr( d->name );
	GSendStr( d->class2 );
	LoadResources( &d->cfg );
/*	Debug( "display(%s, %s) resources: %[*x\n", d->name, d->class2,
           d->cfg.numCfgEnt, ((char **)d->cfg.data) + d->cfg.numCfgEnt );*/
	ret = 1;
	for (i = 0; i < as(dpyVal); i++) {
		if (!(ent = FindCfgEnt( d, dpyVal[i].id )))
			ret = -1;
		else
			ApplyResource( dpyVal[i].id, ent,
			               (char **)(((char *)d) + dpyVal[i].off) );
	}
	if (ret < 0)
		LogError( "Internal error: config reader supplied incomplete data\n" );
	return ret;
}
Esempio n. 8
0
CheckBox::CheckBox( Framework &fw, Control* Owner ) : Control( fw, Owner ), Checked(false), imagechecked(nullptr), imageunchecked(nullptr)
{
	LoadResources();
	if( buttonclick == nullptr )
	{
		buttonclick = new RawSound( fw, "STRATEGC/INTRFACE/BUTTON1.RAW" );
	}
}
CWaterFallE::CWaterFallE(int id, SpecificType specific_type, D3DXVECTOR3 pos, int width, int height)
	:CEffectObject(id, specific_type, pos, width, height)
{	
	_cols = width / GROUND_SIZE_NORMAL_X;
	_rows = height / GROUND_SIZE_NORMAL_Y;
	_countTime = 0;
	LoadResources();
}
Esempio n. 10
0
CSniperBlock::CSniperBlock(int id, SpecificType specific_type, D3DXVECTOR3 pos, int width, int height)
	:CEnemyUseGun(id, specific_type, pos, width, height)
{
	_hp = 1;
	_physical.vx_last = -1;
	_can_impact = true;
	LoadResources();
}
Esempio n. 11
0
void ConEmuAbout::DonateBtns_Add(HWND hDlg, int AlignLeftId, int AlignVCenterId)
{
	if (!m_Btns[0].pImg)
		LoadResources();

	RECT rcLeft = {}, rcTop = {};
	HWND hCtrl;

	hCtrl = GetDlgItem(hDlg, AlignLeftId);
	GetWindowRect(hCtrl, &rcLeft);
	MapWindowPoints(NULL, hDlg, (LPPOINT)&rcLeft, 2);
	hCtrl = GetDlgItem(hDlg, AlignVCenterId);
	GetWindowRect(hCtrl, &rcTop);
	int nPreferHeight = rcTop.bottom - rcTop.top;
	MapWindowPoints(NULL, hDlg, (LPPOINT)&rcTop, 2);

	#ifdef _DEBUG
	DpiValue dpi;
	CDpiAware::QueryDpiForWindow(hDlg, &dpi);
	#endif

	int X = rcLeft.left;

	for (size_t i = 0; i < countof(m_Btns); i++)
	{
		if (!m_Btns[i].pImg)
			continue; // Image was failed

		TODO("Вертикальное центрирование по объекту AlignVCenterId");

		int nDispW = 0, nDispH = 0;
		if (!m_Btns[i].pImg->GetSizeForHeight(nPreferHeight, nDispW, nDispH))
		{
			_ASSERTE(FALSE && "Image not available for dpi?");
			continue; // Image was failed?
		}
		_ASSERTE(nDispW>0 && nDispH>0);
		int nY = rcTop.top + ((rcTop.bottom - rcTop.top - nDispH + 1) / 2);

		hCtrl = CreateWindow(L"STATIC", m_Btns[i].ResId,
			WS_CHILD|WS_VISIBLE|SS_NOTIFY|SS_OWNERDRAW,
			X, nY, nDispW, nDispH,
			hDlg, (HMENU)m_Btns[i].nCtrlId, g_hInstance, NULL);

		#ifdef _DEBUG
		if (!hCtrl)
			DisplayLastError(L"Failed to create image button control");
		#endif

		//X += nDispW + (10 * dpi.Ydpi / 96);
		X += nDispW + (nDispH / 3);
	}

	RegisterTip(hDlg);

	UNREFERENCED_PARAMETER(hCtrl);
}
Esempio n. 12
0
clsGate::clsGate(LPDIRECT3DDEVICE9 d3ddev, LPD3DXSPRITE _SpriteHandler, int _ID, float _x, float _y):clsObject(_x,_y,80,185)
{
	m_Ani = NULL;
	m_ID = _ID;
	m_x = _x;
	m_y = _y - 15;
	ResetRect();
	LoadResources(d3ddev,_SpriteHandler);
}
clsGround10::clsGround10(LPDIRECT3DDEVICE9 d3ddev, LPD3DXSPRITE _SpriteHandler, int _ID, float _x, float _y)
{
	m_ID = _ID;
	m_Matdat = NULL;
	m_x = _x;
	m_y = _y;
	ResetRect(0,50,0,50);
	LoadResources(d3ddev,_SpriteHandler);
}
clsLadder49::clsLadder49(LPDIRECT3DDEVICE9 d3ddev, LPD3DXSPRITE _SpriteHandler, int _ID, float _x, float _y)
{
	m_ID = _ID;
	m_Sprite = NULL;
	m_x = _x;
	m_y = _y;
	ResetRect(0,20,0,50);
	LoadResources(d3ddev,_SpriteHandler);
}
Esempio n. 15
0
void InformationState::Init(sf::RenderWindow* screen)
{

	LoadResources(screen);

	InitFont();
	InitText();

}
Esempio n. 16
0
void GUISystem::CreateGUIWindow()
{
	try
	{
		bool is3D = false;

		tinyxml2::XMLDocument oDocument;
		tinyxml2::XMLError oErr = oDocument.LoadFile(CONFIG.c_str());
		if(oErr != tinyxml2::XML_NO_ERROR)
		{
			MGD_LOG::LOGManager::GetSingleton().WriteLog(MGD_LOG::MGD_ERROR, MAIN_CONTEXT, "Error loading file: %s", CONFIG.c_str());
			return;
		}
		const tinyxml2::XMLElement* pRoot = oDocument.RootElement();
		if(pRoot)
		{
			const tinyxml2::XMLElement* p3D = pRoot->FirstChildElement("Is3D");
			if(p3D)
			{
				is3D = p3D->BoolAttribute("enable");
			}
		}

		//Create RENDERER
		if(is3D)
		{
			m_pOgreGuiRenderer = &CEGUI::OgreRenderer::bootstrapSystem();
		}
		else
		{
			m_pOpenGLGuiRenderer = &CEGUI::OpenGLRenderer::bootstrapSystem();

			m_pOpenGLGuiRenderer->getDefaultRenderingRoot().clearGeometry(CEGUI::RQ_OVERLAY);
			m_pOpenGLGuiRenderer->enableExtraStateSettings(true); // ??
			LoadResources();

		}


	//Setup CEGUI System
	CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");

	CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");

	//Create window
	m_pGUIWindowManager = &CEGUI::WindowManager::getSingleton();
	m_pGuiWindow = m_pGUIWindowManager->createWindow("DefaultWindow", "MGD_14_GUI/Window");
	m_pGuiWindow->setText("MGD_14 - Game");

	CEGUI::System::getSingleton().setGUISheet(m_pGuiWindow);
	}
	catch (CEGUI::Exception& e)
	{
		MGD_LOG::LOGManager::GetSingleton().WriteLog(MGD_LOG::MGD_ERROR, GUI_CONTEXT, e.getMessage().c_str());
	}
}
Esempio n. 17
0
void CApp::OpenWindow( )
{
    char cTmp[20];
    sprintf( cTmp, "Lifes: %d", iLife );
    w_Window.create( sf::VideoMode( 800, 600 ), cTmp, sf::Style::Close );
    w_Window.setMouseCursorVisible( true );
    w_Window.setFramerateLimit( 60 );
    if( !LoadResources( ) )
        exit(1);
}
/**
 * Initialize an EGL context for the current display.
 */
int Engine::InitDisplay(android_app* app) {
  if (!initialized_resources_) {
    gl_context_->Init(app_->window);
    LoadResources();
    initialized_resources_ = true;
  } else if(app->window != gl_context_->GetANativeWindow()) {
    // Re-initialize ANativeWindow.
    // On some devices, ANativeWindow is re-created when the app is resumed
    assert(gl_context_->GetANativeWindow());
    UnloadResources();
    gl_context_->Invalidate();
    app_ = app;
    gl_context_->Init(app->window);
    LoadResources();
    initialized_resources_ = true;
  } else {
    // initialize OpenGL ES and EGL
    if (EGL_SUCCESS == gl_context_->Resume(app_->window)) {
      UnloadResources();
      LoadResources();
    } else {
        assert(0);
    }
  }

  ShowUI();

  // Initialize GL state.
  glEnable(GL_CULL_FACE);
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);

  // Note that screen size might have been changed
  glViewport(0, 0, gl_context_->GetScreenWidth(),
             gl_context_->GetScreenHeight());
  renderer_.UpdateViewport();

  tap_camera_.SetFlip(1.f, -1.f, -1.f);
  tap_camera_.SetPinchTransformFactor(2.f, 2.f, 8.f);

  return 0;
}
Esempio n. 19
0
CResourceScript * CResourceBase::LoadResourcesAdd( LPCTSTR pszNewFileName )
{
	ADDTOCALLSTACK("CResourceBase::LoadResourcesAdd");
	// Make sure this is added to my list of resource files
	// And load it now.

	CResourceScript * pScript = AddResourceFile( pszNewFileName );
	if ( ! LoadResources(pScript))
		return( NULL );
	return( pScript );
}
Esempio n. 20
0
CBoss3::CBoss3(int id, SpecificType specific_type, D3DXVECTOR3 pos, int width, int height)
	:CEnemyUseGun(id, specific_type, pos, width, height)
{
	_hp = 20;
	_is_hide = true;
	_last_time_hide = 0;
	_count_time_destroy = 0;
	_x_random = pos.x;
	_y_random = pos.y;
	_enable = false;
	LoadResources();
}
Esempio n. 21
0
		ReturnValue GraphicsService::Start()
		{
			Render::Init();
			Render::SetOrthoMode();
			Render::EnableOrthoMode();
			Render::EnableAlphaBlend();

			LoadResources();

			PostEffect::Init(Render::GetScreenWidth(),Render::GetScreenHeight());

			return RETURN_VALUE_OK;
		}
Esempio n. 22
0
//Ham nay tuong tu ham tren nhung co them mot so tham so trang thai
//Su dung de Doc du lieu tu file save game
clsMapple::clsMapple(LPDIRECT3DDEVICE9 d3ddev, LPD3DXSPRITE _SpriteHandler, float _x, float _y, float _width, float _height, float _vx, float _vy, int _Moving, bool _Jumping):clsObject(_x,_y,_width,_height)
{
	m_Maple = NULL;
	m_Maple_jump = NULL;
	//m_x = _x;
	//m_y = _y;
	m_vx = m_oldX = _vx;
	m_vy = _vy;
	m_Moving = _Moving;
	m_Jumping = _Jumping;
	m_Action = STAND;
	m_newPos = 0;
	LoadResources(d3ddev,_SpriteHandler);
}
Esempio n. 23
0
World::World(Switch *sw, unsigned int scrWidth, unsigned int scrHeight)
	: Scene(sw, scrWidth, scrHeight)
{
  //Set scene dimentions
	screenHeight = scrHeight;
	screenWidth = screenWidth;

  //Initialize variables
	zone = 0;
	danger = 0;

  //Load Images that may be used on the map
	if (!LoadTileImages())
		std::cout<<"ERROR: Could not load tile image!"<<std::endl;

	//Create speech dialog bubble.
	textBubble = new TextBubble();
	textBubble->LoadAnimations();
	textBubbleButton = new BubbleButton(450,420,(char*)"Continue");
	textBubbleButton->LoadAnimations();

  //Create party
	party = new Party( 73, 142, 25, 40, 0);

 //Create the savegame dialog.
  savegame = new SaveGameDialog(party);

  //Parse entities file.
  Parser *parser = new Parser(this, textBubble, savegame);
  parser->LoadXml((char*)"resources/map/secure_forest.xml");
  parser->LoadXml((char*)"resources/map/city.xml");
  parser->LoadXml((char*)"resources/map/forest.xml");
  parser->LoadXml((char*)"resources/map/plains.xml");
  parser->LoadXml((char*)"resources/map/cave.xml");
  delete parser;

  //Add party and characters
	AddEntity(party);
	AddPhysicObject(party);
	party->LoadAnimations();

  //Load map.
	if (!LoadMap((char*)"resources/map/world.map"))
		std::cout<<"ERROR: Could not load map!"<<std::endl;

  //load resources.
	if (!LoadResources())
		std::cout<<"ERROR: Could not load resources!"<<std::endl;
}
Esempio n. 24
0
void MenuState::Init() {
    releaseMouse = true;
    dialogVisible = false;
    
	LoadResources(); // Cargamos recursos
    
    if(!ConfigurationManager::Instance()->loaded)
        ConfigurationManager::Instance()->LoadConfigurations();
    
    if(!StatusManager::Instance()->loaded)
        StatusManager::Instance()->LoadStatus();
    
    musicPlayer->Play();
	
	// Inicializamos fuentes
	background = new SpriteSheet(resourceManager->GetTexture("texBackground"));
    
    
    // Dialog
    backgroundDialog = new SpriteSheet(resourceManager->GetTexture("texDialogBack"));
    
    Vector posDialog = Vector(
        RenderWindow::Instance()->width/2 - backgroundDialog->getGlobalBounds().GetWidth()/2,
        RenderWindow::Instance()->height/2 - backgroundDialog->getGlobalBounds().GetHeight()/2
    );
    backgroundDialog->SetPosition(posDialog);
    
    
    dialogNo = new ImageButton(posDialog.GetX()+50.f, posDialog.GetY()+100.f, 2, resourceManager->GetTexture("texDialogNo"));
    dialogNo->SetFrame(1);
    dialogYes = new ImageButton(posDialog.GetX()+200.f, posDialog.GetY()+100.f ,2,resourceManager->GetTexture("texDialogYes"));
    
    for(int i=0; i<6; i++)         //  x   ,  y,            contenido
        vButtons->push_back(new Button(512.f, 380.f + 50.f*i, ""));

    
    vButtons->at(0)->SetText("Nueva Partida");
    vButtons->at(1)->SetText("Continuar");
    vButtons->at(2)->SetText("Controles");
    vButtons->at(3)->SetText("Opciones");
    vButtons->at(4)->SetText("Acerca De");
    vButtons->at(5)->SetText("Salir");
    
    for(int i=0; i<6; i++)         //  w , h  ,  x   ,  y,            contenido
        vButtons->at(i)->Center();
    
    requestStateChange = std::make_pair(States::ID::LoadingState,false);
}
Esempio n. 25
0
void ConEmuAbout::DonateBtns_Add(HWND hDlg, int AlignLeftId, int AlignVCenterId)
{
	if (!m_Btns[0].hBmp)
		LoadResources();

	RECT rcLeft = {}, rcTop = {};
	HWND hCtrl;

	hCtrl = GetDlgItem(hDlg, AlignLeftId);
	GetWindowRect(hCtrl, &rcLeft);
	MapWindowPoints(NULL, hDlg, (LPPOINT)&rcLeft, 2);
	hCtrl = GetDlgItem(hDlg, AlignVCenterId);
	GetWindowRect(hCtrl, &rcTop);
	MapWindowPoints(NULL, hDlg, (LPPOINT)&rcTop, 2);

	int nDisplayDpi = gpSetCls->QueryDpi();

	int X = rcLeft.left;

	for (size_t i = 0; i < countof(m_Btns); i++)
	{
		if (!m_Btns[i].hBmp)
			continue; // Image was failed

		TODO("Вертикальное центрирование по объекту AlignVCenterId");

		int nDispW = m_Btns[i].bmp.bmWidth * nDisplayDpi / 96;
		int nDispH = m_Btns[i].bmp.bmHeight * nDisplayDpi / 96;
		int nY = rcTop.top + ((rcTop.bottom - rcTop.top - nDispH + 1) / 2);

		hCtrl = CreateWindow(L"STATIC", m_Btns[i].ResId,
			WS_CHILD|WS_VISIBLE|SS_NOTIFY|SS_OWNERDRAW,
			X, nY, nDispW, nDispH,
			hDlg, (HMENU)m_Btns[i].nCtrlId, g_hInstance, NULL);

		#ifdef _DEBUG
		if (!hCtrl)
			DisplayLastError(L"Failed to create image button control");
		#endif

		X += nDispW + (10 * nDisplayDpi / 96);
	}

	RegisterTip(hDlg);

	UNREFERENCED_PARAMETER(hCtrl);
}
void AELoadedResourcesTreeView::createModelInstance()
{
	bool reloadResources = false;
	QModelIndexList selectedRows = selectedIndexes();
	for (int i = 0; i < selectedRows.count() / 2; i++)
	{
		Anima::AnimaModel* selectedModel = _resourcesModel->itemFromIndex(selectedRows[i])->data().value<Anima::AnimaModel*>();
		if (selectedModel != nullptr)
		{
			if (_document->CreateModelInstace(selectedModel))
				reloadResources = true;
		}
	}

	if (reloadResources)
		LoadResources();
}
Esempio n. 27
0
//
// Init
//
 void Game::Init()
{
	int i;
	RaycasterSetup setup;
	char spriteFilename[MAX_STR_LENGTH];

	strcpy(setup.mapFilename, mapFilename);

	strcpy(spriteFilename, mapFilename);
	strcat(spriteFilename, "sprites");

	if(framework->Exit==true)
	LoadResources();

	LoadSpriteMap(spriteFilename);

	setup.numTextures = numTextures;

	for(i=0; i<setup.numTextures; i++)
	{
		setup.textures[i][0] = textures[i][0];
		setup.textures[i][1] = textures[i][1];
	}

	setup.sprites = &sprites;

	setup.target = framework->GetScreen();
	setup.lowQuality = lowQuality;
	setup.badQuality = badQuality;

	setup.crosshairRect = &crosshairRect;

	fireVisible = false;
	fireStart = SDL_GetTicks();

	raycaster = new Raycaster(&setup);
	player = new Player();

	if(!framework->GetNoSound())
	{
		framework->PlayMusic(music1, -1);
		framework->PlaySound(startSnd);
	}

	showExitConfirm = false;
}
Esempio n. 28
0
vd::status
Application::Startup(int* argc, void** argv)
{
    m_Status = Status::Code::Starting;
    Core::System::Startup();
    Runtime::System::Startup();

    if(!LoadResources())
    {
        vdLogWarning("Failed to load resources!");
        return Status::Code::LoadError;
    }

    m_Runtime = System::CreateContext(m_ParamSet);
	SetActive(this);
    return Status::Code::Success;
}
Esempio n. 29
0
void State_Menu::Init()
{	
	LoadResources();

	isCleanedUp = false;

	mainMenu = new Menu("Main Menu");
	characterSelectionMenu = new Menu("Character Selection");
	optionsMenu = new Menu("Options");
	resolutionMenu = new Menu("Resolution Settings");
	creditsMenu = new Menu("Credits");
	pauseMenu = new Menu("Surrender?");
	waveMenu = new Menu("Wave Menu");

	mainMenu->AddButton("Start Game", MenuActions::CharacterSelection);
	mainMenu->AddButton("Options", MenuActions::Options);
	mainMenu->AddButton("Credits", MenuActions::Credits);
	mainMenu->AddButton("Exit", MenuActions::Exit);

	optionsMenu->AddButton("Resolution", MenuActions::Resolution);
	optionsMenu->AddButton("Sound", MenuActions::Sound);
	optionsMenu->AddButton("Back", MenuActions::Back);
	
	creditsMenu->AddImage(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 530, 190, 0);
	creditsMenu->AddButton("Back", SCREEN_WIDTH / 2, SCREEN_HEIGHT - 100, MenuActions::Back);

	pauseMenu->AddButton("Yesh", MenuActions::Yesh);
	pauseMenu->AddButton("Nah", MenuActions::Nah);

	waveMenu->AddButton("Continue", MenuActions::Continue);
	waveMenu->AddButton("Surrender", MenuActions::Surrender);

	characterSelectionMenu->AddClassIconBig(ClassIconGraphic::WarriorClicked, nullptr);
	characterSelectionMenu->AddClassIconBig(ClassIconGraphic::Disabled, nullptr);
	characterSelectionMenu->AddClassIconBig(ClassIconGraphic::Disabled, nullptr);
	characterSelectionMenu->AddButton("Begin", 570, 520, MenuActions::StartGame);
	characterSelectionMenu->AddButton("Back", 240, 520, MenuActions::Back);

	resolutionMenu->AddImage(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SliderDimension::sliderBarWidth, SliderDimension::sliderBarHeight, 1);
	resolutionMenu->AddImage(SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, SliderDimension::sliderWidth, SliderDimension::sliderHeight, 2);
	resolutionMenu->AddButton("Back", SCREEN_WIDTH / 2, SCREEN_HEIGHT - 100, MenuActions::Options);

	menuList = { mainMenu, characterSelectionMenu, optionsMenu, resolutionMenu, creditsMenu, waveMenu, pauseMenu };
	SwitchToMenu("Main Menu");
}
Esempio n. 30
0
	KBOOL AppFrame::Initialize( KCCHAR* pTitle, KCCHAR* pIcon )
	{
		if (g_theApp) return false;
		else  g_theApp = this;

#ifdef _DEBUG
		m_pRoot = OGRE_NEW Ogre::Root("plugins_debug.cfg");
#else
		m_pRoot = OGRE_NEW Ogre::Root();
#endif

		//////////////////////////////////////////////////////////////////////////
		if(m_pRoot->restoreConfig() || m_pRoot->showConfigDialog())
		{
			m_pWindow = m_pRoot->initialise(true, pTitle);
			
			//-------------------------------------------------------
			// ╪стьм╪╠Й
			HWND hwnd;
			m_pWindow->getCustomAttribute("WINDOW", (void*)&hwnd);

			HINSTANCE hinstance;
			hinstance = GetModuleHandle(NULL);
			HICON icon = LoadIconA(hinstance, pIcon);

			SendMessage(hwnd, WM_SETICON, ICON_BIG, LPARAM(icon));
			SendMessage(hwnd, WM_SETICON, ICON_SMALL, LPARAM(icon));
			//-------------------------------------------------------

			if (!LoadResources())
				return false;

			// Set default mipmap level (NB some APIs ignore this)
			Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
			
			Ogre::WindowEventUtilities::addWindowEventListener(m_pWindow, this);
			m_pRoot->addFrameListener(this);

			//////////////////////////////////////////////////////////////////////////
			CreateWidgets();
			
			return true;
		}
		
		return false;