GLVis  v4.2
Accurate and flexible finite element visualization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
sdl_helper.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, Lawrence Livermore National Security, LLC. Produced
2 // at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3 // LICENSE and NOTICE for details. LLNL-CODE-443271.
4 //
5 // This file is part of the GLVis visualization tool and library. For more
6 // information and source code availability see https://glvis.org.
7 //
8 // GLVis is free software; you can redistribute it and/or modify it under the
9 // terms of the BSD-3 license. We welcome feedback and contributions, see file
10 // CONTRIBUTING.md for details.
11 
12 #ifndef GLVIS_SDL_HELPER_HPP
13 #define GLVIS_SDL_HELPER_HPP
14 
15 #include "gl/platform_gl.hpp"
16 #include <memory>
17 
19 {
20 public:
21  static std::unique_ptr<SdlNativePlatform> Create(SDL_Window* window);
22 
23  virtual ~SdlNativePlatform() = default;
24 
25  // Registers the window handle with this platform handler, in order to
26  // wait for events. This is needed for X11, which has one event pipe
27  // per window.
28  virtual void RegisterWindow(SDL_Window* window) { }
29  // Unregisters the window handle.
30  virtual void UnregisterWindow(SDL_Window* window) { }
31  // SDL_WaitEvent only polls for events and sleeps, instead of actually
32  // blocking. This method calls the system-native blocking event pump.
33  virtual void WaitEvent() = 0;
34  // This method sends a system-native event, which will wake the blocking
35  // event pump.
36  virtual void SendEvent() = 0;
37 };
38 
39 #endif
virtual ~SdlNativePlatform()=default
virtual void RegisterWindow(SDL_Window *window)
Definition: sdl_helper.hpp:28
virtual void UnregisterWindow(SDL_Window *window)
Definition: sdl_helper.hpp:30
static std::unique_ptr< SdlNativePlatform > Create(SDL_Window *window)
Definition: sdl_helper.cpp:29
virtual void WaitEvent()=0
virtual void SendEvent()=0