コード例 #1
0
int ScreenOutput::setScreenResolution(Resolution newScreenResolution)
{
	if(newScreenResolution.getWidth() > 0 && newScreenResolution.getHeight() > 0)
	{
		return resize(newScreenResolution, getAntiAliasingFactor());
	}
	return 0;
}
コード例 #2
0
int ScreenOutput::resize(Resolution newResolution, int newAntiAliasingFactor)
{
	screenResolution = newResolution;
	antiAliasingFactor = newAntiAliasingFactor;
	renderResolution.setWidth(newResolution.getWidth() * newAntiAliasingFactor);
	renderResolution.setHeight(newResolution.getHeight() * newAntiAliasingFactor);
	renderBuffer.resize(renderResolution.getWidth(), renderResolution.getHeight());
	screenBuffer.resize(screenResolution.getWidth(), screenResolution.getHeight());
	screenBMP->SetSize(screenResolution.getWidth(), screenResolution.getHeight());
	return 1;
}
コード例 #3
0
ファイル: SDLPlatform.cpp プロジェクト: irov/Mengine
    bool SDLPlatform::createWindow( uint32_t _icon, const Menge::WString & _projectTitle, const Resolution & _resolution, bool _fullscreen )
    {
        PARAM_UNUSED(_icon);
        PARAM_UNUSED(_fullscreen);

        Menge::Char utf8Title[1024] = { 0 };
        size_t utf8Size = 0;
        UNICODE_SERVICE( m_serviceProvider )->unicodeToUtf8(_projectTitle.c_str(), _projectTitle.size(),
                                                            utf8Title, sizeof(utf8Title) - 1, &utf8Size);

        SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
        SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
        SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
        SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
        SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
        SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);

        Uint32 windowFlags = SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN;
        if( _fullscreen )
        {
            windowFlags |= SDL_WINDOW_FULLSCREEN;
        }

        m_width = static_cast<int>(_resolution.getWidth());
        m_height = static_cast<int>(_resolution.getHeight());

        m_window = reinterpret_cast<WindowHandle>(SDL_CreateWindow(utf8Title,
                                                                   SDL_WINDOWPOS_CENTERED,
                                                                   SDL_WINDOWPOS_CENTERED,
                                                                   m_width, m_height,
                                                                   windowFlags));
        if( m_window == nullptr )
        {
            return false;
        }

        m_glContext = SDL_GL_CreateContext(reinterpret_cast<SDL_Window*>(m_window));

        if( m_glContext == nullptr )
        {
            SDL_DestroyWindow(reinterpret_cast<SDL_Window*>(m_window));
            return false;
        }

        m_sdlInput->updateSurfaceResolution(static_cast<float>(m_width),
                                            static_cast<float>(m_height));

        return true;
    }
コード例 #4
0
int ScreenOutput::initialize(Resolution initResolution, int initAntiAliasingFactor, TCanvas * initOutputCanvas)
{
	// temp!
	screenResolution = initResolution;
	antiAliasingFactor = initAntiAliasingFactor;
	renderResolution.setWidth(initResolution.getWidth() * initAntiAliasingFactor);
	renderResolution.setHeight(initResolution.getHeight() * initAntiAliasingFactor);
	renderBuffer.initialize(renderResolution.getWidth(), renderResolution.getHeight());
	currentForegroundRenderBuffer = &renderBuffer;
	screenBuffer.initialize(screenResolution.getWidth(), screenResolution.getHeight());
	screenBMP = new Graphics::TBitmap;
	screenBMP->PixelFormat = pf32bit;
	screenBMP->SetSize(screenResolution.getWidth(), screenResolution.getHeight());
	outputCanvas = initOutputCanvas;
	return 1;
}