Пример #1
0
void GroupCell::RemoveOutput()
{
  DestroyOutput();
  ResetSize();
  m_output = NULL;
  m_lastInOutput = NULL;
  m_appendedCells = NULL;
  m_hide = false;
}
Пример #2
0
void GroupCell::RemoveOutput()
{
  DestroyOutput();
  ResetSize();
  m_height = GetEditable()->GetHeight();
  m_output = NULL;
  m_lastInOutput = NULL;
  m_appendedCells = NULL;
  m_hide = false;
}
Пример #3
0
void GroupCell::Hide(bool hide) {
  if (IsFoldable())
    return;

  if (m_hide == hide)
    return;

  m_hide = hide;
  if ((m_groupType == GC_TYPE_TEXT) || (m_groupType == GC_TYPE_CODE))
    GetEditable()->SetFirstLineOnly(m_hide);

  ResetSize();
  GetEditable()->ResetSize();
}
Пример #4
0
	SpriteString::SpriteString(D3DCore* core, const TCHAR* fontFile, Translator* translator)
		: vpitch{ 1 }
		, hpitch{ 1 }
		, charHeight{ -1 }
		, charWidth{ -1 }
		, autoFlush{ false } {
		std::unique_ptr<ImageData> imgdata{ ImageData::Load(fontFile) };
		if (!imgdata) {
			LOG_ERR("Failed to load font texture %s", fontFile);
		}
		else {
			LOG_INFO("font texture %s loaded. size = %dx%d\n", fontFile, imgdata->GetWidth(), imgdata->GetHeight());
		}
		texture.reset(new D3DTexture2D(core, imgdata.get()));

		effector.reset(new FontEffector(core, _T("Content\\System\\PS_Font.cso")));

		sprite.reset(new Sprite(texture.get(), nullptr, translator, effector.get()));

		SetColor(XMFLOAT4{ 0, 0, 0, 1 }, XMFLOAT4{ 1, 1, 1, 1 });

		ResetSize();
	}
Пример #5
0
void GroupCell::Hide(bool hide) {
  if (IsFoldable())
    return;

  if (m_hide == hide)
    return;
  else
  {
    if (m_hide == false) {
      if ((m_groupType == GC_TYPE_TEXT) || (m_groupType == GC_TYPE_CODE))
        GetEditable()->SetFirstLineOnly(true);
      m_hide = true;
    }
    else {
      if ((m_groupType == GC_TYPE_TEXT) || (m_groupType == GC_TYPE_CODE))
        GetEditable()->SetFirstLineOnly(false);
      m_hide = false;
    }

    ResetSize();
    GetEditable()->ResetSize();
  }
}
Пример #6
0
	void DirectShowMovieTexture::loadMovie(
		const Ogre::String& moviePath, bool horizontalMirroring)
	{
		HRESULT hr;

		// log it!
		Ogre::LogManager::getSingletonPtr()->logMessage(
			Ogre::String("[DSHOW] Loading movie named '")+
			moviePath+"'.");

		// destroy previous movie objects (if any)
		unloadMovie();

		// create filter graph and get interfaces
		hr=CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
			IID_IGraphBuilder, (void**) &dsdata->pGraph);
		if (FAILED(hr)) throw("[DSHOW] Error in creating graph");

		hr=dsdata->pGraph->QueryInterface(IID_IMediaControl, (void**) & dsdata->pControl);
		if (FAILED(hr)) throw("[DSHOW] Error in querying media control");

		hr=dsdata->pGraph->QueryInterface(IID_IMediaEvent, (void**) & dsdata->pEvent);
		if (FAILED(hr)) throw("[DSHOW] Error in querying media event");

		hr=dsdata->pGraph->QueryInterface(IID_IMediaSeeking, (void**) & dsdata->pSeeking);
		if (FAILED(hr)) throw("[DSHOW] Error in querying seeking interface");

		// create sample grabber
		hr=CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER,
			IID_IBaseFilter, (void**)&dsdata->pGrabberF);
		if (FAILED(hr)) throw("[DSHOW] Error in creating sample grabber");

		// add sample grabber to the graph
		hr=dsdata->pGraph->AddFilter(dsdata->pGrabberF, L"Sample Grabber");
		if (FAILED(hr)) throw("[DSHOW] Error in adding sample grabber to the graph");

		// get sample grabber object
		dsdata->pGrabberF->QueryInterface(IID_ISampleGrabber,
			(void**)&dsdata->pGrabber);

		// set sample grabber media type
		AM_MEDIA_TYPE mt;
		ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE));
		mt.majortype = MEDIATYPE_Video;
		mt.subtype = MEDIASUBTYPE_RGB24;
		mt.formattype = FORMAT_VideoInfo;
		hr=dsdata->pGrabber->SetMediaType(&mt);
		if (FAILED(hr)) throw("[DSHOW] Error in setting sample grabber media type");

		// open the file!
		WCHAR* filepath=util_convertCStringToWString(moviePath.c_str());
		hr=dsdata->pGraph->RenderFile(L"C:\Users\Harry\Desktop\Ogre_Framework\bin\welcome.avi", NULL);
		if (FAILED(hr)) throw("[DSHOW] Error opening video file!");

		// disable auto show
		// (wouldn't be needed if we used the null renderer)
		hr=dsdata->pGraph->QueryInterface(IID_IVideoWindow, (void**) & dsdata->pWindow);
		if (FAILED(hr)) throw("[DSHOW] Error getting video window interface");
		dsdata->pWindow->put_AutoShow(OAFALSE);

		// get video information
		AM_MEDIA_TYPE mtt;
		hr=dsdata->pGrabber->GetConnectedMediaType(&mtt);

		if (FAILED(hr)) throw("[DSHOW] Error getting connected media type info");

		VIDEOINFOHEADER *vih = (VIDEOINFOHEADER*) mtt.pbFormat;
		dsdata->videoWidth=vih->bmiHeader.biWidth;
		dsdata->videoHeight=vih->bmiHeader.biHeight;


		ResetSize(dsdata->videoWidth,dsdata->videoHeight);
		//纹理的创建现在修改到了这里,原来在构造函数中
		//放在这里可以根据视频的大小来生成纹理的大小
		//这样可以让视频完全平铺到面片上
		mTexture=Ogre::TextureManager::getSingleton().createManual(
			"DirectShowManualTexture",// name
			Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
			Ogre::TEX_TYPE_2D,// texture type
			mTexWidth,
			mTexHeight,
			0,// number of mipmaps
			Ogre::PF_BYTE_BGRA,// pixel format
			Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE// usage
			);

		// microsoft's help version of free media type
		if (mtt.cbFormat != 0)
		{
			CoTaskMemFree((PVOID)mtt.pbFormat);
			mtt.cbFormat = 0;
			mtt.pbFormat = NULL;
		}
		if (mtt.pUnk != NULL)
		{
			mtt.pUnk->Release();
			mtt.pUnk = NULL;
		}

		// log it
		Ogre::LogManager::getSingletonPtr()->logMessage(
			Ogre::String("[DSHOW] -> This movie has dimensions: ")+
			Ogre::StringConverter::toString(dsdata->videoWidth)+"x"+
			Ogre::StringConverter::toString(dsdata->videoHeight)+".");


		// set sampling options
		dsdata->pGrabber->SetOneShot(FALSE);
		dsdata->pGrabber->SetBufferSamples(TRUE);

		// set some basic data
		mHorizontalMirroring=horizontalMirroring;

		// clean the texture, so that it's ready for rendering this video
		cleanTextureContents();
	}
Пример #7
0
// looks a lot like Dave's :-)
bool GLPort::Initialize()
{
    PIXELFORMATDESCRIPTOR pfd;
    int npf;

    // need the DC later
    HDC dc = GetDC(MainForm->pnlView->Handle);

    // this is what we want who knows what we get
    memset(&pfd, 0, sizeof pfd);
    pfd.nSize      = sizeof pfd;
    pfd.nVersion   = 1;
    pfd.dwFlags    = /*PFD_SUPPORT_GDI|*/PFD_SUPPORT_OPENGL|
                                         PFD_DOUBLEBUFFER|PFD_DRAW_TO_WINDOW;
    pfd.iPixelType = PFD_TYPE_RGBA;
    pfd.cColorBits = 32;
    pfd.cDepthBits = 16;
    pfd.iLayerType = PFD_MAIN_PLANE;

    // set the pixel format for the window
    npf = ChoosePixelFormat(dc, &pfd);
    SetPixelFormat(dc, npf, &pfd);
    DescribePixelFormat(dc, npf, sizeof pfd, &pfd);
    if (pfd.dwFlags & PFD_NEED_PALETTE)
    {
        ErrorMsg("Segeltuch does not yet support 8-bit video modes.\n\n"
                 "Please increase your video depth to atleast 16-bit.");
        //return false;
        //for now, we allow the program to continue even though the
        //display will be very ugly....
    }
    if (!(pfd.dwFlags & PFD_DOUBLEBUFFER))
    {
        ErrorMsg("No available double buffering support.");
    }
    InfoMsg("Found graphics card with %d-bits of color resolution and a %d-bit depth buffer.",
            pfd.cColorBits, pfd.cDepthBits);

    // create the OpenGL interface
    hRC = wglCreateContext(dc);
    if (hRC == NULL)
    {
        ErrorBox("Unable to create OpenGL renderring context.");
        return false;
    }

    // start her up
    Activate();
    ResetCamera();

    // no more
    MainForm->pnlView->EraseBack = false;
    // Clear the screen initially
    glClearColor(ColBck.r, ColBck.g, ColBck.b, ColBck.a);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    SwapBuffers(dc);

    // setup the new window
    ResetSize(false);

    // Our options
    glEnable(GL_DEPTH_TEST);
    glEnable(GL_CULL_FACE);
    glFrontFace(GL_CCW);
    glAlphaFunc(GL_GREATER, 0.5);
    glDisable(GL_ALPHA_TEST);

    // Utility Object
    qobj = gluNewQuadric();

    // clean up our stuff
    Deactivate();

    return (Created=true);
}