コード例 #1
0
ファイル: editor.cpp プロジェクト: Haryaalcar/vcmi-build
void
Editor::scroll_abs( double x, double y )
{
	DisplayEngine *engine = m_display.get_engine();
	video::HideMouse();
	engine->move_offset( V2( x, y ) );
	video::ShowMouse();
}
コード例 #2
0
ファイル: editor.cpp プロジェクト: Haryaalcar/vcmi-build
bool
Editor::on_mousemotion( SDL_Event &e )
{
	DisplayEngine *engine = m_display.get_engine();
	V2 worldpos = engine->to_world( V2( e.motion.x, e.motion.y ) );
	current_tool()->round_coordinates( &worldpos );
	m_cursor.move( worldpos );
	return true;
}
コード例 #3
0
ファイル: editor.cpp プロジェクト: Haryaalcar/vcmi-build
void
Editor::scroll( double xoff, double yoff )
{
	DisplayEngine *engine = m_display.get_engine();
	V2 newoffset = engine->get_offset() + V2( xoff, yoff );
	video::HideMouse();
	engine->move_offset( newoffset );
	video::ShowMouse();
}
コード例 #4
0
ファイル: Map.cpp プロジェクト: jotak/shahnarman
// -----------------------------------------------------------------
// Name : displayObjects
// -----------------------------------------------------------------
void Map::displayObjects(PlayerManager * pPlayerMngr)
{
    DisplayEngine * pDisplay = m_pTombGeometry->getDisplay();
    for (int x = 0; x < m_iWidth; x++)
    {
        for (int y = 0; y < m_iHeight; y++)
        {
            Coords3D pos3D = pDisplay->get3DCoords(CoordsMap(x, y), BOARDPLANE);
            MapObject * mapObj = m_pTiles[x][y]->getFirstMapObject(GOTYPE_TOWN);
            if (mapObj != NULL)
                mapObj->display();
            mapObj = m_pTiles[x][y]->getFirstMapObject(GOTYPE_TEMPLE);
            if (mapObj != NULL)
                mapObj->display();
            mapObj = m_pTiles[x][y]->getFirstMapObject(GOTYPE_DEAD_UNIT);
            if (mapObj != NULL)
                m_pTombGeometry->display(pos3D + Coords3D(0.6f, 0.1f), F_RGBA_NULL);
            mapObj = m_pTiles[x][y]->getFirstMapObject(GOTYPE_UNIT);
            if (mapObj != NULL)
            {
                mapObj->display();
                Player * pPlayer = pPlayerMngr->findPlayer(mapObj->getOwner());
                assert(pPlayer != NULL);
                pPlayer->m_pBannerGeometry->display(pos3D + Coords3D(0.7f, 0.0f), pPlayer->m_Color);
            }
            Player * pPlayer = pPlayerMngr->getActiveLocalPlayer();
            if (pPlayer != NULL)
            {
                if (m_pTiles[x][y]->m_pNbAlliesGeo != NULL)
                {
//          float fy = 0.31f;
                    if (m_pTiles[x][y]->m_pNbFoesGeo == NULL)
                    {
//            fy = 0.62f;
                        m_pCountUnitsBgGeometry1L->display(pos3D + Coords3D(-0.1f, 0.0f), F_RGBA_NULL);
                    }
                    else
                        m_pCountUnitsBgGeometry2L->display(pos3D + Coords3D(-0.1f, 0.0f), F_RGBA_NULL);
                    pPlayer->m_pBannerGeometry->display(pos3D + Coords3D(-0.1f, 0.0f), pPlayer->m_Color);
                    m_pTiles[x][y]->m_pNbAlliesGeo->display(pos3D + Coords3D(0.15f, 0.0f), F_RGBA_NULL);
                }
                if (m_pTiles[x][y]->m_pNbFoesGeo != NULL)
                {
                    float fy = 0.31f;
                    if (m_pTiles[x][y]->m_pNbAlliesGeo == NULL)
                    {
                        fy = 0.0f;
                        m_pCountUnitsBgGeometry1L->display(pos3D + Coords3D(-0.1f, 0.0f), F_RGBA_NULL);
                    }
                    m_pFoeBannerGeometry->display(pos3D + Coords3D(-0.1f, fy), rgb(0, 0, 0));
                    m_pTiles[x][y]->m_pNbFoesGeo->display(pos3D + Coords3D(0.15f, fy), F_RGBA_NULL);
                }
            }
        }
    }
}
コード例 #5
0
ファイル: editor.cpp プロジェクト: Haryaalcar/vcmi-build
bool
Editor::on_mousebutton( SDL_Event &e )
{
	DisplayEngine *engine = m_display.get_engine();
	V2 worldpos = engine->to_world( V2( e.motion.x, e.motion.y ) );

	if( Tool *tool = current_tool() ) {
		tool->on_mousebutton( e, worldpos );
	}
	return true;
}
コード例 #6
0
ファイル: MainCanvas.cpp プロジェクト: derric/libavg
void MainCanvas::renderTree()
{
    preRender();
    DisplayEngine* pDisplayEngine = getPlayer()->getDisplayEngine();
    unsigned numWindows = pDisplayEngine->getNumWindows();
    for (unsigned i=0; i<numWindows; ++i) {
        ScopeTimer Timer(RootRenderProfilingZone);
        WindowPtr pWindow = pDisplayEngine->getWindow(i);
        IntRect viewport = pWindow->getViewport();
        renderWindow(pWindow, MCFBOPtr(), viewport);
    }
    GLContextManager::get()->reset();
}
コード例 #7
0
ファイル: editor.cpp プロジェクト: Haryaalcar/vcmi-build
void Editor::update_cursor()
{
	// set proper position
	int mx;
	int my;
	SDL_GetMouseState( &mx, &my );
	DisplayEngine *engine = m_display.get_engine();
	V2 worldpos = engine->to_world( V2( mx, my ) );
	current_tool()->round_coordinates( &worldpos );
	m_cursor.move( worldpos );

	// set proper face
	set_cursor( current_tool()->current_object() );
}
コード例 #8
0
ファイル: Map.cpp プロジェクト: jotak/shahnarman
// -----------------------------------------------------------------
// Name : display
// -----------------------------------------------------------------
void Map::display()
{
    DisplayEngine * pDisplay = m_pEmptyMapGeometry->getDisplay();
    Coords3D pos3D = pDisplay->get3DCoords(CoordsMap(0, 0), BOARDPLANE);
    m_pEmptyMapGeometry->display(pos3D, F_RGBA_NULL);
    CoordsMap screenTL = pDisplay->getMapCoords(CoordsScreen(0, 0));
    CoordsMap screenBR = pDisplay->getMapCoords(CoordsScreen(pDisplay->getParameters()->screenXSize, pDisplay->getParameters()->screenYSize));
    screenTL.x = 0;//max(0, screenTL.x);
    screenTL.y = 0;//max(0, screenTL.y);
    screenBR.x = m_iWidth - 1;//min(m_iWidth - 1, screenBR.x);
    screenBR.y = m_iHeight - 1;//min(m_iHeight - 1, screenBR.y);
    for (int x = screenTL.x; x <= screenBR.x; x++)
    {
        for (int y = screenTL.y; y <= screenBR.y; y++)
            m_pTiles[x][y]->display(CoordsMap(x, y));
    }
}
コード例 #9
0
ファイル: VideoWriter.cpp プロジェクト: bluscr33n/libavg
VideoWriter::VideoWriter(CanvasPtr pCanvas, const string& sOutFileName, int frameRate,
        int qMin, int qMax, bool bSyncToPlayback)
    : m_pCanvas(pCanvas),
      m_sOutFileName(sOutFileName),
      m_FrameRate(frameRate),
      m_QMin(qMin),
      m_QMax(qMax),
      m_bHasValidData(false),
      m_bSyncToPlayback(bSyncToPlayback),
      m_bPaused(false),
      m_PauseTime(0),
      m_bStopped(false),
      m_CurFrame(0),
      m_StartTime(-1),
      m_bFramePending(false)
{
    if (!pCanvas) {
        throw Exception(AVG_ERR_INVALID_ARGS, "VideoWriter needs a canvas to write to.");
    }
    if (GLContext::getCurrent()->isGLES()) {
        throw Exception(AVG_ERR_UNSUPPORTED, "VideoWriter not supported under GLES.");
    }
#ifdef WIN32
    int fd = _open(m_sOutFileName.c_str(), O_RDWR | O_CREAT, _S_IREAD | _S_IWRITE);
#elif defined __linux__
    int fd = open64(m_sOutFileName.c_str(), O_RDWR | O_CREAT, S_IRWXU);
#else
    int fd = open(m_sOutFileName.c_str(), O_RDWR | O_CREAT, S_IRWXU);
#endif
    if (fd == -1) {
        throw Exception(AVG_ERR_VIDEO_INIT_FAILED, 
                string("Could not open output file '") + m_sOutFileName + "'. Reason: " +
                strerror(errno));
    }
#ifdef WIN32
    _close(fd);
#else
    close(fd);
#endif
    remove(m_sOutFileName.c_str());
    CanvasPtr pMainCanvas = Player::get()->getMainCanvas();
    DisplayEngine* pDisplayEngine = Player::get()->getDisplayEngine();
    if (pMainCanvas == m_pCanvas) {
        m_FrameSize = pDisplayEngine->getWindowSize();
    } else {
        m_FrameSize = m_pCanvas->getSize();
        GLContext* pOldContext = GLContext::getCurrent();
        m_pMainGLContext = pDisplayEngine->getWindow(0)->getGLContext();
        m_pMainGLContext->activate();
        m_pFBO = dynamic_pointer_cast<OffscreenCanvas>(m_pCanvas)->
                getFBO(m_pMainGLContext);
        if (GLContext::getCurrent()->useGPUYUVConversion()) {
            m_pFilter = GPURGB2YUVFilterPtr(new GPURGB2YUVFilter(m_FrameSize));
        }
        pOldContext->activate();
    }
    VideoWriterThread writer(m_CmdQueue, m_sOutFileName, m_FrameSize, m_FrameRate, 
            qMin, qMax);
    m_pThread = new boost::thread(writer);
    m_pCanvas->registerPlaybackEndListener(this);
    m_pCanvas->registerFrameEndListener(this);
}
コード例 #10
0
ファイル: editor.cpp プロジェクト: Haryaalcar/vcmi-build
EditorDisplay::EditorDisplay()
{
	DisplayEngine *engine = get_engine();
	engine->set_screen_area( video::GetInfo()->gamearea );
	engine->add_layer( new DL_Editor );
}