Bladeren bron

changed application.Create() parameters

leonsal 8 jaren geleden
bovenliggende
commit
0a01099381
1 gewijzigde bestanden met toevoegingen van 12 en 11 verwijderingen
  1. 12 11
      util/application/application.go

+ 12 - 11
util/application/application.go

@@ -54,12 +54,14 @@ type Application struct {
 
 // Options defines initial options passed to the application creation function
 type Options struct {
-	Height      int  // Initial window height (default is screen width)
-	Width       int  // Initial window width (default is screen height)
-	Fullscreen  bool // Window full screen flag (default = false)
-	LogLevel    int  // Initial log level (default = DEBUG)
-	EnableFlags bool // Enable command line flags (default = false)
-	TargetFPS   uint // Desired frames per second rate (default = 60)
+	Title       string // Initial window title
+	Height      int    // Initial window height (default is screen width)
+	Width       int    // Initial window width (default is screen height)
+	Fullscreen  bool   // Window full screen flag (default = false)
+	LogPrefix   string // Log prefix (default = "")
+	LogLevel    int    // Initial log level (default = DEBUG)
+	EnableFlags bool   // Enable command line flags (default = false)
+	TargetFPS   uint   // Desired frames per second rate (default = 60)
 }
 
 // OnBeforeRender is the event generated by Application just before rendering the scene/gui
@@ -71,10 +73,9 @@ const OnAfterRender = "util.application.OnAfterRender"
 // appInstance contains the pointer to the single Application instance
 var appInstance *Application
 
-// Create creates and returns the application object using the specified name for
-// the window title and log messages
+// Create creates and returns the application object using the specified options.
 // This function must be called only once.
-func Create(name string, ops Options) (*Application, error) {
+func Create(ops Options) (*Application, error) {
 
 	if appInstance != nil {
 		return nil, fmt.Errorf("Application already created")
@@ -112,7 +113,7 @@ func Create(name string, ops Options) (*Application, error) {
 	flag.Parse()
 
 	// Creates application logger
-	app.log = logger.New(name, nil)
+	app.log = logger.New(ops.LogPrefix, nil)
 	app.log.AddWriter(logger.NewConsole(false))
 	app.log.SetFormat(logger.FTIME | logger.FMICROS)
 	app.log.SetLevel(ops.LogLevel)
@@ -149,7 +150,7 @@ func Create(name string, ops Options) (*Application, error) {
 	}
 
 	// Creates window
-	win, err := app.wmgr.CreateWindow(swidth, sheight, name, *app.fullScreen)
+	win, err := app.wmgr.CreateWindow(swidth, sheight, ops.Title, *app.fullScreen)
 	if err != nil {
 		return nil, err
 	}