mirror of
				https://github.com/GayPizzaSpecifications/voxelotl-engine.git
				synced 2025-11-03 18:49:38 +00:00 
			
		
		
		
	use main.m and SDL_main functionality
This commit is contained in:
		@ -66,7 +66,10 @@ add_executable(Voxelotl MACOSX_BUNDLE
 | 
			
		||||
  GameDelegate.swift
 | 
			
		||||
  Application.swift
 | 
			
		||||
 | 
			
		||||
  main.swift)
 | 
			
		||||
  # Entry point
 | 
			
		||||
  Program.swift
 | 
			
		||||
  main.m
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
set_source_files_properties(
 | 
			
		||||
  shader.metal PROPERTIES
 | 
			
		||||
@ -103,7 +106,7 @@ set_source_files_properties(test.png PROPERTIES MACOSX_PACKAGE_LOCATION Resource
 | 
			
		||||
 | 
			
		||||
#TODO: should use TREE mode as documented in https://cmake.org/cmake/help/latest/command/source_group.html
 | 
			
		||||
source_group("Resources" FILES Assets.xcassets test.png)
 | 
			
		||||
source_group("Source Files" REGULAR_EXPRESSION "\\.(swift|metal)$")
 | 
			
		||||
source_group("Source Files" REGULAR_EXPRESSION "\\.(swift|metal|m)$")
 | 
			
		||||
source_group("Source Files\\Common" REGULAR_EXPRESSION "Common/")
 | 
			
		||||
source_group("Source Files\\Random" REGULAR_EXPRESSION "Random/")
 | 
			
		||||
source_group("Source Files\\Noise" REGULAR_EXPRESSION "Noise/")
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										17
									
								
								Sources/Voxelotl/Program.swift
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								Sources/Voxelotl/Program.swift
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
			
		||||
import Foundation
 | 
			
		||||
 | 
			
		||||
@objc public class Program: NSObject {
 | 
			
		||||
  @objc public static func run() -> Int32 {
 | 
			
		||||
    Thread.current.qualityOfService = .userInteractive
 | 
			
		||||
 | 
			
		||||
    let app = Application(
 | 
			
		||||
      delegate: Game(),
 | 
			
		||||
      configuration: ApplicationConfiguration(
 | 
			
		||||
      frame: Size(1280, 720),
 | 
			
		||||
      title: "Voxelotl Demo",
 | 
			
		||||
      flags: [ .resizable, .highDPI ],
 | 
			
		||||
      vsyncMode: .on(interval: 1)))
 | 
			
		||||
 | 
			
		||||
    return app.run()
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										6
									
								
								Sources/Voxelotl/main.m
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								Sources/Voxelotl/main.m
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
			
		||||
#include <SDL3/SDL_main.h>
 | 
			
		||||
#include <Voxelotl-Swift.h>
 | 
			
		||||
 | 
			
		||||
int main(int argc, char** argv) {
 | 
			
		||||
  return [Program run];
 | 
			
		||||
}
 | 
			
		||||
@ -1,13 +0,0 @@
 | 
			
		||||
import Foundation
 | 
			
		||||
 | 
			
		||||
Thread.current.qualityOfService = .userInteractive
 | 
			
		||||
 | 
			
		||||
let app = Application(
 | 
			
		||||
  delegate: Game(),
 | 
			
		||||
  configuration: ApplicationConfiguration(
 | 
			
		||||
  frame: Size(1280, 720),
 | 
			
		||||
  title: "Voxelotl Demo",
 | 
			
		||||
  flags: [ .resizable, .highDPI ],
 | 
			
		||||
  vsyncMode: .on(interval: 1)))
 | 
			
		||||
 | 
			
		||||
exit(app.run())
 | 
			
		||||
		Reference in New Issue
	
	Block a user