当前位置: 首页>>代码示例>>C++>>正文


C++ SDL_SetWindowPosition函数代码示例

本文整理汇总了C++中SDL_SetWindowPosition函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_SetWindowPosition函数的具体用法?C++ SDL_SetWindowPosition怎么用?C++ SDL_SetWindowPosition使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SDL_SetWindowPosition函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: changeFullscreenMode

		void changeFullscreenMode() override {
			if(fullscreenMode() == FullScreenMode::FULLSCREEN_EXCLUSIVE) {
				nonfs_width_ = width();
				nonfs_height_ = height();
				if(SDL_SetWindowFullscreen(window_.get(), SDL_WINDOW_FULLSCREEN) != 0) {
					LOG_WARN("Unable to set fullscreen mode at " << width() << " x " << height());
					return;
				}
			} else if(fullscreenMode() == FullScreenMode::FULLSCREEN_WINDOWED) {
				nonfs_width_ = width();
				nonfs_height_ = height();

				if(SDL_SetWindowFullscreen(window_.get(), SDL_WINDOW_FULLSCREEN_DESKTOP) != 0) {
					LOG_WARN("Unable to set windowed fullscreen mode at " << width() << " x " << height());
					return;
				}
				SDL_SetWindowSize(window_.get(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED);
				SDL_SetWindowPosition(window_.get(), 0, 0);

			} else {
				if(SDL_SetWindowFullscreen(window_.get(), 0) != 0) {
					LOG_WARN("Unable to set windowed mode at " << width() << " x " << height());
					return;
				}
				SDL_SetWindowSize(window_.get(), nonfs_width_, nonfs_height_);
				SDL_SetWindowPosition(window_.get(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
			}
			int w, h;
			SDL_GetWindowSize(window_.get(), &w, &h);
			// update viewport
			setViewPort(0, 0, w, h);
			// update width_ and height_ and notify observers
			updateDimensions(w, h);
		}
开发者ID:sweetkristas,项目名称:render_engine,代码行数:34,代码来源:WindowManager.cpp

示例2: CycleAround

/*
 * Shuffles the window around in a circle
 * PARAMS:
 *		iters: number of times to move in a full circle
 *		offset: pixel distance moved at each step
 *		delay: time between steps (not full circles)
 */
void CycleAround(int iters, int offset, int delay) {
	int x, y;
	SDL_GetWindowPosition(window, &x, &y);

	int cnt;
	for(cnt=0; cnt < iters; cnt++) {
		SDL_SetWindowPosition(window, x+offset, y); 	   SDL_Delay(delay);
		SDL_SetWindowPosition(window, x+offset, y+offset); SDL_Delay(delay);
		SDL_SetWindowPosition(window, x,        y+offset); SDL_Delay(delay);
		SDL_SetWindowPosition(window, x,        y);        SDL_Delay(delay);
	}
	EndDemo();
}
开发者ID:tbutts,项目名称:miniat-color-console-SDL,代码行数:20,代码来源:shaker.c

示例3: X11_ResizeWindowShape

int
X11_ResizeWindowShape(SDL_Window* window) {
    SDL_ShapeData* data = window->shaper->driverdata;
    SDL_assert(data != NULL);
    
    unsigned int bitmapsize = window->w / 8;
    if(window->w % 8 > 0)
        bitmapsize += 1;
    bitmapsize *= window->h;
    if(data->bitmapsize != bitmapsize || data->bitmap == NULL) {
        data->bitmapsize = bitmapsize;
        if(data->bitmap != NULL)
            free(data->bitmap);
        data->bitmap = malloc(data->bitmapsize);
        if(data->bitmap == NULL) {
            SDL_SetError("Could not allocate memory for shaped-window bitmap.");
            return -1;
        }
    }
    memset(data->bitmap,0,data->bitmapsize);
    
    window->shaper->userx = window->x;
    window->shaper->usery = window->y;
    SDL_SetWindowPosition(window,-1000,-1000);
    
    return 0;
}
开发者ID:0xD34D,项目名称:supermariowar-android,代码行数:27,代码来源:SDL_x11shape.c

示例4: Window_UpdateVideo

void Window_UpdateVideo(void)
{
	if (Video.msaa_samples != cv_video_msaasamples.iValue)
	{
		// TODO: Destroy window etc.

		Video.msaa_samples = cv_video_msaasamples.iValue;
	}

	SDL_SetWindowSize(sMainWindow, Video.iWidth, Video.iHeight);

	if (Video.vertical_sync != cv_video_verticlesync.bValue)
	{
		SDL_GL_SetSwapInterval(cv_video_verticlesync.iValue);

		Video.vertical_sync = cv_video_verticlesync.bValue;
	}

	if (Video.fullscreen != cv_video_fullscreen.bValue)
	{
		if (SDL_SetWindowFullscreen(sMainWindow, (SDL_bool)cv_video_fullscreen.bValue) == -1)
		{
			Con_Warning("Failed to set window mode!\n%s", SDL_GetError());

			// Reset the variable to the current value.
			Cvar_SetValue(cv_video_fullscreen.name, Video.fullscreen);
		}
		else
			Video.fullscreen = cv_video_fullscreen.bValue;
	}

	if (!cv_video_fullscreen.value)
		// Center the window, to ensure it's not off screen.
		SDL_SetWindowPosition(sMainWindow, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
}
开发者ID:ExperimentationBox,项目名称:Edenite,代码行数:35,代码来源:video_sdlwindow.c

示例5: SDL_SetWindowPosition

void Graphics::SetWindowPosition(const IntVector2& position)
{
    if (window_)
        SDL_SetWindowPosition(window_, position.x_, position.y_);
    else
        position_ = position; // Sets as initial position for OpenWindow()
}
开发者ID:TheComet93,项目名称:Urho3D,代码行数:7,代码来源:Graphics.cpp

示例6: DSDL_CALL

    void KGLWindow::setPosition(const KVector2I32 &Pos){
		if (_kwindow) {
			DSDL_CALL(SDL_SetWindowPosition(_kwindow, Pos.x, Pos.y));
			_kwinstate.xpos = Pos.x;
			_kwinstate.ypos = Pos.y;
		}
    }
开发者ID:MrMilad,项目名称:Kite2D,代码行数:7,代码来源:kglwindow.cpp

示例7: video_set_position

void video_set_position( const struct point *position )
{
	video_options.position = *position;
	if ( video_window != NULL ) {
		SDL_SetWindowPosition( video_window, position->x, position->y );
	}
}
开发者ID:Protovision,项目名称:moonbase,代码行数:7,代码来源:video.c

示例8: SDL_SetWindowPosition

 void SDL2WindowBackend::setPosition(int32_t x, int32_t y)
 {
     if(isOpen())
     {
         SDL_SetWindowPosition(mWindow, x, y);
     }
 }
开发者ID:eriser,项目名称:featherkit,代码行数:7,代码来源:sdl2windowbackend.cpp

示例9: SDL_SetWindowSize

void VR::orient_window(Game &game) const
{
    SDL_SetWindowSize(game.window(), m_hmd->Resolution.w, m_hmd->Resolution.h);
    SDL_SetWindowPosition(game.window(),
                          m_hmd->WindowsPos.x, m_hmd->WindowsPos.y);
    SDL_SetWindowFullscreen(game.window(), SDL_WINDOW_FULLSCREEN_DESKTOP);
}
开发者ID:nikki93,项目名称:thesis-2015,代码行数:7,代码来源:vr.cpp

示例10: checkf

/** Native windows should implement MoveWindowTo by relocating the platform-specific window to (X,Y). */
void FLinuxWindow::MoveWindowTo( int32 X, int32 Y )
{
	// we are passed coordinates of a client area, so account for decorations
	checkf(bValidNativePropertiesCache, TEXT("Attempted to use border sizes too early, native properties aren't yet cached. Review the flow"));

	SDL_SetWindowPosition( HWnd, X - LeftBorderWidth, Y - TopBorderHeight );
}
开发者ID:magetron,项目名称:UnrealEngine4-mod,代码行数:8,代码来源:LinuxWindow.cpp

示例11: SDL_SetWindowPosition

bool GraphicsWindowSDL2::setWindowRectangleImplementation(int x, int y, int width, int height)
{
    if(!mWindow) return false;

    SDL_SetWindowPosition(mWindow, x, y);
    SDL_SetWindowSize(mWindow, width, height);
    return true;
}
开发者ID:ChairGraveyard,项目名称:TES3MP,代码行数:8,代码来源:sdlgraphicswindow.cpp

示例12: getInfo

void Window::setPosition( int x, int y ) noexcept
{
    WindowInfo winfo;
    getInfo( winfo );

    if ( !winfo.wflags.fullscreen )
        SDL_SetWindowPosition( m_wimpl->window, x, y );

}
开发者ID:Gumichan01,项目名称:lunatix-engine,代码行数:9,代码来源:Window.cpp

示例13: SDL_SetWindowPosition

void SDLManager::setWindowPos(int x, int y){
	if(x != -1){	
		_windowSettings.windowPosX = x;
	}
	if(y != -1){
		_windowSettings.windowPosY = y;	
	}
	SDL_SetWindowPosition(_window,_windowSettings.windowPosX,_windowSettings.windowPosY);
}
开发者ID:MarcoPoloChina,项目名称:C-Engine,代码行数:9,代码来源:SDLManager.cpp

示例14: gutCenterWindow

bool gutCenterWindow(void) {
	chkwin;
	SDL_SetWindowPosition(
		gut.core->window.handle,
		SDL_WINDOWPOS_CENTERED,
		SDL_WINDOWPOS_CENTERED
	);
	return true;
}
开发者ID:FolkertVanVerseveld,项目名称:gut,代码行数:9,代码来源:gut.c

示例15: SDL_SetWindowPosition

void UIInterface::setWindowPosition(int x, int y)
{
    SDL_SetWindowPosition(this->m_Win, (x == NIDIUM_WINDOWPOS_UNDEFINED_MASK)
                                           ? SDL_WINDOWPOS_UNDEFINED_MASK
                                           : x,
                          (y == NIDIUM_WINDOWPOS_UNDEFINED_MASK)
                              ? SDL_WINDOWPOS_UNDEFINED_MASK
                              : y);
}
开发者ID:nidium,项目名称:Nidium,代码行数:9,代码来源:UIInterface.cpp


注:本文中的SDL_SetWindowPosition函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。