本文整理汇总了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);
}
示例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();
}
示例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;
}
示例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);
}
示例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()
}
示例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;
}
}
示例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 );
}
}
示例8: SDL_SetWindowPosition
void SDL2WindowBackend::setPosition(int32_t x, int32_t y)
{
if(isOpen())
{
SDL_SetWindowPosition(mWindow, x, y);
}
}
示例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);
}
示例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 );
}
示例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;
}
示例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 );
}
示例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);
}
示例14: gutCenterWindow
bool gutCenterWindow(void) {
chkwin;
SDL_SetWindowPosition(
gut.core->window.handle,
SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED
);
return true;
}
示例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);
}