void ButtonWidget::Render() {

	if(bNoMenu)
		return;
	
	Color color = (bCheck) ? Color::white : Color(63, 63, 63, 255);
	EERIEDrawBitmap2(m_rect, 0, m_texture, color);
}
Beispiel #2
0
static void DrawCenteredImage(TextureContainer * tc) {
	
	Vec2f size = Vec2f(tc->size());
	
	Vec2f pos = Vec2f(g_size.center());
	pos += -size * 0.5f;
	
	EERIEDrawBitmap2(Rectf(pos, size.x, size.y), 0.001f, tc, Color::white);
}
void CheckboxWidget::renderCommon() {
	
	GRenderer->SetRenderState(Renderer::AlphaBlending, true);
	GRenderer->SetBlendFunc(Renderer::BlendOne, Renderer::BlendOne);
	
	Rectf checkboxRect;
	checkboxRect.top = m_rect.top;
	checkboxRect.left = m_rect.right - m_rect.height();
	checkboxRect.bottom = m_rect.bottom;
	checkboxRect.right = m_rect.right;
	
	TextureContainer *pTex = (iState == 0) ? m_textureOff : m_textureOn;
	Color color = (bCheck) ? Color::white : Color(63, 63, 63, 255);
	
	EERIEDrawBitmap2(checkboxRect, 0.f, pTex, color);
}
void MenuCursor::DrawOneCursor(const Vec2s& mousePos) {
	
	if(!GInput->isMouseInWindow()) {
		return;
	}
	
	GRenderer->GetTextureStage(0)->setMinFilter(TextureStage::FilterNearest);
	GRenderer->GetTextureStage(0)->setMagFilter(TextureStage::FilterNearest);
	GRenderer->GetTextureStage(0)->setWrapMode(TextureStage::WrapClamp);

	EERIEDrawBitmap2(Rectf(Vec2f(mousePos), m_size.x, m_size.y),
	                 0.00000001f, scursor[m_currentFrame], Color::white);

	GRenderer->GetTextureStage(0)->setMinFilter(TextureStage::FilterLinear);
	GRenderer->GetTextureStage(0)->setMagFilter(TextureStage::FilterLinear);
	GRenderer->GetTextureStage(0)->setWrapMode(TextureStage::WrapRepeat);
}
Beispiel #5
0
//-----------------------------------------------------------------------------
// ARX Menu Rendering Func
// returns false if no menu needs to be displayed
//-----------------------------------------------------------------------------
bool ARX_Menu_Render() {
	
	if(ARXmenu.currentmode == AMCM_OFF)
		return false;

	bool br = Menu2_Render();

	if(br)
		return br;

	if(ARXmenu.currentmode == AMCM_OFF)
		return false;

	if(GInput->getMouseButton(Mouse::Button_0)) {
		EERIEMouseButton = 1;
		LastMouseClick = 1;
	} else if(GInput->getMouseButton(Mouse::Button_1)) {
		EERIEMouseButton = 2;
		LastMouseClick = 2;
	} else {
		EERIEMouseButton = 0;
	}

	GRenderer->Clear(Renderer::ColorBuffer | Renderer::DepthBuffer);
	
	FLYING_OVER = 0;

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

	if(ARXmenu.currentmode == AMCM_NEWQUEST && ARXmenu.mda) {
		
		GRenderer->SetRenderState(Renderer::Fog, false);
		GRenderer->SetRenderState(Renderer::AlphaBlending, false);

		if(ARXmenu.mda->BookBackground != NULL) {
			GRenderer->SetRenderState(Renderer::AlphaBlending, false);
			GRenderer->SetRenderState(Renderer::Fog, false);
			GRenderer->SetRenderState(Renderer::DepthWrite, false);
			GRenderer->SetRenderState(Renderer::DepthTest, false);

			EERIEDrawBitmap2(Rectf(Vec2f(0, 0), g_size.width(), g_size.height()), 0.9f, ARXmenu.mda->BookBackground, Color::white);
		}

		BOOKZOOM = 1;

		ARX_INTERFACE_ManageOpenedBook();


		if(ARXmenu.mda) {
			long DONE = 0;

			if(player.Skill_Redistribute == 0 && player.Attribute_Redistribute == 0)
				DONE = 1;

			float ox, oy;
			ox = g_sizeRatio.x;
			oy = g_sizeRatio.y;
			LASTBOOKBUTTON = BOOKBUTTON;
			BOOKBUTTON = EERIEMouseButton;
			g_sizeRatio.x = ox;
			g_sizeRatio.y = oy;

			if(!ARXmenu.mda->flyover[FLYING_OVER].empty() ) //=ARXmenu.mda->flyover[FLYING_OVER];
			{
				if(FLYING_OVER != OLD_FLYING_OVER) {

					float fRandom = rnd() * 2;

					int t = checked_range_cast<int>(fRandom);

					pTextManage->Clear();
					OLD_FLYING_OVER = FLYING_OVER;
					UNICODE_ARXDrawTextCenteredScroll(hFontInGame,
						(g_size.width() * 0.5f),
						12,
						(g_size.center().x) * 0.82f,
						ARXmenu.mda->flyover[FLYING_OVER],
						Color(232 + t, 204 + t, 143 + t),
						1000,
						0.01f,
						2);
				}
			} else {
				OLD_FLYING_OVER = -1;
			}
			
			Vec2f pos;
			pos.x = 0;
			pos.y = 313 * g_sizeRatio.y + (g_size.height() - 313 * g_sizeRatio.y) * 0.70f;
			
			Vec2f size = g_sizeRatio;
			size *= 100;
			
			Color color = Color::none;

			//---------------------------------------------------------------------
			// Button QUICK GENERATION
			pos.x = (g_size.width() - (513 * g_sizeRatio.x)) * 0.5f;
			
			const Rectf quickGenerateButtonMouseTestRect(
				pos,
				size.x,
				size.y
			);
			
			if(quickGenerateButtonMouseTestRect.contains(Vec2f(DANAEMouse))) {
				SpecialCursor = CURSOR_INTERACTION_ON;
				FLYING_OVER = BUTTON_QUICK_GENERATION;

				if (EERIEMouseButton & 1) ;
				else if ((!(EERIEMouseButton & 1)) && (LastMouseClick & 1))
				{
					QUICK_MOD++;
					int iSkin = player.skin;
					ARX_SOUND_PlayMenu(SND_MENU_CLICK);

					if(bQuickGenFirstClick) {
						ARX_PLAYER_MakeAverageHero();
						bQuickGenFirstClick = false;
					} else {
						ARX_PLAYER_QuickGeneration();
					}

					player.skin = checked_range_cast<char>(iSkin);
				}

				color = Color(255, 255, 255);
			}
			else
				color = Color(232, 204, 143);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_quickgen, static_cast<long>(pos.x), static_cast<long>(pos.y), color);

			//---------------------------------------------------------------------
			// Button SKIN
			pos.x = g_size.width() * 0.5f;
			
			const Rectf skinButtonMouseTestRect(
				pos,
				size.x,
				size.y
			);
			
			if(skinButtonMouseTestRect.contains(Vec2f(DANAEMouse))) {
				SpecialCursor = CURSOR_INTERACTION_ON;
				FLYING_OVER = BUTTON_SKIN;

				if(!(EERIEMouseButton & 1) && (LastMouseClick & 1)) {
					SKIN_MOD++;
					BOOKZOOM = 1;
					ARX_SOUND_PlayMenu(SND_MENU_CLICK);
					player.skin++;

					if(player.skin > 3)
						player.skin = 0;

					ARX_PLAYER_Restore_Skin();
				}

				color = Color(255, 255, 255);
			}
			else
				color = Color(232, 204, 143);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_skin, static_cast<long>(pos.x), static_cast<long>(pos.y), color);

			//---------------------------------------------------------------------
			// Button DONE
			pos.x = g_size.width() - (g_size.width() - 513 * g_sizeRatio.x) * 0.5f - 40 * g_sizeRatio.x;
			
			const Rectf doneButtonMouseTestRect(
				pos,
				size.x,
				size.y
			);
			
			if(doneButtonMouseTestRect.contains(Vec2f(DANAEMouse))) {
				if(DONE)
					SpecialCursor = CURSOR_INTERACTION_ON;

				FLYING_OVER = BUTTON_DONE;

				if(DONE && !(EERIEMouseButton & 1) && (LastMouseClick & 1)) {
					if(SKIN_MOD == 8 && QUICK_MOD == 10) {
						SKIN_MOD = -2;
					} else if(SKIN_MOD == -1) {
						ARX_PLAYER_MakeSpHero();
						player.skin = 4;
						ARX_PLAYER_Restore_Skin();
						SKIN_MOD = 0;
						SP_HEAD = 1;
					} else {
						if(SP_HEAD) {
							player.skin = 4;
							ARX_PLAYER_Restore_Skin();
							SP_HEAD = 0;
						}

						ARX_SOUND_PlayMenu(SND_MENU_CLICK);

						bFadeInOut = true;		//fade out
						bFade = true;			//active le fade
						iFadeAction = AMCM_OFF;
					}
				} else {
					if(DONE)
						color = Color(255, 255, 255);
					else
						color = Color(192, 192, 192);
				}
			} else {
				if(DONE)
					color = Color(232, 204, 143);
				else
					color = Color(192, 192, 192);
			}

			if(SKIN_MOD < 0)
				color = Color(255, 0, 255);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_done, static_cast<long>(pos.x), static_cast<long>(pos.y), color);
		}
	}

	EERIE_LIGHT * light = lightHandleGet(torchLightHandle);
	light->pos.x = 0.f + GInput->getMousePosAbs().x - (g_size.width() >> 1);
	light->pos.y = 0.f + GInput->getMousePosAbs().y - (g_size.height() >> 1);

	if(pTextManage) {
		pTextManage->Update(framedelay);
		pTextManage->Render();
	}

	if(ARXmenu.currentmode != AMCM_CREDITS)
		ARX_INTERFACE_RenderCursor(true);

	if(ARXmenu.currentmode == AMCM_NEWQUEST) {
		if(ProcessFadeInOut(bFadeInOut, 0.1f)) {
			switch(iFadeAction) {
				case AMCM_OFF:
					arxtime.resume();
					ARX_MENU_NEW_QUEST_Clicked_QUIT();
					iFadeAction = -1;
					bFade = false;
					fFadeInOut = 0.f;

					if(pTextManage)
						pTextManage->Clear();

					break;
			}
		}
	}

	return true;
}
void LoadLevelScreen(long num) {
	
	// resets status
	if(num < -1) {
		delete tc, tc = NULL;
		lastloadednum = -1;
		lastnum = -1;
		PROGRESS_BAR_TOTAL = 0;
		return;
	}
	
	if(num == -1) {
		num = lastnum;
	}
	lastnum = num;
	
	if(num < 0) {
		return;
	}
	
	static u32 last_progress_bar_update = platform::getTimeMs();
	
	// only update if time since last update to progress bar > 16ms
	// and progress bar's value has actually changed
	if (platform::getElapsedMs(last_progress_bar_update) > 16 &&
		 OLD_PROGRESS_BAR_COUNT != PROGRESS_BAR_COUNT)
	{
		GRenderer->GetTextureStage(0)->setMinFilter(TextureStage::FilterLinear);
		GRenderer->GetTextureStage(0)->setMagFilter(TextureStage::FilterLinear);

		float ratio = (PROGRESS_BAR_TOTAL > 0.f ? PROGRESS_BAR_COUNT / PROGRESS_BAR_TOTAL : 0); 

		ratio = glm::clamp(ratio, 0.f, 1.f);

		GRenderer->Clear(Renderer::ColorBuffer | Renderer::DepthBuffer);
		
		GRenderer->SetRenderState(Renderer::DepthTest, true);
		GRenderer->SetCulling(Renderer::CullNone);
		GRenderer->SetRenderState(Renderer::DepthWrite, true);
		GRenderer->SetRenderState(Renderer::Fog, false);
		GRenderer->SetRenderState(Renderer::AlphaBlending, false);
		
		if (num == 10) {
			pbar = TextureContainer::LoadUI("graph/interface/menus/load_full");
		} else {
			pbar = TextureContainer::LoadUI("graph/interface/menus/load_full_level");
		}
		
		nopbar = 1;
		
		if(num != lastloadednum) {
			delete tc, tc = NULL;
			lastloadednum = num;
			char temp[256];
			char tx[256];
			GetLevelNameByNum(num, tx);
			sprintf(temp, "graph/levels/level%s/loading", tx);
			tc = TextureContainer::LoadUI(temp, TextureContainer::NoColorKey);
		}
		
		float scale = minSizeRatio();
		
		if(tc) {
			GRenderer->SetRenderState(Renderer::ColorKey, false);
			
			Vec2f size = (num == 10) ? Vec2f(640, 480) : Vec2f(320, 390);
			size *= scale;
			
			Vec2f pos = Vec2f(g_size.center());
			pos += -size * 0.5f;
			
			EERIEDrawBitmap2(Rectf(pos, size.x, size.y), 0.001f, tc, Color::white);
			
			GRenderer->SetRenderState(Renderer::ColorKey, true);
		}
		
		if(pbar) {
			Vec2f pos = Vec2f(g_size.center());
			pos += Vec2f(-100 * scale, ((num == 10) ? 221 : 35) * scale);

			Vec2f size = Vec2f(ratio * 200 * scale, 8 * scale);
			EERIEDrawBitmap_uv(Rectf(pos, size.x, size.y), 0.f, pbar, Color::white, 0.f, 0.f, ratio, 1.f);
		}
		
		mainApp->getWindow()->showFrame();
		
		OLD_PROGRESS_BAR_COUNT = PROGRESS_BAR_COUNT;
		last_progress_bar_update = platform::getTimeMs();
	}
}
Beispiel #7
0
void Note::render() {
	
	if(!allocate()) {
		return;
	}
	
	float z = 0.000001f;
	
	GRenderer->GetTextureStage(0)->setWrapMode(TextureStage::WrapClamp);
	
	if(background) {
		EERIEDrawBitmap2(_area.left, _area.top, _area.width(), _area.height(), z, background,
		                 Color::white);
	}
	
	if(pages.empty()) {
		return;
	}
	
	arx_assert(_page < pages.size());
	
	// Draw the "previous page" button
	Rectf prevRect = prevPageButton();
	if(!prevRect.empty()) {
		arx_assert(prevPage != NULL);
		EERIEDrawBitmap2(prevRect.left, prevRect.top, prevRect.width(), prevRect.height(), z, prevPage,
		                 Color::white);
	}
	
	// Draw the "next page" button
	Rectf nextRect = nextPageButton();
	if(!nextRect.empty()) {
		arx_assert(nextPage != NULL);
		EERIEDrawBitmap2(nextRect.left, nextRect.top, nextRect.width(), nextRect.height(), z, nextPage,
		                 Color::white);
	}
	
	Font * font = hFontInGameNote;
	
	// Draw the left page
	{
		ARX_UNICODE_DrawTextInRect(
			font,
			_area.left + _textArea.left,
			_area.top + _textArea.top,
			_area.left + _textArea.right,
			pages[_page],
			Color::none
		);
	}
	
	// Draw the right page
	if(_page + 1 < pages.size()) {
		ARX_UNICODE_DrawTextInRect(
			font,
			_area.left + _textArea.right + _pageSpacing,
			_area.top + _textArea.top,
			_area.left + _textArea.right + _pageSpacing + _textArea.width(),
			pages[_page + 1],
			Color::none
		);
	}
	
}
Beispiel #8
0
//-----------------------------------------------------------------------------
// ARX Menu Rendering Func
// returns false if no menu needs to be displayed
//-----------------------------------------------------------------------------
bool ARX_Menu_Render() {
	
	if(ARXmenu.currentmode == AMCM_OFF)
		return false;

	bool br = Menu2_Render();

	if(br)
		return br;

	if(ARXmenu.currentmode == AMCM_OFF)
		return false;

	if(GInput->getMouseButton(Mouse::Button_0)) {
		EERIEMouseButton = 1;
		LastMouseClick = 1;
	} else if(GInput->getMouseButton(Mouse::Button_1)) {
		EERIEMouseButton = 2;
		LastMouseClick = 2;
	} else {
		EERIEMouseButton = 0;
	}

	GRenderer->BeginScene();

	GRenderer->Clear(Renderer::ColorBuffer | Renderer::DepthBuffer);
	
	FLYING_OVER = 0;

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

	if(ARXmenu.currentmode == AMCM_NEWQUEST && ARXmenu.mda) {
		if(ITC.Get("questbook") == NULL) {
			ARX_Menu_Resources_Release(false);
			ARX_Menu_Resources_Create();
			
			// TODO this is also in Interface.cpp

			ITC.Set("playerbook", "graph/interface/book/character_sheet/char_sheet_book");
			ITC.Set("ic_casting", "graph/interface/book/character_sheet/buttons_carac/icone_casting");
			ITC.Set("ic_close_combat", "graph/interface/book/character_sheet/buttons_carac/icone_close_combat");
			ITC.Set("ic_constitution", "graph/interface/book/character_sheet/buttons_carac/icone_constit");
			ITC.Set("ic_defense", "graph/interface/book/character_sheet/buttons_carac/icone_defense");
			ITC.Set("ic_dexterity", "graph/interface/book/character_sheet/buttons_carac/icone_dext");
			ITC.Set("ic_etheral_link", "graph/interface/book/character_sheet/buttons_carac/icone_etheral_link");
			ITC.Set("ic_mind", "graph/interface/book/character_sheet/buttons_carac/icone_intel");
			ITC.Set("ic_intuition", "graph/interface/book/character_sheet/buttons_carac/icone_intuition");
			ITC.Set("ic_mecanism", "graph/interface/book/character_sheet/buttons_carac/icone_mecanism");
			ITC.Set("ic_object_knowledge", "graph/interface/book/character_sheet/buttons_carac/icone_obj_knowledge");
			ITC.Set("ic_projectile", "graph/interface/book/character_sheet/buttons_carac/icone_projectile");
			ITC.Set("ic_stealth", "graph/interface/book/character_sheet/buttons_carac/icone_stealth");
			ITC.Set("ic_strength", "graph/interface/book/character_sheet/buttons_carac/icone_strenght");

			ITC.Set("questbook", "graph/interface/book/questbook");
			ITC.Set("ptexspellbook", "graph/interface/book/spellbook");
			ITC.Set("bookmark_char", "graph/interface/book/bookmark_char");
			ITC.Set("bookmark_magic", "graph/interface/book/bookmark_magic");
			ITC.Set("bookmark_map", "graph/interface/book/bookmark_map");
			ITC.Set("bookmark_quest", "graph/interface/book/bookmark_quest");

			ITC.Set("accessible_1", "graph/interface/book/accessible/accessible_1");
			ITC.Set("accessible_2", "graph/interface/book/accessible/accessible_2");
			ITC.Set("accessible_3", "graph/interface/book/accessible/accessible_3");
			ITC.Set("accessible_4", "graph/interface/book/accessible/accessible_4");
			ITC.Set("accessible_5", "graph/interface/book/accessible/accessible_5");
			ITC.Set("accessible_6", "graph/interface/book/accessible/accessible_6");
			ITC.Set("accessible_7", "graph/interface/book/accessible/accessible_7");
			ITC.Set("accessible_8", "graph/interface/book/accessible/accessible_8");
			ITC.Set("accessible_9", "graph/interface/book/accessible/accessible_9");
			ITC.Set("accessible_10", "graph/interface/book/accessible/accessible_10");
			ITC.Set("current_1", "graph/interface/book/current_page/current_1");
			ITC.Set("current_2", "graph/interface/book/current_page/current_2");
			ITC.Set("current_3", "graph/interface/book/current_page/current_3");
			ITC.Set("current_4", "graph/interface/book/current_page/current_4");
			ITC.Set("current_5", "graph/interface/book/current_page/current_5");
			ITC.Set("current_6", "graph/interface/book/current_page/current_6");
			ITC.Set("current_7", "graph/interface/book/current_page/current_7");
			ITC.Set("current_8", "graph/interface/book/current_page/current_8");
			ITC.Set("current_9", "graph/interface/book/current_page/current_9");
			ITC.Set("current_10", "graph/interface/book/current_page/current_10");

			ITC.Set("ptexcursorredist", "graph/interface/cursors/add_points");

			ITC.Level = getLocalised("system_charsheet_player_lvl");
			ITC.Xp = getLocalised("system_charsheet_player_xp");

			ANIM_Set(&player.bookAnimation[0], herowaitbook);
			player.bookAnimation[0].flags |= EA_LOOP;

			ARXOldTimeMenu = ARXTimeMenu = arxtime.get_updated();
			ARXDiffTimeMenu = 0;
		}

		GRenderer->SetRenderState(Renderer::Fog, false);
		GRenderer->SetRenderState(Renderer::AlphaBlending, false);

		if(ARXmenu.mda->BookBackground != NULL) {
			GRenderer->SetRenderState(Renderer::AlphaBlending, false);
			GRenderer->SetRenderState(Renderer::Fog, false);
			GRenderer->SetRenderState(Renderer::DepthWrite, false);
			GRenderer->SetRenderState(Renderer::DepthTest, false);

			EERIEDrawBitmap2(0, 0, static_cast<float>(g_size.width()), static_cast<float>(g_size.height()), 0.9f, ARXmenu.mda->BookBackground, Color::white);
		}

		BOOKZOOM = 1;

		ARX_INTERFACE_ManageOpenedBook();


		if(ARXmenu.mda) {
			long DONE = 0;

			if(player.Skill_Redistribute == 0 && player.Attribute_Redistribute == 0)
				DONE = 1;

			float ox, oy;
			ox = Xratio;
			oy = Yratio;
			LASTBOOKBUTTON = BOOKBUTTON;
			BOOKBUTTON = EERIEMouseButton;
			Xratio = ox;
			Yratio = oy;

			if(!ARXmenu.mda->flyover[FLYING_OVER].empty() ) //=ARXmenu.mda->flyover[FLYING_OVER];
			{
				if(FLYING_OVER != OLD_FLYING_OVER) {

					float fRandom = rnd() * 2;

					int t = checked_range_cast<int>(fRandom);

					pTextManage->Clear();
					OLD_FLYING_OVER = FLYING_OVER;
					UNICODE_ARXDrawTextCenteredScroll(hFontInGame,
						(g_size.width() * 0.5f),
						12,
						(g_size.center().x) * 0.82f,
						ARXmenu.mda->flyover[FLYING_OVER],
						Color(232 + t, 204 + t, 143 + t),
						1000,
						0.01f,
						2);
				}
			} else {
				OLD_FLYING_OVER = -1;
			}
			
			float fPosX = 0;
			float fPosY = 313 * Yratio + (g_size.height() - 313 * Yratio) * 0.70f;

			float fSizeX = 100 * Xratio;
			float fSizeY = 100 * Yratio;

			Color color = Color::none;

			//---------------------------------------------------------------------
			// Button QUICK GENERATION
			fPosX = (g_size.width() - (513 * Xratio)) * 0.5f;

			if(MouseInRect(fPosX, fPosY, fPosX + fSizeX + 50, fPosY + fSizeY)) {
				SpecialCursor = CURSOR_INTERACTION_ON;
				FLYING_OVER = BUTTON_QUICK_GENERATION;

				if (EERIEMouseButton & 1) ;
				else if ((!(EERIEMouseButton & 1)) && (LastMouseClick & 1))
				{
					QUICK_MOD++;
					int iSkin = player.skin;
					ARX_MENU_CLICKSOUND();

					if(bQuickGenFirstClick) {
						ARX_PLAYER_MakeAverageHero();
						bQuickGenFirstClick = false;
					} else {
						ARX_PLAYER_QuickGeneration();
					}

					player.skin = checked_range_cast<char>(iSkin);
				}

				color = Color(255, 255, 255);
			}
			else
				color = Color(232, 204, 143);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_quickgen, static_cast<long>(fPosX), static_cast<long>(fPosY), color);

			//---------------------------------------------------------------------
			// Button SKIN
			fPosX = g_size.width() * 0.5f;

			if(MouseInRect(fPosX, fPosY, fPosX + fSizeX, fPosY + fSizeY)) {
				SpecialCursor = CURSOR_INTERACTION_ON;
				FLYING_OVER = BUTTON_SKIN;

				if(!(EERIEMouseButton & 1) && (LastMouseClick & 1)) {
					SKIN_MOD++;
					BOOKZOOM = 1;
					ARX_MENU_CLICKSOUND();
					player.skin++;

					if(player.skin > 3)
						player.skin = 0;

					ARX_PLAYER_Restore_Skin();
				}

				color = Color(255, 255, 255);
			}
			else
				color = Color(232, 204, 143);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_skin, static_cast<long>(fPosX), static_cast<long>(fPosY), color);

			//---------------------------------------------------------------------
			// Button DONE
			fPosX = g_size.width() - (g_size.width() - 513 * Xratio) * 0.5f - 40 * Xratio;

			if(MouseInRect(fPosX, fPosY, fPosX + fSizeX, fPosY + fSizeY)) {
				if(DONE)
					SpecialCursor = CURSOR_INTERACTION_ON;

				FLYING_OVER = BUTTON_DONE;

				if(DONE && !(EERIEMouseButton & 1) && (LastMouseClick & 1)) {
					if(SKIN_MOD == 8 && QUICK_MOD == 10) {
						SKIN_MOD = -2;
					} else if(SKIN_MOD == -1) {
						ARX_PLAYER_MakeSpHero();
						player.skin = 4;
						ARX_PLAYER_Restore_Skin();
						SKIN_MOD = 0;
						SP_HEAD = 1;
					} else {
						if(SP_HEAD) {
							player.skin = 4;
							ARX_PLAYER_Restore_Skin();
							SP_HEAD = 0;
						}

						ARX_MENU_CLICKSOUND();

						bFadeInOut = true;		//fade out
						bFade = true;			//active le fade
						iFadeAction = AMCM_OFF;
					}
				} else {
					if(DONE)
						color = Color(255, 255, 255);
					else
						color = Color(192, 192, 192);
				}
			} else {
				if(DONE)
					color = Color(232, 204, 143);
				else
					color = Color(192, 192, 192);
			}

			if(SKIN_MOD < 0)
				color = Color(255, 0, 255);

			pTextManage->AddText(hFontMenu, ARXmenu.mda->str_button_done, static_cast<long>(fPosX), static_cast<long>(fPosY), color);
		}
	}

	DynLight[0].pos.x = 0.f + GInput->getMousePosAbs().x - (g_size.width() >> 1);
	DynLight[0].pos.y = 0.f + GInput->getMousePosAbs().y - (g_size.height() >> 1);

	if(pTextManage) {
		pTextManage->Update(framedelay);
		pTextManage->Render();
	}

	if(ARXmenu.currentmode != AMCM_CREDITS)
		ARX_INTERFACE_RenderCursor(1);

	if(ARXmenu.currentmode == AMCM_NEWQUEST) {
		if(ProcessFadeInOut(bFadeInOut, 0.1f)) {
			switch(iFadeAction) {
				case AMCM_OFF:
					arxtime.resume();
					ARX_MENU_NEW_QUEST_Clicked_QUIT();
					iFadeAction = -1;
					bFade = false;
					fFadeInOut = 0.f;

					if(pTextManage)
						pTextManage->Clear();

					break;
			}
		}
	}

	GRenderer->EndScene();
	return true;
}
Beispiel #9
0
void Credits::render() {
	
	//We initialize the datas
	InitCredits();
	
	int iSize = CreditsData.aCreditsInformations.size() ;
	
	//We display them
	if(CreditsData.iFontAverageHeight != -1) {
		
		GRenderer->SetRenderState(Renderer::AlphaBlending, false);
		GRenderer->SetRenderState(Renderer::Fog, false);
		GRenderer->SetRenderState(Renderer::DepthWrite, true);
		GRenderer->SetRenderState(Renderer::DepthTest, false);
		
		//Draw Background
		if(ARXmenu.mda->pTexCredits) {
			Rectf rect(Vec2f_ZERO, g_size.width(), g_size.height() + 1);
			
			EERIEDrawBitmap2(rect, .999f, ARXmenu.mda->pTexCredits, Color::white);
		}
		
		// Use time passed between frame to create scroll effect
		float time = arxtime.get_updated(false);
		float dtime = (float)(time - ARXmenu.mda->creditstart);
		ARXmenu.mda->creditspos -= 0.03f * g_sizeRatio.y * dtime;
		ARXmenu.mda->creditstart = time;
		
		std::vector<CreditsTextInformations>::const_iterator it = CreditsData.aCreditsInformations.begin() + CreditsData.iFirstLine ;
		for (; it != CreditsData.aCreditsInformations.end(); ++it)
		{
			//Update the Y word display
			float yy = it->sPos.y + ARXmenu.mda->creditspos;

			//Display the text only if he is on the viewport
			if ((yy >= -CreditsData.iFontAverageHeight) && (yy <= g_size.height())) 
			{
				hFontCredits->draw(it->sPos.x, static_cast<int>(yy), it->sText, it->fColors);
			}
			
			if (yy <= -CreditsData.iFontAverageHeight)
			{
				++CreditsData.iFirstLine;
			}
			
			if ( yy >= g_size.height() )
				break ; //it's useless to continue because next phrase will not be inside the viewport
		}
	} else {
		LogWarning << "Error initializing credits";
	}



	if(iSize <= CreditsData.iFirstLine && iFadeAction != AMCM_MAIN) {
		ARXmenu.mda->creditspos = 0;
		ARXmenu.mda->creditstart = 0 ;
		CreditsData.iFirstLine = 0 ;
		
		bFadeInOut = true;
		bFade = true;
		iFadeAction = AMCM_MAIN;
		
		ARX_MENU_LaunchAmb(AMB_MENU);
	}

	if(ProcessFadeInOut(bFadeInOut,0.1f) && iFadeAction == AMCM_MAIN) {
		ARXmenu.currentmode = AMCM_MAIN;
		iFadeAction = -1;
		bFadeInOut = false;
		bFade = true;
	}
	
	GRenderer->SetRenderState(Renderer::DepthWrite, true);
	GRenderer->SetRenderState(Renderer::DepthTest, true);
	
}