Example #1
0
	//----------------------------------------------------------------------------//
	void Window::SetVisible(bool _visible)
	{
		if (_visible)
			SDL_ShowWindow(m_window);
		else
			SDL_HideWindow(m_window);
	}
Example #2
0
void RSScreen::Init(int32_t zoomFactor){
    this->scale =zoomFactor;
    
    int32_t width  = 320 * scale;
    int32_t height = 200 * scale;
    
    
    this->width = width;
    this->height = height;
    
    SDL_CreateWindowAndRenderer(width, height, SDL_WINDOW_HIDDEN, &sdlWindow, &sdlRenderer);
    
    
    if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_EVENTS) != 0) {
        printf("Unable to initialize SDL:  %s\n",SDL_GetError());
        return ;
    }
    
    sdlWindow = SDL_CreateWindow("RealSpace OBJ Viewer",SDL_WINDOWPOS_UNDEFINED,SDL_WINDOWPOS_UNDEFINED,this->width,this->height,SDL_WINDOW_OPENGL);
    
    // Create an OpenGL context associated with the window.
    SDL_GL_CreateContext(sdlWindow);
    
    
    glViewport(0,0,this->width,this->height);			// Reset The Current Viewport
    
    
    
	glClearColor(0.0f, 0.0f, 0.0f, 1.0f);				// Black Background

    glClear(GL_COLOR_BUFFER_BIT| GL_DEPTH_BUFFER_BIT);
    
    SDL_ShowWindow(sdlWindow);
}
void CSDL_setup::setWindowHidden(bool hidden)
{
	if (hidden == true)
		SDL_HideWindow(window);
	else
		SDL_ShowWindow(window);
}
Example #4
0
void AntSim::push_run(Fl_Widget *w, void *v)// Shows the graphical representation and runs through maxIteration iterations of the algorithm
{
    AntSim *caller = (AntSim*)v;

    SDL_ShowWindow(caller->windowGraphics);

    Controller *controller = (caller->controller);

    controller->iteration = 0;
    controller->totalTime = 0;
    controller->shortestKnownPath = INFINITY;

    controller->maxIterations = atoi(caller->inputIterations->value());

    bool maptype = MAPTYPE_TSP;

    if (caller->buttonMaze->value() == 1)
    {
        maptype = MAPTYPE_MAZE;
    }

    while(controller->iteration < controller->maxIterations)
    {
        controller->runIteration(maptype);
        caller->render();
        SDL_GL_SwapWindow(caller->windowGraphics);
    }

    controller->map->edges->reset();

    SDL_HideWindow(caller->windowGraphics);
}
Example #5
0
 void Window::show()
 {
     if(isLoaded())
         SDL_ShowWindow(win);
     removeInitFlags(HIDDEN);
     addInitFlags(SHOWN);
 }
Example #6
0
        void WindowSDL2::show() {

            closed = false;

            SDL_ShowWindow(window);

        } //WindowSDL2::show
Example #7
0
void Window::setVisible(bool visible) {
	lairAssert(isValid());
	if(visible)
		SDL_ShowWindow(_window);
	else
		SDL_HideWindow(_window);
}
Example #8
0
void ZWindow::ShowWindow(bool bShow)
{
	if (bShow)
		SDL_ShowWindow(m_win);
	else
		SDL_HideWindow(m_win);
}
Example #9
0
void iVim_showDebugWindow(bool shown)
{
if (shown)
    SDL_ShowWindow(gInfo);
else
    SDL_HideWindow(gInfo);
s_info_shown=shown;
}
Example #10
0
	void sdl_window::show(bool aActivate)
	{
#ifdef WIN32
		ShowWindow(static_cast<HWND>(native_handle()), aActivate ? SW_SHOW : SW_SHOWNA);
#else
		SDL_ShowWindow(iHandle);
#endif
	}
/** Native window should make itself visible */
void FLinuxWindow::Show()
{
	if ( !bIsVisible )
	{
		bIsVisible = true;
		SDL_ShowWindow( HWnd );
	}
}
Example #12
0
/**
 * @brief Window Creation and recreation.
 */
bool WindowManager::createWindow(bool fullScreen)
{
    // If Window Already Exists, destory so we can recreate it.
    if(m_window)
    {
        //std::cout << "Destroy SDL Window" << std::endl;
        SDL_DestroyWindow(m_window);
        m_window = nullptr;
    }

    int display_height = (m_height / 2);
    int display_width  = (m_width / 2);

    // create window in in full screen or windowed mode.
    if(fullScreen)
    {
        m_window = SDL_CreateWindow("EtherTerm 0.4.6 Alpha Demo - Full Screen",
                                    (m_position_placement % 2 == 0) ? SDL_WINDOWPOS_CENTERED : display_width,
                                    (m_position_placement % 2 == 0) ? SDL_WINDOWPOS_CENTERED : display_height,
                                    m_width,
                                    m_height,
                                    SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN_DESKTOP);

        if(!m_window) // window init success
        {
            SDL_Log("Terminal::restartWindowSize() SDL_CreateWindow globalWindow: %s",
                    SDL_GetError());
            assert(m_window);
        }
    }
    else
    {
        m_window = SDL_CreateWindow("EtherTerm 0.4.6 Alpha Demo - Windowed",
                                    (m_position_placement % 2 == 0) ? SDL_WINDOWPOS_CENTERED : display_width,
                                    (m_position_placement % 2 == 0) ? SDL_WINDOWPOS_CENTERED : display_height,
                                    m_width,
                                    m_height,
                                    SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE);
        if(!m_window) // window init success
        {
            SDL_Log("Terminal::restartWindowSize() SDL_CreateWindow globalWindow: %s",
                    SDL_GetError());
            assert(m_window);
        }
    }

    // Set the Window ID
    m_window_id = SDL_GetWindowID(m_window);

    std::string title = "EtherTerm 0.4.6 Alpha Demo w/ Multiple Windows - Window ID: ";
    title.append(std::to_string(m_window_id));
    SDL_SetWindowTitle(m_window, title.c_str());

    // Display and move focus to the new window.
    SDL_ShowWindow(m_window);
    SDL_RaiseWindow(m_window);
    return true;
}
Example #13
0
    void window::open()
    {
        if (is_open())
        {
            return;
        }

        SDL_ShowWindow(handle.get());
    }
Example #14
0
void UIInterface::showWindow()
{
    if (m_Hidden) {
        m_Hidden = false;
        SDL_ShowWindow(m_Win);

        APE_timer_setlowresolution(this->m_Gnet, 0);
    }
}
Example #15
0
void LWindow::focus() {
  //Restore window if needed
  if( !mShown ) {
    SDL_ShowWindow( mWindow );
  }

  //Move window forward
  SDL_RaiseWindow( mWindow );
}
Example #16
0
ATSAPI void ATSCALL
ats_context_set_visible(bool visible)
{
	context.visible = visible;
	if (visible) {
		SDL_ShowWindow(context.wnd);
	} else {
		SDL_HideWindow(context.wnd);
	}
}
Example #17
0
 void create_window()
 {
     destroy_window();
     uint32_t flags = 0;
     m_pWindow = SDL_CreateWindow("Waiting for 1st frame...",
                                 0, 25,
                                 m_windowSize.x, m_windowSize.y, flags);
     m_pWindowSurf = SDL_GetWindowSurface(m_pWindow);
     SDL_ShowWindow(m_pWindow);
 }
Example #18
0
bool PGE_Window::init(QString WindowTitle)
{
    // Enabling double buffer, setting up colors...
    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_DEPTH_SIZE,          16);
//  SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE,         32);
//  SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE,      0);
//  SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE,    0);
//  SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE,     0);
//  SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE,    0);
//  SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS,  1);
//  SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES,  2);
//  SDL_GL_SetAttribute(SDL_GL_RETAINED_BACKING, 0);
    //SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);

    SDL_GL_SetSwapInterval(0);
    checkSDLError();

    GlRenderer::setViewportSize(Width, Height);

    window = SDL_CreateWindow(WindowTitle.toStdString().c_str(), SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
                              Width, Height, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL);
    checkSDLError();

    SDL_SetWindowMinimumSize(window, Width, Height);
    SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");

    if(window == NULL)
    {
        // If failed to create window - exiting
        QMessageBox::critical(NULL, "SDL Error",
            QString("Unable to create window!\n%1")
            .arg( SDL_GetError() ), QMessageBox::Ok);
        return false;
    }

#ifdef Q_OS_MACX
    QImage icon(":/icon/cat_256.png");
#else
    QImage icon(":/icon/cat_16.png");
#endif
    SDL_SetWindowIcon(window, GraphicsHelps::QImage_toSDLSurface(icon));

    glcontext = SDL_GL_CreateContext(window); // Creating of the OpenGL Context
    checkSDLError();

    SDL_ShowWindow(window);

    IsInit=true;
    return true;
}
Example #19
0
static void
_cg_winsys_onscreen_set_visibility(cg_onscreen_t *onscreen,
                                   bool visibility)
{
    cg_onscreen_sdl2_t *sdl_onscreen = onscreen->winsys;

    if (visibility)
        SDL_ShowWindow(sdl_onscreen->window);
    else
        SDL_HideWindow(sdl_onscreen->window);
}
Example #20
0
static void
_cogl_winsys_onscreen_set_visibility (CoglOnscreen *onscreen,
                                      CoglBool visibility)
{
  CoglOnscreenSdl2 *sdl_onscreen = onscreen->winsys;

  if (visibility)
    SDL_ShowWindow (sdl_onscreen->window);
  else
    SDL_HideWindow (sdl_onscreen->window);
}
Example #21
0
void GameWindow::create(const std::string& title, size_t w, size_t h,
                        bool fullscreen) {
    Uint32 style = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN;
    if (fullscreen) style |= SDL_WINDOW_FULLSCREEN;

    SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK,
                        SDL_GL_CONTEXT_PROFILE_CORE);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
    SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);

    window = SDL_CreateWindow(title.c_str(), SDL_WINDOWPOS_CENTERED,
                              SDL_WINDOWPOS_CENTERED, static_cast<int>(w), static_cast<int>(h), style);
    if (window == nullptr) {
        // Window creation failure is fatal
        std::string sdlErrorStr = SDL_GetError();
        throw std::runtime_error("SDL_CreateWindow failed: " + sdlErrorStr);
    }
    glcontext = SDL_GL_CreateContext(window);
    if (glcontext == nullptr) {
        // context creation failure is fatal
        std::string sdlErrorStr = SDL_GetError();
        throw std::runtime_error("SDL_GL_CreateContext failed: " + sdlErrorStr);
    }

    // This part sets an embedded icon to the window
    // The source "image" is a 32-bit RGBA buffer exported from GIMP
    // The full name of the format is "GIMP RGBA C-Source image dump"
#include "WindowIcon.hpp"
    Uint32 rmask, gmask, bmask, amask;
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
    // Big Endian
    rmask = 0xff000000;
    gmask = 0x00ff0000;
    bmask = 0x0000ff00;
    amask = 0x000000ff;
#else
    // Little Endian
    rmask = 0x000000ff;
    gmask = 0x0000ff00;
    bmask = 0x00ff0000;
    amask = 0xff000000;
#endif
    icon = SDL_CreateRGBSurfaceFrom(
        static_cast<void*>(const_cast<unsigned char*>(windowIconData)),
        windowIconWidth, windowIconHeight, 32, windowIconWidth * (32 / 8),
        rmask, gmask, bmask, amask);
    SDL_SetWindowIcon(window, icon);

    SDL_ShowWindow(window);
}
/** Native windows should implement BringToFront by making this window the top-most window (i.e. focused).
 *
 * @param bForce	Forces the window to the top of the Z order, even if that means stealing focus from other windows
 *					In general do not pass true for this.  It is really only useful for some windows, like game windows where not forcing it to the front
 *					could cause mouse capture and mouse lock to happen but without the window visible
 */
void FLinuxWindow::BringToFront( bool bForce )
{
	// TODO Forces the the window to top of z order? Only that? SDL is using XMapRaised which changes the z order
	// so we do not steal focus here I guess.
	if(bForce)
	{
		SDL_RaiseWindow(HWnd);
	}
	else
	{
		SDL_ShowWindow(HWnd);
	}
}
Example #23
0
GHOST_IWindow *GHOST_SystemSDL::createWindow(const STR_String &title,
                                             GHOST_TInt32 left,
                                             GHOST_TInt32 top,
                                             GHOST_TUns32 width,
                                             GHOST_TUns32 height,
                                             GHOST_TWindowState state,
                                             GHOST_TDrawingContextType type,
                                             GHOST_GLSettings glSettings,
                                             const bool exclusive,
                                             const GHOST_TEmbedderWindowID parentWindow)
{
  GHOST_WindowSDL *window = NULL;

  window = new GHOST_WindowSDL(this,
                               title,
                               left,
                               top,
                               width,
                               height,
                               state,
                               parentWindow,
                               type,
                               ((glSettings.flags & GHOST_glStereoVisual) != 0),
                               exclusive);

  if (window) {
    if (GHOST_kWindowStateFullScreen == state) {
      SDL_Window *sdl_win = window->getSDLWindow();
      SDL_DisplayMode mode;

      static_cast<GHOST_DisplayManagerSDL *>(m_displayManager)->getCurrentDisplayModeSDL(mode);

      SDL_SetWindowDisplayMode(sdl_win, &mode);
      SDL_ShowWindow(sdl_win);
      SDL_SetWindowFullscreen(sdl_win, SDL_TRUE);
    }

    if (window->getValid()) {
      m_windowManager->addWindow(window);
      pushEvent(new GHOST_Event(getMilliSeconds(), GHOST_kEventWindowSize, window));
    }
    else {
      delete window;
      window = NULL;
    }
  }
  return window;
}
Example #24
0
bool GraphicsWindowSDL2::realizeImplementation()
{
    if(mRealized)
    {
        OSG_NOTICE<< "GraphicsWindowSDL2::realizeImplementation() Already realized" <<std::endl;
        return true;
    }

    if(!mValid) init();
    if(!mValid) return false;

    SDL_ShowWindow(mWindow);

    getEventQueue()->syncWindowRectangleWithGraphicsContext();

    mRealized = true;

    return true;
}
Example #25
0
void Debugger::run()
{
  //SDL_CaptureMouse(SDL_TRUE);
  // gotta call this once to initialize important stuffz
  main_window.check_paths_and_reload();
  main_window.one_time_draw();

  exp->draw();
  SDL_ShowWindow(sdlWindow);

  // exp is changed from BaseD
  while (!quitting)
  {
    exp->run();
    exp->draw();

    if (sub_window_experience)
    {
      sub_window_experience->run();
      sub_window_experience->draw();
    }
    
    handle_events();
    SDL_Delay( 1000 / 100 );
    
  }
  
  sub_window_experience = NULL;
  for (int i=0; i < NUM_WINDOWS; i++)
  {
    //window_map[i]->hide();
    // DO THIS because otherwise the hidden windows will blink
    // quickly on exit
    //window_map[i]->~Window();
  }

  if (!player->is_paused() && player->track_started)
  {
    player->fade_out(false);
    player->pause(1, false, false);
  }
}
CSDL_setup::CSDL_setup(bool* quit, int ScreenWidth, int ScreenHeight, bool bordered, bool initialyHidden)
{
	fpsRatio = 1;
	getScreenWidth = ScreenWidth;
	getScreenHeight = ScreenHeight;
	window = NULL;	if (bordered) 
		window = SDL_CreateWindow("Rainbow Mountain", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, ScreenWidth, ScreenHeight, SDL_WINDOW_HIDDEN);
	else
		window = SDL_CreateWindow("Rainbow Mountain", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, ScreenWidth, ScreenHeight, SDL_WINDOW_HIDDEN | SDL_WINDOW_BORDERLESS);
	if (!initialyHidden)
				SDL_ShowWindow(window);
	if (window == NULL)
	{
		std::cout << "Window couldn't be created" << std::endl;
		*quit = true;
	}
	renderer = NULL;
	renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
	mainEvent = new SDL_Event();
}
bool GraphicsWindowSDL2::realizeImplementation()
{
    if(mRealized)
    {
        OSG_NOTICE<< "GraphicsWindowSDL2::realizeImplementation() Already realized" <<std::endl;
        return true;
    }

    if(!mValid) init();
    if(!mValid) return false;

    SDL_ShowWindow(mWindow);

#if OSG_VERSION_GREATER_OR_EQUAL(3,3,4)
    getEventQueue()->syncWindowRectangleWithGraphicsContext();
#else
    getEventQueue()->syncWindowRectangleWithGraphcisContext();
#endif

    mRealized = true;

    return true;
}
Example #28
0
CommandResult
EmuWindow::
receiveCommand(CommandInput command)
{
    CommandResult result;

    switch (command.m_code) {
        case SHOW_WINDOW_COMMAND:
            {
                SDL_ShowWindow(m_sdl_window);
                result.m_code = CommandResult::ResultCode::OK;
            }
           break; 
        case HIDE_WINDOW_COMMAND:
           {
                SDL_HideWindow(m_sdl_window);
                result.m_code = CommandResult::ResultCode::OK;
           }
           break;
    }

    return result;
}
Example #29
0
int PL_Window_Init(void) {
    const char *windowTitle = s_windowTitle;
    if (windowTitle == NULL) {
        windowTitle = "DxPortLib App";
    }
    s_windowFlags |= 
        SDL_WINDOW_OPENGL |
        SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS;
    
    s_window = SDL_CreateWindow(
        windowTitle,
        SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
        PL_windowWidth, PL_windowHeight,
        s_windowFlags
        );
    
    if (s_windowIcon != NULL) {
        SDL_SetWindowIcon(s_window, s_windowIcon);
    }
    
    SDL_ShowWindow(s_window);
    
    SDL_DisableScreenSaver();
    
    PL_Draw_Init(s_window, PL_windowWidth, PL_windowHeight, s_windowVSync);
    
    s_windowRealWidth = 0;
    s_windowRealHeight = 0;
    
    s_initialized = DXTRUE;
    
    SDL_ShowCursor(s_mouseVisible);
    PL_Window_Refresh();
    
    return 0;
}
Example #30
0
qboolean VID_CreateWindow( int width, int height, qboolean fullscreen )
{
#ifdef XASH_SDL
	static string	wndname;
	Uint32 wndFlags = SDL_WINDOW_MOUSE_FOCUS | SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE;

	Q_strncpy( wndname, GI->title, sizeof( wndname ));

	host.hWnd = SDL_CreateWindow(wndname, r_xpos->integer,
		r_ypos->integer, width, height, wndFlags);

	if( !host.hWnd )
	{
		MsgDev( D_ERROR, "VID_CreateWindow: couldn't create '%s': %s\n", wndname, SDL_GetError());
		return false;
	}

	if( fullscreen )
	{
		SDL_DisplayMode want, got;

		want.w = width;
		want.h = height;
		want.driverdata = NULL;
		want.format = want.refresh_rate = 0; // don't care

		if( !SDL_GetClosestDisplayMode(0, &want, &got) )
			return false;

		MsgDev(D_NOTE, "Got closest display mode: %ix%i@%i\n", got.w, got.h, got.refresh_rate);

		if( SDL_SetWindowDisplayMode(host.hWnd, &got) == -1 )
			return false;

		if( SDL_SetWindowFullscreen(host.hWnd, SDL_WINDOW_FULLSCREEN) == -1 )
			return false;

	}

	host.window_center_x = width / 2;
	host.window_center_y = height / 2;

#if defined(_WIN32)
	{
		HICON ico;
		SDL_SysWMinfo info;

		if( FS_FileExists( GI->iconpath, true ) )
		{
			char	localPath[MAX_PATH];

			Q_snprintf( localPath, sizeof( localPath ), "%s/%s", GI->gamedir, GI->iconpath );
			ico = LoadImage( NULL, localPath, IMAGE_ICON, 0, 0, LR_LOADFROMFILE|LR_DEFAULTSIZE );

			if( !ico )
			{
				MsgDev( D_INFO, "Extract %s from pak if you want to see it.\n", GI->iconpath );
				ico = LoadIcon( host.hInst, MAKEINTRESOURCE( 101 ) );
			}
		}
		else ico = LoadIcon( host.hInst, MAKEINTRESOURCE( 101 ) );

		if( SDL_GetWindowWMInfo( host.hWnd, &info ) )
		{
			// info.info.info.info.info... Holy shit, SDL?
			SetClassLong( info.info.win.window, GCL_HICON, ico );
		}
	}
#endif

	SDL_ShowWindow( host.hWnd );
#else
	host.hWnd = 1; //fake window
	host.window_center_x = width / 2;
	host.window_center_y = height / 2;
#endif
	if( !glw_state.initialized )
	{
		if( !GL_CreateContext( ))
			return false;

		VID_StartupGamma();
	}
	else
	{
		if( !GL_UpdateContext( ))
			return false;		
	}
	return true;
}