Exemplo n.º 1
0
func onStart(glctx gl.Context, u *uistate.UIState) {
	flag.Set("v23.credentials", "/sdcard/credentials")
	vlog.Log.Configure(vlog.OverridePriorConfiguration(true), vlog.LogToStderr(true))
	vlog.Log.Configure(vlog.OverridePriorConfiguration(true), vlog.Level(0))
	ctx, shutdown := v23.Init()
	u.Shutdown = shutdown
	u.Ctx = ctx
	u.Service = syncbase.NewService(util.MountPoint + "/croupier/" + util.SBName)
	namespace := v23.GetNamespace(u.Ctx)
	allAccess := access.AccessList{In: []security.BlessingPattern{"..."}}
	permissions := access.Permissions{
		"Admin":   allAccess,
		"Write":   allAccess,
		"Read":    allAccess,
		"Resolve": allAccess,
		"Debug":   allAccess,
	}
	namespace.SetPermissions(u.Ctx, util.MountPoint, permissions, "")
	namespace.SetPermissions(u.Ctx, util.MountPoint+"/croupier", permissions, "")
	u.Service.SetPermissions(u.Ctx, permissions, "")
	u.Images = glutil.NewImages(glctx)
	fps = debug.NewFPS(u.Images)
	u.Eng = glsprite.Engine(u.Images)
	u.Texs = texture.LoadTextures(u.Eng)
	u.CurTable = table.InitializeGame(u.NumPlayers, u.Texs)
	sound.InitPlayers(u)
	sync.CreateTables(u)
	// Create watch stream to update game state based on Syncbase updates
	go sync.UpdateSettings(u)
}
Exemplo n.º 2
0
func loggingOpts(env jutil.Env, jOpts jutil.Object) (dir vlog.LogDir, toStderr vlog.LogToStderr, level vlog.Level, vmodule vlog.ModuleSpec, err error) {
	var d string
	d, err = jutil.GetStringOption(env, jOpts, "io.v.v23.LOG_DIR")
	if err != nil {
		return
	}
	dir = vlog.LogDir(d)
	var s bool
	s, err = jutil.GetBooleanOption(env, jOpts, "io.v.v23.LOG_TO_STDERR")
	if err != nil {
		return
	}
	toStderr = vlog.LogToStderr(s)
	var l int
	l, err = jutil.GetIntOption(env, jOpts, "io.v.v23.LOG_VLEVEL")
	if err != nil {
		return
	}
	level = vlog.Level(l)
	var m string
	m, err = jutil.GetStringOption(env, jOpts, "io.v.v23.LOG_VMODULE")
	if err != nil {
		return
	}
	err = vmodule.Set(m)
	return
}
Exemplo n.º 3
0
func loggingOpts(logDir string, logToStderr bool, logLevel int, moduleSpec string) (dir vlog.LogDir, toStderr vlog.LogToStderr, level vlog.Level, vmodule vlog.ModuleSpec, err error) {
	dir = vlog.LogDir(logDir)
	toStderr = vlog.LogToStderr(logToStderr)
	level = vlog.Level(logLevel)
	err = vmodule.Set(moduleSpec)
	return
}