mirror of
				https://github.com/GayPizzaSpecifications/voxelotl-engine.git
				synced 2025-11-04 02:59:37 +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
 | 
					    // Create SDL window
 | 
				
			||||||
    var windowFlags = SDL_WindowFlags(SDL_WINDOW_HIGH_PIXEL_DENSITY)
 | 
					    var windowFlags = SDL_WindowFlags(0)
 | 
				
			||||||
    if (cfg.flags.contains(.resizable)) {
 | 
					    if (cfg.flags.contains(.resizable)) {
 | 
				
			||||||
      windowFlags |= SDL_WindowFlags(SDL_WINDOW_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)
 | 
					    window = SDL_CreateWindow(cfg.title, cfg.width, cfg.height, windowFlags)
 | 
				
			||||||
    guard window != nil else {
 | 
					    guard window != nil else {
 | 
				
			||||||
      print("SDL_CreateWindow() error: \(String(cString: SDL_GetError()))", to: &stderr)
 | 
					      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 resizable = Flags(rawValue: 1 << 0)
 | 
				
			||||||
 | 
					    static let highDPI = Flags(rawValue: 1 << 1)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public enum VSyncMode {
 | 
					  public enum VSyncMode {
 | 
				
			||||||
 | 
				
			|||||||
@ -5,7 +5,7 @@ let app = Application(
 | 
				
			|||||||
  width: 1280,
 | 
					  width: 1280,
 | 
				
			||||||
  height: 720,
 | 
					  height: 720,
 | 
				
			||||||
  title: "Voxelotl Demo",
 | 
					  title: "Voxelotl Demo",
 | 
				
			||||||
  flags: .resizable,
 | 
					  flags: [ .resizable, .highDPI ],
 | 
				
			||||||
  vsyncMode: .on(interval: 1)))
 | 
					  vsyncMode: .on(interval: 1)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exit(app.run())
 | 
					exit(app.run())
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user