本文整理汇总了Golang中github.com/banthar/Go-SDL/sdl.Quit函数的典型用法代码示例。如果您正苦于以下问题:Golang Quit函数的具体用法?Golang Quit怎么用?Golang Quit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Quit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Destroy
func (self *AppStateManager) Destroy() {
sdl.Quit()
if *FLAG_profile {
pprof.StopCPUProfile()
}
}
开发者ID:pzsz,项目名称:glutils,代码行数:7,代码来源:appstate.go
示例2: initScreen
func initScreen() {
sdl.Init(sdl.INIT_VIDEO)
const (
resx int = 640
resy int = 480
)
var (
screen = sdl.SetVideoMode(resx, resy, 16, sdl.OPENGL)
)
if screen == nil {
sdl.Quit()
panic("Couldn't set GL video mode: " + sdl.GetError() + "\n")
}
if gl.Init() != 0 {
panic("gl error")
}
gl.MatrixMode(gl.PROJECTION)
//gl.MatrixMode(gl.MODELVIEW)
gl.Viewport(0, 0, int(screen.W), int(screen.H))
gl.LoadIdentity()
gl.Ortho(0, float64(screen.W), float64(screen.H), 0, -1.0, 1.0)
//gl.DepthRange(-1, 1)
gl.ClearColor(0, 0, 0, 0)
gl.Clear(gl.COLOR_BUFFER_BIT)
}
开发者ID:charlieb,项目名称:gostrange,代码行数:30,代码来源:main.go
示例3: main
func main() {
if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
panic(sdl.GetError())
}
defer sdl.Quit()
screen := sdl.SetVideoMode(640, 480, 32, 0)
if screen == nil {
panic(sdl.GetError())
}
sdl.WM_SetCaption("Ohai", "")
sdl.EnableKeyRepeat(20, 20)
fmt.Println("Launching mainloop")
loadTextures()
loadLevel()
gameloop(screen)
}
开发者ID:githubnemo,项目名称:Jinx,代码行数:25,代码来源:main.go
示例4: run
// Runs everything, calling the methods required to get the game
// running, runs the main loop, and then cleanly exits.
func (g *game) run() (err error) {
err = g.load()
if err != nil {
return
}
defer g.quit()
if sdl.Init(sdl.INIT_EVERYTHING) < 0 {
return errors.New(sdl.GetError())
}
defer sdl.Quit()
g.screen = sdl.SetVideoMode(640, 480, 32, sdl.DOUBLEBUF)
if g.screen == nil {
return errors.New(sdl.GetError())
}
sdl.WM_SetCaption(WinCap, "")
err = g.main()
if err != nil {
return
}
return
}
开发者ID:DeedleFake,项目名称:ggigl,代码行数:28,代码来源:ggigl.go
示例5: initdec
func initdec() {
initnum--
if initnum == 0 {
sdl.Quit()
}
}
开发者ID:dmbreaker,项目名称:Go-SDL,代码行数:7,代码来源:gui.go
示例6: Quit
// release/destroy our resources and restoring the old desktop
func Quit(status int) {
// clean up the window
sdl.Quit()
// and exit appropriately
os.Exit(status)
}
开发者ID:navneet1v,项目名称:opengl-go-tutorials,代码行数:8,代码来源:lesson08.go
示例7: wrap
// Wrap the SDL into one single thread
func (s SdlWrap) wrap() {
runtime.LockOSThread()
if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
panic("Unable to init SDL. Cause: " + sdl.GetError())
}
sdl.EnableUNICODE(1)
s.InitDone <- struct{}{}
for {
select {
case t := <-s.Title:
sdl.WM_SetCaption(t, t)
case <-s.Quit:
close(s.Events)
sdl.Quit()
case sz := <-s.Size:
s.Surface <- sdl.SetVideoMode(int(sz.X), int(sz.Y), 32, sdl.HWSURFACE|sdl.DOUBLEBUF|sdl.RESIZABLE)
default:
e := sdl.PollEvent()
if e != nil {
s.Events <- e
}
}
}
}
开发者ID:andrebq,项目名称:wde.sdl,代码行数:28,代码来源:init.go
示例8: Setup
func (self *AppStateManager) Setup(state AppState, caption string) {
if *FLAG_profile {
pfile, _ := os.Create("gowar.prof")
pprof.StartCPUProfile(pfile)
}
// Lock, so we got no GL-in-wrong-thread foolery
sdl.Init(sdl.INIT_VIDEO)
self.Screen = sdl.SetVideoMode(800, 600, 32, sdl.OPENGL|sdl.RESIZABLE)
gl.Init()
if self.Screen == nil {
sdl.Quit()
panic("Couldn't set 300x300 GL video mode: " + sdl.GetError() + "\n")
}
sdl.WM_SetCaption(caption, caption)
Setup()
GetViewport().SetScreenSize(float32(self.Screen.W), float32(self.Screen.H))
self.Push(state)
}
开发者ID:pzsz,项目名称:glutils,代码行数:26,代码来源:appstate.go
示例9: main
func main() {
var done bool
sdl.Init(sdl.INIT_VIDEO)
var screen = sdl.SetVideoMode(300, 300, 18, sdl.OPENGL|sdl.RESIZABLE)
if screen == nil {
sdl.Quit()
panic("Couldn't set 300x300 GL video mode: " + sdl.GetError() + "\n")
}
gl.Init()
//if gl.Init() != nil {
//panic("gl error")
//}
init_()
reshape(int32(screen.W), int32(screen.H))
done = false
for !done {
for e := sdl.PollEvent(); e != nil; e = sdl.PollEvent() {
switch e.(type) {
case *sdl.ResizeEvent:
re := e.(*sdl.ResizeEvent)
screen = sdl.SetVideoMode(int(re.W), int(re.H), 16,
sdl.OPENGL|sdl.RESIZABLE)
if screen != nil {
reshape(int32(screen.W), int32(screen.H))
} else {
panic("we couldn't set the new video mode??")
}
break
case *sdl.QuitEvent:
done = true
break
}
}
done = key_handler()
draw()
}
sdl.Quit()
return
}
开发者ID:pietdaniel,项目名称:gl_maze,代码行数:42,代码来源:main.go
示例10: Release
func (c *Screen) Release() {
if c.font != nil {
c.font.Close()
}
if c.surface != nil {
c.surface.Free()
}
ttf.Quit()
sdl.Quit()
/* log.Printf("sdl Released...") */
}
开发者ID:suapapa,项目名称:subtitle-raider,代码行数:12,代码来源:graphic.go
示例11: main
func main() {
if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
panic(sdl.GetError())
}
defer sdl.Quit()
println("unpause with space or p")
println("while paused you can place cells with the three mouse buttons")
rand.Seed(time.Now().UnixNano())
Screen = NewSurface(Width*Scale, Height*Scale)
Setup()
HandleEvents()
}
开发者ID:manveru,项目名称:go.life,代码行数:15,代码来源:life.go
示例12: main
func main() {
globalState.Mouse = make(map[int]bool)
flag.Parse()
var err error
if sdl.Init(sdl.INIT_VIDEO) != 0 {
log.Printf("Unable to init SDL")
return
}
if len(flag.Args()) == 0 {
old := flag.Usage
flag.Usage = func() {
old()
fmt.Fprintf(os.Stderr, "You MUST pass the name of the file to view\n")
}
flag.Usage()
return
}
mesh, err = wfobj.LoadMeshFromFile(flag.Args()[0])
if err != nil {
flag.Usage()
fmt.Fprintf(os.Stderr, "[e] %v\n", err)
return
}
defer sdl.Quit()
screen := sdl.SetVideoMode(1024, 600, 32, sdl.OPENGL|sdl.RESIZABLE)
if screen == nil {
log.Printf("Unable to init sdl Screen")
}
sdl.GL_SetAttribute(sdl.GL_DOUBLEBUFFER, 1)
initGL()
sdl.WM_SetCaption("sdlviewer", "sdlviewer")
running = true
for running {
handleInput()
drawScene()
}
}
开发者ID:andrebq,项目名称:wfobj,代码行数:45,代码来源:main.go
示例13: main
func main() {
sdl.Init(sdl.INIT_VIDEO)
defer sdl.Quit()
screen := sdl.SetVideoMode(width, height, 32, sdl.OPENGL)
if screen == nil {
panic("Couldn't set video mode: " + sdl.GetError() + "\n")
}
if err := gl.Init(); err != 0 {
panic("gl error")
}
initGl()
initShaders()
mainLoop()
}
开发者ID:shogg,项目名称:gltoy,代码行数:18,代码来源:gltoy.go
示例14: main
func main() {
if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
panic(sdl.GetError())
}
// The actual resolution (screenspace)
W := 800
H := 600
// The virtual resolution (worldspace)
MAXX := 400
MAXY := 300
screen := sdl.SetVideoMode(W, H, 32, sdl.FULLSCREEN)
if screen == nil {
panic(sdl.GetError())
}
sdl.EnableUNICODE(1)
sdl.ShowCursor(0)
sdl.WM_SetCaption("Random Lines", "")
red := sdl.Color{255, 0, 0, 255}
color := red
rand.Seed(time.Now().UnixNano())
for {
color = sdl.Color{uint8(rand.Intn(255)), uint8(rand.Intn(255)), uint8(rand.Intn(255)), 255}
DoublePixelLine(screen, rand.Intn(MAXX), rand.Intn(MAXY), rand.Intn(MAXX), rand.Intn(MAXY), color)
if escPressed() {
break
}
screen.Flip()
sdl.PollEvent()
//sdl.Delay(10)
}
sdl.Quit()
}
开发者ID:xyproto,项目名称:rasterizer,代码行数:40,代码来源:rasterizer.go
示例15: main
func main() {
sdl.Init(sdl.INIT_VIDEO)
ttf.Init()
screen := sdl.SetVideoMode(480, 560, 16, sdl.OPENGL|sdl.RESIZABLE)
sdl.WM_SetCaption("Flappy Bird", "")
bg := utils.TextureFromFile("./bg.png")
font := utils.LoadFont("/usr/share/fonts/truetype/DroidSans.ttf", 32)
reshape(int(screen.W), int(screen.H))
renderBackground(screen, bg)
font.Printf(110, 50, "Click to play")
sdl.GL_SwapBuffers()
for {
OuterLoop:
for {
e := sdl.WaitEvent()
switch e.(type) {
case *sdl.MouseButtonEvent:
if e.(*sdl.MouseButtonEvent).Type == sdl.MOUSEBUTTONUP {
break OuterLoop
}
}
}
score, quit := playGame(screen, bg, font)
if quit {
break
}
quit = gameOverScreen(screen, strconv.Itoa(score), bg, font)
if quit {
break
}
}
screen.Free()
ttf.Quit()
sdl.Quit()
return
}
开发者ID:Tohie,项目名称:GoFlappyBird,代码行数:40,代码来源:flappybird.go
示例16: ui_main
func ui_main() {
if sdl.Init(sdl.INIT_VIDEO) != 0 {
panic(sdl.GetError())
}
if screen == nil {
panic(sdl.GetError())
}
sdl.EnableUNICODE(1)
sdl.WM_SetCaption("Go-SDL SDL Test", "")
running := true
for running {
for ev := sdl.PollEvent(); ev != nil; ev = sdl.PollEvent() {
switch e := ev.(type) {
case *sdl.QuitEvent:
running = false
break
case *sdl.ResizeEvent:
println("resize screen ", e.W, e.H)
screen = sdl.SetVideoMode(int(e.W), int(e.H), 32, sdl.RESIZABLE)
if screen == nil {
panic(sdl.GetError())
}
}
}
}
ttf.Quit()
sdl.Quit()
}
开发者ID:AlexandreBRUXELLE,项目名称:goStartDockerViaRabbitMQ,代码行数:39,代码来源:main.go
示例17: DisplayImage
func DisplayImage(src image.Image) {
// Initialise SDL
log.Println("Initialising SDL.")
sdl.Init(sdl.INIT_VIDEO)
defer sdl.Quit()
// Transform the image into an SDL surface.
log.Println("Transforming image into SDL surface.")
var buf bytes.Buffer
png.Encode(&buf, src)
sdlRW := sdl.RWFromReader(&buf)
sdlSurf := sdl.Load_RW(sdlRW, false)
// Set the display up.
log.Println("Setting up screen.")
sdlScreen := sdl.SetVideoMode(int(sdlSurf.W), int(sdlSurf.H), 32, sdl.SWSURFACE)
sdlScreen.Blit(nil, sdlSurf, nil)
// Loop until exit.
log.Println("Displaying image.")
loop(sdlScreen)
}
开发者ID:jqln-0,项目名称:colorshow,代码行数:22,代码来源:window.go
示例18: main
func main() {
if sdl.Init(sdl.INIT_EVERYTHING) != 0 {
panic(sdl.GetError())
}
defer sdl.Quit()
var screen = sdl.SetVideoMode(640, 480, 32, 0)
if screen == nil {
panic(sdl.GetError())
}
sdl.WM_SetCaption("Template", "")
for true {
e := &sdl.Event{}
for e.Poll() {
switch e.Type {
case sdl.QUIT:
return
default:
}
}
screen.FillRect(nil, 0x000000)
//screen.Blit(&sdl.Rect{x,y, 0, 0}, image, nil)
screen.Flip()
sdl.Delay(25)
}
}
开发者ID:dmbreaker,项目名称:Go-SDL,代码行数:38,代码来源:template.go
示例19: main
func main() {
sdl.Init(sdl.INIT_VIDEO)
defer sdl.Quit()
screen := sdl.SetVideoMode(width, height, 32, sdl.OPENGL)
if screen == nil {
panic("Couldn't set video mode: " + sdl.GetError() + "\n")
}
sdl.EnableKeyRepeat(200, 20)
if err := gl.Init(); err != 0 {
panic("gl error")
}
cam.Yaw(3.14)
initGl()
initShaders()
initVoxels()
mainLoop()
}
开发者ID:shogg,项目名称:glvox,代码行数:23,代码来源:main.go
示例20: Open
func Open(w, h int, fullscreen bool, title, tabname string) *Window {
if GWindow != nil {
panic("only one Window is allowed")
}
win := &Window{width: w, height: h, title: title, tabname: tabname}
GWindow = win
sdl.Init(sdl.INIT_EVERYTHING)
gl.Init()
var screen = sdl.SetVideoMode(win.width, win.height, 16, sdl.OPENGL)
if screen == nil {
sdl.Quit()
panic("Couldn't set sdl GL video mode: " + sdl.GetError() + "\n")
}
sdl.WM_SetCaption(win.title, win.tabname)
win.initGL()
win.pixelData = make([]uint8, win.width*win.height*4)
return win
}
开发者ID:swantescholz,项目名称:coding,代码行数:24,代码来源:window.go
注:本文中的github.com/banthar/Go-SDL/sdl.Quit函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论