本文整理汇总了C++中VideoPtr类的典型用法代码示例。如果您正苦于以下问题:C++ VideoPtr类的具体用法?C++ VideoPtr怎么用?C++ VideoPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VideoPtr类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:andresan87,项目名称:Torch,代码行数:32,代码来源:main.cpp
示例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);
}
开发者ID:andresan87,项目名称:Torch,代码行数:29,代码来源:MedievalTorch.cpp
示例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;
}
开发者ID:DSPNerd,项目名称:ethanon,代码行数:26,代码来源:main.temp.cpp
示例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;
}
开发者ID:CeroOscura,项目名称:ethanon,代码行数:26,代码来源:ETHEntityRenderingManager.cpp
示例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);
}
开发者ID:angeltown,项目名称:ethanon,代码行数:7,代码来源:ETHDrawable.cpp
示例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;
}
开发者ID:angeltown,项目名称:ethanon,代码行数:8,代码来源:ETHParallaxManager.cpp
示例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()));
}
开发者ID:,项目名称:,代码行数:10,代码来源:
示例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);
}
开发者ID:,项目名称:,代码行数:32,代码来源:
示例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);
}
开发者ID:AlternatingCt,项目名称:ethanon,代码行数:11,代码来源:ETHScriptWrapper.Scene.cpp
示例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);
}
开发者ID:AlternatingCt,项目名称:ethanon,代码行数:11,代码来源:ETHScriptWrapper.Scene.cpp
示例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);
}
开发者ID:CeroOscura,项目名称:ethanon,代码行数:13,代码来源:CustomDataEditor.cpp
示例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);
}
开发者ID:andresan87,项目名称:Torch,代码行数:16,代码来源:ETHFakeEyePositionManager.cpp
示例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();
}
开发者ID:ArthurCalazans,项目名称:ethanon,代码行数:7,代码来源:gsgui.cpp
示例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();
}
开发者ID:AlternatingCt,项目名称:ethanon,代码行数:7,代码来源:gsgui.cpp
示例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;
}
开发者ID:nikki93,项目名称:ethanon,代码行数:33,代码来源:ETHResourceManager.cpp
示例16: Update
void PlayerManager::Update(VideoPtr video, InputPtr input, ShootManagerPtr shootManager, SpritePtr playerSprite, SpritePtr shootSprite)
{
static Vector2 hitPos, releasePos;
static int turn = 0;
if (input->GetTouchState(0) == GSKS_HIT)
{
if (IsInArea(GetAbsolutePos(input, video), Rect2Df(GetPlayer(turn)->GetPos(), playerSprite->GetRect().size), Vector2(0.5f, 0.5f), video))
{
hitPos = input->GetTouchPos(0, video);
}
else
{
hitPos = GS_NO_TOUCH;
}
}
if (input->GetTouchState(0) == GSKS_DOWN)
{
releasePos = hitPos - input->GetTouchPos(0, video);
}
if (input->GetTouchState(0) == GSKS_RELEASE && hitPos != GS_NO_TOUCH)
{
{
Vector2 pos = m_simulator->GetPosition(GetPlayer(turn)->GetBodyId());
shootManager->Shoot(pos, turn, releasePos);
turn = !turn;
}
}
if (hitPos == GS_NO_TOUCH)
{
video->MoveCamera(input->GetTouchMove(0) * -1);
}
}
开发者ID:abacha,项目名称:PhysicsSimulator,代码行数:32,代码来源:PlayerManager.cpp
示例17: SetFileNameToTitle
void EditorBase::SetFileNameToTitle(VideoPtr video, const wchar_t *wszTitle)
{
wstring newTitle, file;
file = utf8::c(GetCurrentFile(false)).wc_str();
newTitle = wszTitle;
newTitle += L" - ";
newTitle += file;
video->SetWindowTitle(newTitle);
}
开发者ID:,项目名称:,代码行数:9,代码来源:
示例18: IsSphereInScreen
bool IsSphereInScreen(const Vector3& pos, const float radius, const Vector2& zAxisDir, const VideoPtr& video)
{
const Vector2 v2Pos(ToScreenPos(pos, zAxisDir));
const Vector2& v2Cam = video->GetCameraPos();
const Vector2& v2Screen = video->GetScreenSizeF();
const float minX = v2Cam.x - radius;
const float maxX = v2Cam.x + v2Screen.x + radius;
const float minY = v2Cam.y - radius;
const float maxY = v2Cam.y + v2Screen.y + radius;
if (v2Pos.x < minX || v2Pos.x > maxX || v2Pos.y < minY || v2Pos.y > maxY)
{
return false;
}
else
{
return true;
}
}
开发者ID:,项目名称:,代码行数:18,代码来源:
示例19: DrawButton
void TouchButton::DrawButton(VideoPtr video, InputPtr input, SpriteResourceManager& spr)
{
SpritePtr sprite = spr.GetSprite(video, m_buttonSprite);
video->SetAlphaMode(GSAM_PIXEL);
if (sprite)
{
sprite->SetRect(m_buttonFrame);
sprite->SetOrigin(m_origin);
sprite->Draw(m_pos);
if (m_status == PRESSED)
{
video->SetAlphaMode(GSAM_ADD);
sprite->Draw(m_pos);
video->SetAlphaMode(GSAM_PIXEL);
}
}
}
开发者ID:andresan87,项目名称:trollpong42,代码行数:18,代码来源:TouchButton.cpp
示例20: Start
void ETHEngine::Start(VideoPtr video, InputPtr input, AudioPtr audio)
{
Platform::FileIOHubPtr fileIOHub = video->GetFileIOHub();
ETHAppEnmlFile file(fileIOHub->GetResourceDirectory() + ETH_APP_PROPERTIES_FILE, fileIOHub->GetFileManager(), video->GetPlatformName());
m_richLighting = file.IsRichLightingEnabled();
m_provider = ETHResourceProviderPtr(new ETHResourceProvider(
ETHGraphicResourceManagerPtr(new ETHGraphicResourceManager(file.GetDensityManager())),
ETHAudioResourceManagerPtr(new ETHAudioResourceManager()),
ETHShaderManagerPtr(new ETHShaderManager(video, fileIOHub->GetStartResourceDirectory() + ETHDirectories::GetShaderDirectory(), m_richLighting)),
video, audio, input, fileIOHub, false));
m_ethInput.SetProvider(m_provider);
CreateDynamicBackBuffer(file);
if (!m_pASEngine)
{
video->SetBGColor(gs2d::constant::BLACK);
if (!PrepareScriptingEngine(file.GetDefinedWords()))
{
Abort();
return;
}
if (m_compileAndRun)
{
if (!RunMainFunction(GetMainFunctionId()))
{
Abort();
return;
}
video->EnableQuitShortcuts(true);
m_v2LastCamPos = video->GetCameraPos();
}
}
else
{
video->SetBGColor(m_lastBGColor);
m_pScene->RecoverResources();
}
}
开发者ID:mattguest,项目名称:ethanon,代码行数:44,代码来源:ETHEngine.cpp
注:本文中的VideoPtr类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论