// Setup is called before the main loop is started
506950
func (*DefaultScene) Setup(u engo.Updater) {
	w, _ := u.(*ecs.World)

	common.SetBackground(color.White)
	w.AddSystem(&common.RenderSystem{})

	// Adding KeyboardScroller so we can actually see the difference between background and HUD when scrolling
	w.AddSystem(common.NewKeyboardScroller(scrollSpeed, engo.DefaultHorizontalAxis, engo.DefaultVerticalAxis))
	w.AddSystem(&common.MouseZoomer{zoomSpeed})

	// Create background, so we can see difference between this and HUD
	demoutils.NewBackground(w, worldWidth, worldHeight, color.RGBA{102, 153, 0, 255}, color.RGBA{102, 173, 0, 255})

	// Define parameters for the hud
	hudWidth := 200                       // Can be anything you want
	hudHeight := int(engo.WindowHeight()) // Can be anything you want

	// Generate something that uses the PriorityLevel HUDGround or up. We're giving the same color twice,
	// so it'll create one solid color.
	hudBg := demoutils.NewBackground(w, hudWidth, hudHeight, color.RGBA{255, 0, 255, 180}, color.RGBA{255, 0, 255, 180})

	// These adjustments are needed to transform it into a HUD:
	hudBg.RenderComponent.SetZIndex(1) // something bigger than default (0), so it'll be on top of the regular background
	hudBg.RenderComponent.SetShader(common.HUDShader)
}
840107
func Setup(c config.Config) error {
	disableADR = c.NetworkServer.NetworkSettings.DisableADR
	installationMargin = c.NetworkServer.NetworkSettings.InstallationMargin

	return nil
}
550468
func (gm *serverMethod) setup(apiDef *raml.APIDefinition, r *raml.Resource, rd *resource.Resource, methodName string) error {
	gm.MethodName = strings.Title(serverMethodName(gm.Endpoint, gm.DisplayName, methodName, rd.Name))

	// setting middlewares
	middlewares := []string{}

	// security middlewares
	for _, v := range gm.SecuredBy {
		if !security.ValidateScheme(v.Name, apiDef) {
			continue
		}
		// oauth2 middleware
		m, err := getOauth2MwrHandler(v)
		if err != nil {
			return err
		}
		middlewares = append(middlewares, m)
	}

	gm.Middlewares = strings.Join(middlewares, ", ")

	return nil
}
752985
func (msp *bccspmsp) Setup(conf1 *m.MSPConfig) error {
	if conf1 == nil {
		return errors.New("Setup error: nil conf reference")
	}

	// given that it's an msp of type fabric, extract the MSPConfig instance
	conf := &m.FabricMSPConfig{}
	err := proto.Unmarshal(conf1.Config, conf)
	if err != nil {
		return errors.Wrap(err, "failed unmarshalling fabric msp config")
	}

	// set the name for this msp
	msp.name = conf.Name
	mspLogger.Debugf("Setting up MSP instance %s", msp.name)

	// setup
	return msp.internalSetupFunc(conf)
}
11868
func (r *redisRequester) Setup() error {
	conn, err := redis.Dial("tcp", r.url)
	if err != nil {
		return err
	}
	r.conn = conn
	return nil
}
975195
func setup(c *caddy.Controller) error {
	cfg := httpserver.GetConfig(c)
	root := cfg.Root

	exts, err := extParse(c)
	if err != nil {
		return err
	}

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return Ext{
			Next:       next,
			Extensions: exts,
			Root:       root,
		}
	})

	return nil
}
1311758
func (m *FileSource) Setup(ss *schema.Schema) error {
	m.ss = ss
	if err := m.init(); err != nil {
		return err
	}
	if m.lastLoad.Before(time.Now().Add(-schemaRefreshInterval)) {
		m.lastLoad = time.Now()
	}
	m.partitionCt = uint64(m.ss.Conf.PartitionCt)

	m.partitionFunc = SipPartitioner
	return nil
}
354359
func (j *JSON) Setup() error {
	r, err := j.gen()
	if err != nil {
		return err
	}

	dec := json.NewDecoder(r)
	j.values = make(map[string]interface{})

	return dec.Decode(&j.values)
}
571922
func setup(c *caddy.Controller) error {
	rules, err := templatesParse(c)
	if err != nil {
		return err
	}

	cfg := httpserver.GetConfig(c)

	tmpls := Templates{
		Rules:   rules,
		Root:    cfg.Root,
		FileSys: http.Dir(cfg.Root),
	}

	cfg.AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		tmpls.Next = next
		return tmpls
	})

	return nil
}
1020410
func (m *JobExecutor) Setup() error {
	if m == nil {
		return fmt.Errorf("JobExecutor is nil?")
	}
	if m.RootTask == nil {
		return fmt.Errorf("No task exists for this job")
	}
	return m.RootTask.Setup(0)
}
477002
func setup(c *caddy.Controller) error {
	configs, err := browseParse(c)
	if err != nil {
		return err
	}

	b := Browse{
		Configs:       configs,
		IgnoreIndexes: false,
	}

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		b.Next = next
		return b
	})

	return nil
}
685849
func Setup(opts r.ConnectOpts) error {
	// Initialize a new setup connection
	ss, err := r.Connect(opts)
	if err != nil {
		return err
	}

	// Create databases
	for _, d := range databaseNames {
		r.DBCreate(d).Exec(ss)

		r.DB(d).TableCreate("accounts").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("name").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("alt_email").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("type").Exec(ss)
		r.DB(d).Table("accounts").IndexCreate("status").Exec(ss)

		r.DB(d).TableCreate("addresses").Exec(ss)
		r.DB(d).Table("addresses").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("addresses").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("addresses").IndexCreate("date_modified").Exec(ss)

		r.DB(d).TableCreate("contacts").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("name").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("contacts").IndexCreate("date_modified").Exec(ss)

		r.DB(d).TableCreate("emails").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("thread").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("kind").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("from").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("message_id").Exec(ss)
		r.DB(d).Table("emails").IndexCreate("to", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("emails").IndexCreate("cc", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("emails").IndexCreate("bcc", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("emails").IndexCreateFunc("messageIDOwner", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("message_id"),
				row.Field("owner"),
			}
		}).Exec(ss)
		r.DB(d).Table("emails").IndexCreateFunc("threadStatus", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("thread"),
				row.Field("status"),
			}
		}).Exec(ss)

		r.DB(d).TableCreate("files").Exec(ss)
		r.DB(d).Table("files").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("files").IndexCreate("name").Exec(ss)
		r.DB(d).Table("files").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("files").IndexCreate("date_modified").Exec(ss)

		r.DB(d).TableCreate("keys").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("keys").IndexCreate("key_id").Exec(ss)

		r.DB(d).TableCreate("labels").Exec(ss)
		r.DB(d).Table("labels").IndexCreate("name").Exec(ss)
		r.DB(d).Table("labels").IndexCreate("builtin").Exec(ss)
		r.DB(d).Table("labels").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("labels").IndexCreateFunc("nameOwnerBuiltin", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("name"),
				row.Field("owner"),
				row.Field("builtin"),
			}
		}).Exec(ss)

		r.DB(d).TableCreate("threads").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("name").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("emails", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("threads").IndexCreate("labels", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("threads").IndexCreate("members", r.IndexCreateOpts{Multi: true}).Exec(ss)
		r.DB(d).Table("threads").IndexCreate("subject_hash").Exec(ss)
		r.DB(d).Table("threads").IndexCreate("secure").Exec(ss)
		r.DB(d).Table("threads").IndexCreateFunc("subjectOwner", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("subject_hash"),
				row.Field("owner"),
			}
		}).Exec(ss)

		r.DB(d).TableCreate("tokens").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("name").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("owner").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("date_created").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("date_modified").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("type").Exec(ss)
		r.DB(d).Table("tokens").IndexCreate("expiry_date").Exec(ss)

		r.DB(d).TableCreate("webhooks").Exec(ss)
		r.DB(d).Table("webhooks").IndexCreate("target").Exec(ss)
		r.DB(d).Table("webhooks").IndexCreate("type").Exec(ss)
		r.DB(d).Table("webhooks").IndexCreateFunc("targetType", func(row r.Term) interface{} {
			return []interface{}{
				row.Field("target"),
				row.Field("type"),
			}
		}).Exec(ss)
	}

	return ss.Close()
}
984255
func setup(ctx *cli.Context) (err error) {
	setting.Debug = ctx.GlobalBool("debug")
	log.NonColor = ctx.GlobalBool("noterm")
	log.Verbose = ctx.Bool("verbose")

	log.Info("App Version: %s", ctx.App.Version)

	setting.HomeDir, err = base.HomeDir()
	if err != nil {
		return fmt.Errorf("Fail to get home directory: %v", err)
	}
	setting.HomeDir = strings.Replace(setting.HomeDir, "\\", "/", -1)

	setting.InstallRepoPath = path.Join(setting.HomeDir, ".gopm/repos")
	if runtime.GOOS == "windows" {
		setting.IsWindows = true
	}
	os.MkdirAll(setting.InstallRepoPath, os.ModePerm)
	log.Info("Local repository path: %s", setting.InstallRepoPath)

	if !setting.LibraryMode || len(setting.WorkDir) == 0 {
		setting.WorkDir, err = os.Getwd()
		if err != nil {
			return fmt.Errorf("Fail to get work directory: %v", err)
		}
		setting.WorkDir = strings.Replace(setting.WorkDir, "\\", "/", -1)
	}
	setting.DefaultGopmfile = path.Join(setting.WorkDir, setting.GOPMFILE)
	setting.DefaultVendor = path.Join(setting.WorkDir, setting.VENDOR)
	setting.DefaultVendorSrc = path.Join(setting.DefaultVendor, "src")

	if !ctx.Bool("remote") {
		if ctx.Bool("local") {
			// gf, _, _, err := genGopmfile(ctx)
			// if err != nil {
			// 	return err
			// }
			// setting.InstallGopath = gf.MustValue("project", "local_gopath")
			// if ctx.Command.Name != "gen" {
			// 	if com.IsDir(setting.InstallGopath) {
			// 		log.Log("Indicated local GOPATH: %s", setting.InstallGopath)
			// 		setting.InstallGopath += "/src"
			// 	} else {
			// 		if setting.LibraryMode {
			// 			return fmt.Errorf("Local GOPATH does not exist or is not a directory: %s",
			// 				setting.InstallGopath)
			// 		}
			// 		log.Error("", "Invalid local GOPATH path")
			// 		log.Error("", "Local GOPATH does not exist or is not a directory:")
			// 		log.Error("", "\t"+setting.InstallGopath)
			// 		log.Help("Try 'go help gopath' to get more information")
			// 	}
			// }

		} else {
			// Get GOPATH.
			setting.InstallGopath = base.GetGOPATHs()[0]
			if base.IsDir(setting.InstallGopath) {
				log.Info("Indicated GOPATH: %s", setting.InstallGopath)
				setting.InstallGopath += "/src"
				setting.HasGOPATHSetting = true
			} else {
				if ctx.Bool("gopath") {
					return fmt.Errorf("Local GOPATH does not exist or is not a directory: %s",
						setting.InstallGopath)
				} else {
					// It's OK that no GOPATH setting
					// when user does not specify to use.
					log.Warn("No GOPATH setting available")
				}
			}
		}
	}

	setting.ConfigFile = path.Join(setting.HomeDir, ".gopm/data/gopm.ini")
	if err = setting.LoadConfig(); err != nil {
		return err
	}

	setting.PkgNameListFile = path.Join(setting.HomeDir, ".gopm/data/pkgname.list")
	if err = setting.LoadPkgNameList(); err != nil {
		return err
	}

	setting.LocalNodesFile = path.Join(setting.HomeDir, ".gopm/data/localnodes.list")
	if err = setting.LoadLocalNodes(); err != nil {
		return err
	}
	return nil
}
431313
func (d *LSM303) setup() error {
	d.mu.RLock()
	if d.initialized {
		d.mu.RUnlock()
		return nil
	}
	d.mu.RUnlock()

	d.mu.Lock()
	defer d.mu.Unlock()

	if err := d.Bus.WriteByteToReg(magAddress, magConfigRegA, MagCRADefault); err != nil {
		return err
	}
	if err := d.Bus.WriteByteToReg(magAddress, magModeReg, MagMRDefault); err != nil {
		return err
	}

	d.initialized = true

	return nil
}
663588
func setup(c *caddy.Controller) error {
	cfg := httpserver.GetConfig(c)

	rules, err := fastcgiParse(c)
	if err != nil {
		return err
	}

	cfg.AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return Handler{
			Next:            next,
			Rules:           rules,
			Root:            cfg.Root,
			FileSys:         http.Dir(cfg.Root),
			SoftwareName:    caddy.AppName,
			SoftwareVersion: caddy.AppVersion,
			ServerName:      cfg.Addr.Host,
			ServerPort:      cfg.Addr.Port,
		}
	})

	return nil
}
971310
func setup(c *caddy.Controller) error {
	rules, err := redirParse(c)
	if err != nil {
		return err
	}

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		return Redirect{Next: next, Rules: rules}
	})

	return nil
}
181519
func setup(c *caddy.Controller) error {
	resource, err := expVarParse(c)
	if err != nil {
		return err
	}

	// publish any extra information/metrics we may want to capture
	publishExtraVars()

	ev := ExpVar{Resource: resource}

	httpserver.GetConfig(c).AddMiddleware(func(next httpserver.Handler) httpserver.Handler {
		ev.Next = next
		return ev
	})

	return nil
}