mirror of
				https://github.com/GayPizzaSpecifications/voxelotl-engine.git
				synced 2025-11-04 10:59:39 +00:00 
			
		
		
		
	make high dpi support a flag in applicationconfig
This commit is contained in:
		@ -23,10 +23,13 @@ public class Application {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Create SDL window
 | 
			
		||||
    var windowFlags = SDL_WindowFlags(SDL_WINDOW_HIGH_PIXEL_DENSITY)
 | 
			
		||||
    var windowFlags = SDL_WindowFlags(0)
 | 
			
		||||
    if (cfg.flags.contains(.resizable)) {
 | 
			
		||||
      windowFlags |= SDL_WindowFlags(SDL_WINDOW_RESIZABLE)
 | 
			
		||||
    }
 | 
			
		||||
    if (cfg.flags.contains(.highDPI)) {
 | 
			
		||||
      windowFlags |= SDL_WindowFlags(SDL_WINDOW_HIGH_PIXEL_DENSITY)
 | 
			
		||||
    }
 | 
			
		||||
    window = SDL_CreateWindow(cfg.title, cfg.width, cfg.height, windowFlags)
 | 
			
		||||
    guard window != nil else {
 | 
			
		||||
      print("SDL_CreateWindow() error: \(String(cString: SDL_GetError()))", to: &stderr)
 | 
			
		||||
@ -134,6 +137,7 @@ public struct ApplicationConfiguration {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    static let resizable = Flags(rawValue: 1 << 0)
 | 
			
		||||
    static let highDPI = Flags(rawValue: 1 << 1)
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public enum VSyncMode {
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,7 @@ let app = Application(
 | 
			
		||||
  width: 1280,
 | 
			
		||||
  height: 720,
 | 
			
		||||
  title: "Voxelotl Demo",
 | 
			
		||||
  flags: .resizable,
 | 
			
		||||
  flags: [ .resizable, .highDPI ],
 | 
			
		||||
  vsyncMode: .on(interval: 1)))
 | 
			
		||||
 | 
			
		||||
exit(app.run())
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user