本文整理汇总了C++中VideoPtr类的典型用法代码示例。如果您正苦于以下问题:C++ VideoPtr类的具体用法?C++ VideoPtr怎么用?C++ VideoPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VideoPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
VideoPtr video;
BaseApplicationPtr application = CreateBaseApplication();
if ((video = CreateVideo(480, 854, L"GS2D", true, true, L"assets/fonts/")))
{
InputPtr input = CreateInput(0, true);
AudioPtr audio = CreateAudio(0);
application->Start(video, input, audio);
Video::APP_STATUS status;
while ((status = video->HandleEvents()) != Video::APP_QUIT)
{
if (status == Video::APP_SKIP)
continue;
input->Update();
application->Update(Min(static_cast<unsigned long>(1000), ComputeElapsedTime(video)));
application->RenderFrame();
}
}
application->Destroy();
#ifdef _DEBUG
#ifdef WIN32
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif
#endif
return 0;
}
示例2: Start
void MedievalTorch::Start(VideoPtr video, InputPtr input, AudioPtr audio)
{
this->video = video;
this->input = input;
this->audio = audio;
m_props.ambient = Vector3(1,1,1);
Platform::FileManagerPtr fileManager = video->GetFileManager();
m_provider = ETHResourceProviderPtr(new ETHResourceProvider(
ETHGraphicResourceManagerPtr(new ETHGraphicResourceManager()),
ETHAudioResourceManagerPtr(new ETHAudioResourceManager()),
boost::shared_ptr<ETHShaderManager>(new ETHShaderManager(video, GS_L("assets/data/"))),
GS_L("assets/"), video, audio, input));
const Vector2 screenSize = video->GetScreenSizeF();
const float TARGET_WIDTH = 480/4;
const float TARGET_HEIGHT = 854/4;
if (pTorch)
pTorch->Release();
pTorch = new ETHRenderEntity(GS_L("assets/entities/medieval_torch.ent"), m_provider);
pTorch->SetOrphanPositionXY(Vector2(TARGET_WIDTH / 2.0f, TARGET_HEIGHT - (TARGET_HEIGHT / 10.0f)));
pTorch->ScaleParticleSystem(0, 1.6f);
pTorch->ScaleParticleSystem(0, screenSize.x / 480.0f / 4);
renderTarget = video->CreateRenderTarget(static_cast<unsigned int>(TARGET_WIDTH), static_cast<unsigned int>(TARGET_HEIGHT), GSTF_DEFAULT);
}
示例3: wmain
int wmain(int argc, gs2d::str_type::char_t* argv[])
#endif
{
Platform::FileManagerPtr fileManager(new Platform::StdFileManager());
Platform::FileIOHubPtr fileIOHub = Platform::CreateFileIOHub(fileManager, GS_L("data/"));
VideoPtr video;
if ((video = CreateVideo(1024, 768, GS_L("temp"), true, true, fileIOHub, Texture::PF_UNKNOWN, false)))
{
InputPtr input = CreateInput(0, false);
AudioPtr audio = CreateAudio(0);
Video::APP_STATUS status;
while ((status = video->HandleEvents()) != Video::APP_QUIT)
{
if (status == Video::APP_SKIP)
continue;
input->Update();
video->BeginSpriteScene();
video->EndSpriteScene();
}
}
return 0;
}
示例4: ComputeDrawHash
float ETHEntityRenderingManager::ComputeDrawHash(VideoPtr video, const float entityDepth, const ETHSpriteEntity* entity) const
{
static const float precisionScale = 100.0f;
float drawHash;
float verticalHashShift;
const float screenHeight = video->GetScreenSize().y * precisionScale;
const float hashDepth = entityDepth * screenHeight;
switch (entity->GetType())
{
case ETHEntityProperties::ET_HORIZONTAL:
drawHash = hashDepth;
break;
case ETHEntityProperties::ET_VERTICAL:
verticalHashShift = ((entity->GetPositionY() - video->GetCameraPos().y) * precisionScale) / screenHeight;
drawHash = hashDepth + verticalHashShift + 0.1f;
break;
case ETHEntityProperties::ET_GROUND_DECAL:
case ETHEntityProperties::ET_OPAQUE_DECAL:
drawHash = hashDepth + 0.1f;
break;
default:
drawHash = hashDepth;
}
return drawHash;
}
示例5: GS2D_UNUSED_ARGUMENT
bool ETHLineDrawer::Draw(const unsigned long lastFrameElapsedTimeMS)
{
GS2D_UNUSED_ARGUMENT(lastFrameElapsedTimeMS);
VideoPtr video = provider->GetVideo();
video->SetLineWidth(width);
return video->DrawLine(a, b, colorA, colorB);
}
示例6: GetInScreenOrigin
gs2d::math::Vector2 ETHParallaxManager::ComputeOffset(
const VideoPtr& video,
const Vector3 &pos,
const float& individualParallaxIntensity) const
{
const Vector2 screenSpacePos = Vector2(pos.x, pos.y) - video->GetCameraPos();
return ((screenSpacePos - GetInScreenOrigin(video)) / video->GetScreenSizeF().x) * pos.z * m_intensity * individualParallaxIntensity;
}
示例7: SetLightScissor
void ETHLight::SetLightScissor(const VideoPtr& video, const Vector2& zAxisDir) const
{
const float squareEdgeSize = range * 2.0f;
Vector2 sum(zAxisDir * pos.z * 2.0f);
sum.x = Abs(sum.x);
sum.y = Abs(sum.y);
const Vector2 squareSize(Vector2(squareEdgeSize, squareEdgeSize) + sum);
const Vector2 absPos(ETHGlobal::ToScreenPos(pos, zAxisDir) - video->GetCameraPos() - (squareSize * 0.5f));
video->SetScissor(Rect2D(absPos.ToVector2i(), squareSize.ToVector2i()));
}
示例8: DrawTab
bool EditorBase::DrawTab(VideoPtr video, InputPtr input, const Vector2 &v2Pos, const float width, const wstring &text, Color color)
{
video->SetAlphaMode(Video::AM_PIXEL);
video->SetVertexShader(ShaderPtr());
video->SetPixelShader(ShaderPtr());
video->SetZBuffer(false);
video->SetZWrite(false);
const Vector2 v2Cam = video->GetCameraPos();
video->SetCameraPos(Vector2(0,0));
bool mouseOver = false;
if (mouseOver = ETHGlobal::PointInRect(input->GetCursorPositionF(video), v2Pos+Vector2(width/2, m_menuSize), Vector2(width, m_menuSize)))
{
if (color.a < 200)
color.a = 200;
}
const Vector2 v2CurveSize = m_curve->GetBitmapSizeF();
const float rectWidth = width-v2CurveSize.x*2;
m_curve->FlipX();
m_curve->Draw(v2Pos, color);
const Vector2 v2RectPos = v2Pos+Vector2(v2CurveSize.x, 0);
video->DrawRectangle(v2RectPos, Vector2(rectWidth, m_menuSize*2), color);
m_curve->FlipX();
m_curve->Draw(v2Pos+Vector2(v2CurveSize.x+rectWidth, 0), color);
ShadowPrint(v2RectPos+Vector2(v2CurveSize.x, m_menuSize/2), text.c_str(), L"Verdana14_shadow.fnt", Color(color.a,255,255,255));
video->SetCameraPos(v2Cam);
return (mouseOver && input->GetKeyState(GSK_LMOUSE) == GSKS_HIT);
}
示例9: SetCameraPos
void ETHScriptWrapper::SetCameraPos(const Vector2 &v2Pos)
{
if (WarnIfRunsInMainFunction(GS_L("SetCameraPos")))
return;
// rounds up camera final position
VideoPtr video = m_provider->GetVideo();
video->RoundUpPosition(m_roundUpPosition);
video->SetCameraPos(v2Pos);
video->RoundUpPosition(false);
}
示例10: AddToCameraPos
void ETHScriptWrapper::AddToCameraPos(const Vector2 &v2Add)
{
if (WarnIfRunsInMainFunction(GS_L("AddToCameraPos")))
return;
// rounds up camera final position
VideoPtr video = m_provider->GetVideo();
video->RoundUpPosition(m_roundUpPosition);
video->MoveCamera(m_provider->GetGlobalScaleManager()->Scale(v2Add));
video->RoundUpPosition(false);
}
示例11: DrawInputFieldRect
void CustomDataEditor::DrawInputFieldRect(const Vector2 &v2Pos,
const GS_GUI *pGui,
EditorBase *pEditor,
const str_type::char_t *text) const
{
VideoPtr video = pEditor->GetVideoHandler();
const Vector2 v2BorderSize(5, 5);
const Vector2 v2FinalPos(v2Pos - v2BorderSize-Vector2(0, pGui->GetSize()));
const Vector2 v2Size(Vector2(pGui->GetWidth(), pGui->GetSize() * 2 + pEditor->GetMenuSize()) + v2BorderSize * 2);
const GSGUI_STYLE* style = pGui->GetGUIStyle();
video->DrawRectangle(v2FinalPos, v2Size, style->active_top, style->active_top, style->active_bottom, style->active_bottom);
pEditor->ShadowPrint(Vector2(v2FinalPos.x, v2FinalPos.y + v2Size.y - pEditor->GetMenuSize()), text, gs2d::constant::BLACK);
}
示例12: ComputeFakeEyePosition
Vector3 ETHFakeEyePositionManager::ComputeFakeEyePosition(
VideoPtr video, ShaderPtr pShader, const bool drawToTarget,
const Vector3 &v3LightPos, const float entityAngle)
{
const Vector2 &v2CamPos(video->GetCameraPos());
const Vector2 &v2ScreenDim(video->GetScreenSizeF());
Vector3 v3RelativeEyePos(0, v2ScreenDim.y*1.5f, GetFakeEyeHeight());
if (!drawToTarget)
v3RelativeEyePos.y -= v3LightPos.y-v2CamPos.y;
Matrix4x4 matRot = RotateZ(-DegreeToRadian(entityAngle));
v3RelativeEyePos = Multiply(v3RelativeEyePos, matRot);
//pShader->SetConstant(GS_L("fakeEyePos"), v3RelativeEyePos+Vector3(0, v2CamPos.y, 0)+Vector3(v3LightPos.x,0,0));
return v3RelativeEyePos+Vector3(0, v2CamPos.y, 0)+Vector3(v3LightPos.x,0,0);
}
示例13: Place
void GSGUI_STRING_INPUT::Place(const Vector2& pos, const str_type::string& font,
const float size, const Color& dwColor, VideoPtr video)
{
str_type::string outputString = ss;
video->DrawBitmapText(pos, outputString, font, dwColor);
SendCursorToEnd();
}
示例14: Place
void GSGUI_STRING_INPUT::Place(const Vector2 pos, const std::wstring font,
const float size, const GS_COLOR dwColor, VideoPtr video)
{
std::wstring outputString = ss;
video->DrawBitmapText(pos, outputString, font, dwColor);
SendCursorToEnd();
}
示例15: AddFile
SpritePtr ETHGraphicResourceManager::AddFile(VideoPtr video, const str_type::string &path, const bool cutOutBlackPixels)
{
str_type::string fileName = ETHGlobal::GetFileName(path);
{
SpritePtr sprite = FindSprite(path, fileName);
if (sprite)
return sprite;
}
SpritePtr pBitmap;
str_type::string fixedName(path);
Platform::FixSlashes(fixedName);
ETHSpriteDensityManager::DENSITY_LEVEL densityLevel;
const str_type::string finalFileName(m_densityManager.ChooseSpriteVersion(fixedName, video, densityLevel));
if (!(pBitmap = video->CreateSprite(finalFileName, (cutOutBlackPixels)? 0xFF000000 : 0xFFFF00FF)))
{
pBitmap.reset();
ETH_STREAM_DECL(ss) << GS_L("(Not loaded) ") << path;
ETHResourceProvider::Log(ss.str(), Platform::Logger::ERROR);
return SpritePtr();
}
m_densityManager.SetSpriteDensity(pBitmap, densityLevel);
//#ifdef _DEBUG
ETH_STREAM_DECL(ss) << GS_L("(Loaded) ") << fileName;
ETHResourceProvider::Log(ss.str(), Platform::Logger::INFO);
//#endif
m_resource.insert(std::pair<str_type::string, SpriteResource>(fileName, SpriteResource(fixedName, pBitmap)));
return pBitmap;
}