• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Golang sdl.PollEvent函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Golang中github.com/veandco/go-sdl2/sdl.PollEvent函数的典型用法代码示例。如果您正苦于以下问题:Golang PollEvent函数的具体用法?Golang PollEvent怎么用?Golang PollEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PollEvent函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。

示例1: handleEvents

func (c *Controller) handleEvents() {
	// read all events
	for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
		switch et := event.(type) {
		case *sdl.QuitEvent:
			log.Println("Want to quit, but how do we apply this... ?")
			/*
				c.Destroy()
				return
				// NOTE: caller keeps calling Iterate because it doesn't know we're done... how to fix?
			*/
		case *sdl.KeyDownEvent:
			c.sendKeyEvents(sdl.GetKeyName(et.Keysym.Sym), true)
		case *sdl.KeyUpEvent:
			c.sendKeyEvents(sdl.GetKeyName(et.Keysym.Sym), false)
		// these are events we know but currently don't use FIXME implement
		case *sdl.WindowEvent:
		case *sdl.TextInputEvent:
		case *sdl.TextEditingEvent:
		case *sdl.MouseButtonEvent:
		case *sdl.MouseMotionEvent:
		case *sdl.MouseWheelEvent:
		default:
			log.Printf("Unknown event: %T\n", et)
		}
	}
}
开发者ID:xamino,项目名称:orbengine,代码行数:27,代码来源:controller.go


示例2: CheckForUpdates

// CheckForUpdates polls sdl events and updates the map accordingly
func CheckForUpdates() bool {
	changeDetected := false

	// poll any current events
	var event sdl.Event
	for event = sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
		switch t := event.(type) {
		case *sdl.QuitEvent:
			inputMap["Quit"] = true
		case *sdl.KeyDownEvent:
			if t.Keysym.Sym == sdl.K_ESCAPE {
				inputMap["Esc"] = true
			} else {
				// fmt.Printf("[%d ms] Keyboard\ttype:%d\tsym:%c\tmodifiers:%d\tstate:%d\trepeat:%d\n",
				// t.Timestamp, t.Type, t.Keysym.Sym, t.Keysym.Mod, t.State, t.Repeat)
			}
		default:
			// fmt.Printf("Some event\n")
		}

		changeDetected = true
	}

	return changeDetected
}
开发者ID:Triangle345,项目名称:GT,代码行数:26,代码来源:GlobalInput.go


示例3: main

func main() {

	start()
	defer window.Destroy()
	defer renderer.Destroy()

	text := loadText("Press enter to reset", sdl.Color{0, 0, 0, 255})
	startTime := sdl.GetTicks()

	quit := false
	for !quit {
		for e := sdl.PollEvent(); e != nil; e = sdl.PollEvent() {
			switch t := e.(type) {
			case *sdl.QuitEvent:
				quit = true
			case *sdl.KeyDownEvent:
				if t.Keysym.Sym == sdl.K_RETURN {
					startTime = sdl.GetTicks()
				}

			}
		}

		renderer.SetDrawColor(0xFF, 0xFF, 0xFF, 0xFF)
		renderer.Clear()
		timeText := loadText(fmt.Sprintf("time: %d", sdl.GetTicks()-startTime), sdl.Color{0, 0, 0, 255})
		renderer.Copy(text, nil, &sdl.Rect{0, 0, 400, 100})
		renderer.Copy(timeText, nil, &sdl.Rect{400, 0, 400, 100})

		renderer.Present()
	}
}
开发者ID:EvanTheB,项目名称:SDLGame,代码行数:32,代码来源:22timer.go


示例4: main

func main() {
	rom, err := LoadROM(os.Args[1])

	if err != nil {
		panic(err)
	}

	frameDelay := 1000 / frameRate

	window := sdl.CreateWindow(
		"Go NES",
		sdl.WINDOWPOS_UNDEFINED,
		sdl.WINDOWPOS_UNDEFINED,
		256,
		240,
		sdl.WINDOW_SHOWN,
	)

	if window == nil {
		panic(sdl.GetError())
	}

	defer window.Destroy()

	controller := NewController()
	ppu := NewPPU(window, NewVRAM(rom.Mapper()))
	cpu := NewCPU(NewMMU(rom.Mapper(), ppu, controller), ppu)

	ticksPerFrame := uint32(341 * 262)

	for {
		expectedTicks := sdl.GetTicks() + frameDelay

		for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
			switch event := event.(type) {
			case *sdl.KeyDownEvent:
				controller.SetKeyState(event.Keysym.Sym, true)
			case *sdl.KeyUpEvent:
				controller.SetKeyState(event.Keysym.Sym, false)
			case *sdl.QuitEvent:
				return
			}
		}

		ppuTicks := uint32(0)

		for ppuTicks < ticksPerFrame {
			ppuTicks += ppu.Tick(cpu.Tick())
		}

		actualTicks := sdl.GetTicks()

		if actualTicks < expectedTicks {
			sdl.Delay(expectedTicks - actualTicks)
		}
	}
}
开发者ID:jlippitt,项目名称:gones,代码行数:57,代码来源:main.go


示例5: main

func main() {
	var window *sdl.Window
	var renderer *sdl.Renderer
	var event sdl.Event
	var running bool

	window = sdl.CreateWindow(winTitle, sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED,
		winWidth, winHeight, sdl.WINDOW_SHOWN)
	if window == nil {
		fmt.Fprintf(os.Stderr, "Failed to create window: %s\n", sdl.GetError())
		os.Exit(1)
	}

	renderer = sdl.CreateRenderer(window, -1, sdl.RENDERER_ACCELERATED)
	if renderer == nil {
		fmt.Fprintf(os.Stderr, "Failed to create renderer: %s\n", sdl.GetError())
		os.Exit(2)
	}

	var peepArray []sdl.Event = make([]sdl.Event, 5)

	running = true
	for running {
		sdl.PumpEvents()
		numEventsRetrieved := sdl.PeepEvents(peepArray, sdl.PEEKEVENT, sdl.FIRSTEVENT, sdl.LASTEVENT)
		if numEventsRetrieved < 0 {
			fmt.Printf("PeepEvents error: %s\n", sdl.GetError())
		} else {
			for i := 0; i < numEventsRetrieved; i++ {
				fmt.Printf("Event Peeked Value: %v\n", peepArray[i]) // primitive printing of event
			}
		}

		for event = sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
			switch t := event.(type) {
			case *sdl.QuitEvent:
				running = false
			case *sdl.MouseMotionEvent:
				fmt.Printf("[%d ms] MouseMotion\ttype:%d\tid:%d\tx:%d\ty:%d\txrel:%d\tyrel:%d\n",
					t.Timestamp, t.Type, t.Which, t.X, t.Y, t.XRel, t.YRel)
			case *sdl.MouseButtonEvent:
				fmt.Printf("[%d ms] MouseButton\ttype:%d\tid:%d\tx:%d\ty:%d\tbutton:%d\tstate:%d\n",
					t.Timestamp, t.Type, t.Which, t.X, t.Y, t.Button, t.State)
			case *sdl.MouseWheelEvent:
				fmt.Printf("[%d ms] MouseWheel\ttype:%d\tid:%d\tx:%d\ty:%d\n",
					t.Timestamp, t.Type, t.Which, t.X, t.Y)
			case *sdl.KeyUpEvent:
				fmt.Printf("[%d ms] Keyboard\ttype:%d\tsym:%c\tmodifiers:%d\tstate:%d\trepeat:%d\n",
					t.Timestamp, t.Type, t.Keysym.Sym, t.Keysym.Mod, t.State, t.Repeat)
			}
		}
		sdl.Delay(1000 / 30)
	}

	renderer.Destroy()
	window.Destroy()
}
开发者ID:emlai,项目名称:go-sdl2,代码行数:57,代码来源:PeepEvents_peek.go


示例6: main

func main() {

	start()
	defer window.Destroy()
	defer renderer.Destroy()
	loadAudio()

	screens := loadScreens()

	quit := false

	cur := screens["main"]

	for !quit {
		for e := sdl.PollEvent(); e != nil; e = sdl.PollEvent() {
			switch t := e.(type) {
			case *sdl.QuitEvent:
				quit = true
			case *sdl.KeyDownEvent:
				switch t.Keysym.Sym {
				case sdl.K_1:
					high.PlayChannel(-1, 0)
				case sdl.K_2:
					medium.PlayChannel(-1, 0)
				case sdl.K_3:
					low.PlayChannel(-1, 0)
				case sdl.K_4:
					scratch.PlayChannel(-1, 0)
				case sdl.K_9:
					if !mix.MusicPlaying() {
						if !music.Play(1) {
							fmt.Printf("music did not play: %s", sdl.GetError())
						}
					} else {
						if !mix.PausedMusic() {
							mix.PauseMusic()
						} else {
							mix.ResumeMusic()
						}

					}
				}

			}

		}

		renderer.SetDrawColor(0xFF, 0xFF, 0xFF, 0xFF)
		renderer.Clear()

		renderer.Copy(cur, nil, nil)

		renderer.Present()
	}
}
开发者ID:EvanTheB,项目名称:SDLGame,代码行数:55,代码来源:21sound.go


示例7: catchEvents

func catchEvents() bool {
	for event = sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
		switch t := event.(type) {
		case *sdl.QuitEvent:
			return false
		case *sdl.KeyDownEvent:
			handleKeyEvent(t.Keysym.Sym)
		}
	}
	return true
}
开发者ID:billyninja,项目名称:wander,代码行数:11,代码来源:main.go


示例8: eventLoop

func (g *Engine) eventLoop() {
	g.Event = nil
	for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
		switch t := event.(type) {
		case *sdl.QuitEvent:
			g.Running = false

		case *sdl.KeyDownEvent:
			g.Event = &t.Keysym.Sym
		}
	}
}
开发者ID:stephenbinns,项目名称:ein,代码行数:12,代码来源:engine.go


示例9: waitEvent

//wait for an event and returns the value of the event in key_mapping
func (c *Chip8) waitEvent() byte {

	for {
		for c.event = sdl.PollEvent(); c.event != nil; c.event = sdl.PollEvent() {
			switch event := c.event.(type) {
			case *sdl.KeyDownEvent:
				if code, found := c.key_mapping[event.Keysym.Sym]; found {
					return code
				}
			}
		}
	}
}
开发者ID:PeBraz,项目名称:Chip.emul8ter,代码行数:14,代码来源:chip8.go


示例10: main

func main() {
	var winTitle string = "Go-SDL2 + Go-GL"
	var winWidth, winHeight int = 800, 600
	var window *sdl.Window
	var context sdl.GLContext
	var event sdl.Event
	var running bool
	var err error

	if err = sdl.Init(sdl.INIT_EVERYTHING); err != nil {
		panic(err)
	}
	defer sdl.Quit()

	if err = gl.Init(); err != nil {
		panic(err)
	}

	window, err = sdl.CreateWindow(winTitle, sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED,
		winWidth, winHeight, sdl.WINDOW_OPENGL)
	if err != nil {
		panic(err)
	}
	defer window.Destroy()
	context, err = sdl.GL_CreateContext(window)
	if err != nil {
		panic(err)
	}
	defer sdl.GL_DeleteContext(context)

	gl.Enable(gl.DEPTH_TEST)
	gl.ClearColor(0.2, 0.2, 0.3, 1.0)
	gl.ClearDepth(1)
	gl.DepthFunc(gl.LEQUAL)
	gl.Viewport(0, 0, int32(winWidth), int32(winHeight))

	running = true
	for running {
		for event = sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
			switch t := event.(type) {
			case *sdl.QuitEvent:
				running = false
			case *sdl.MouseMotionEvent:
				fmt.Printf("[%d ms] MouseMotion\tid:%d\tx:%d\ty:%d\txrel:%d\tyrel:%d\n", t.Timestamp, t.Which, t.X, t.Y, t.XRel, t.YRel)
			}
		}
		drawgl()
		sdl.GL_SwapWindow(window)
	}
}
开发者ID:emlai,项目名称:go-sdl2,代码行数:50,代码来源:opengl.go


示例11: main

func main() {
	window, renderer = tools.Start("planets", int(SCREEN_W), int(SCREEN_H))
	wideView := tools.ViewBox{tools.Vector{-SCREEN_SCALE / 2 / float64(SCREEN_H) * float64(SCREEN_W),
		-SCREEN_SCALE / 2},
		SCREEN_SCALE / float64(SCREEN_H) * float64(SCREEN_W),
		SCREEN_SCALE}
	defer window.Destroy()
	defer renderer.Destroy()
	sprite = tools.LoadTextureTransparent(renderer, "resources/sprites.png", 0, 0xFF, 0xFF)

	bodies := []*tools.Body{&Sun, &Earth, &Mars, &Ecc}

	quit := false
	curView := &wideView
	for !quit {
		for e := sdl.PollEvent(); e != nil; e = sdl.PollEvent() {
			switch t := e.(type) {
			case *sdl.QuitEvent:
				quit = true
			case *sdl.KeyDownEvent:
				switch t.Keysym.Sym {
				case sdl.K_UP:
					auto := tools.GetAutoView(
						[]tools.Vector{
							bodies[0].Position,
							bodies[1].Position},
						SCREEN_RATIO)
					curView = &auto
				case sdl.K_DOWN:
					curView = &wideView
				case sdl.K_q:
					quit = true
				}
				// fmt.Println("View:", curView)
			}

		}
		// Draw background
		renderer.SetDrawColor(0xFF, 0xFF, 0xFF, 0xFF)
		renderer.Clear()

		renderer.SetDrawColor(0, 0, 0, 0xFF)

		tools.UpdateBodiesSeconds(bodies, 60*60*24*7)
		DrawBodies(bodies, *curView)

		renderer.Present()
		//fmt.Println(earth.Position, sun.Position)
	}
}
开发者ID:EvanTheB,项目名称:SDLGame,代码行数:50,代码来源:game.go


示例12: HandleEvents

func (i *InputHandler) HandleEvents() {
	i.pressed_keys_this_frame = make([]sdl.Keycode, 10)
	i.released_keys_this_frame = make([]sdl.Keycode, 10)

	for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
		switch t := event.(type) {
		case *sdl.KeyDownEvent:
			i.pressed_keys_this_frame = append(i.pressed_keys_this_frame, t.Keysym.Sym)
			i.pressed_keys[t.Keysym.Sym] = true
		case *sdl.KeyUpEvent:
			i.released_keys_this_frame = append(i.released_keys_this_frame, t.Keysym.Sym)
			i.pressed_keys[t.Keysym.Sym] = false
		}
	}
}
开发者ID:kageurufu,项目名称:platformr,代码行数:15,代码来源:input.go


示例13: main

func main() {
	window, err := sdl.CreateWindow("Monster Path",
		sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED,
		640, 480, sdl.WINDOW_SHOWN)

	if err != nil {
		os.Exit(1)
	}
	defer window.Destroy()

	renderer, err := sdl.CreateRenderer(window, -1, sdl.RENDERER_ACCELERATED)
	if err != nil {
		os.Exit(2)
	}
	defer renderer.Destroy()

	var event sdl.Event
	running := true

	myGrid := grid.New(17, 12)
	setupMap(myGrid)
	gunner.location, _ = myGrid.RoomAt(15, 7)
	alien.location, _ = myGrid.RoomAt(1, 1)
	graph := graph.NewFromGrid(myGrid)
	path := graph.Path(gunner.location, alien.location)
	for running {
		for event = sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
			switch event.(type) {
			case *sdl.QuitEvent:
				running = false
			}
		}

		renderer.SetDrawColor(205, 201, 201, 255)
		renderer.Clear()

		renderer.SetDrawColor(10, 10, 10, 255)
		Draw(renderer, myGrid)
		DrawGraph(renderer, graph)
		renderer.SetDrawColor(200, 0, 0, 255)
		DrawPath(renderer, path)

		renderer.SetDrawColor(0, 100, 0, 255)
		alien.Draw(renderer)
		gunner.Draw(renderer)
		renderer.Present()
	}
}
开发者ID:paytonrules,项目名称:pathfinding,代码行数:48,代码来源:gameloop.go


示例14: processInput

func (p *PlayerFrontend) processInput() {
	for ev := sdl.PollEvent(); ev != nil; ev = sdl.PollEvent() {
		input := Input{}
		for _, v := range p.inputs {
			earlyExit, in := v.ProcessEvent(ev, p)
			if in != nil {
				input.Combine(in)
			}
			if earlyExit {
				break
			}
		}
		input.Normalize()
		p.sendInput(input)
	}
}
开发者ID:Oralordos,项目名称:Game-Programming-Project,代码行数:16,代码来源:frontend.go


示例15: Poll

func Poll() Event {
	e := sdl.PollEvent()
	if e == nil {
		return nil
	}
	return wrapEvent(e)
}
开发者ID:eandre,项目名称:drip,代码行数:7,代码来源:poll.go


示例16: GetKey

// GetKey returns the key or button that has been pressed by the user.
// Possible return values are the constants:
//
//  KeyNone - indicating that no key, or an unrecognised key as been pressed
//  KeyUp	- indicating that the up cursor key has been pressed
//  KeyDown - indicating that the down cursor key has been pressed
//  KeyPause - indicating that the pause key has been presses
//  ButtonClose - indicating that the windows close button has been pressed
//
// GetKey will panic if:
//
// 1. The toolbox has not been initialised.
//
// 2. If an internal check fails. In this case the panic message is "KeyDownEvent type assertion failed!"
// This is highly unlikely to occur and indcates a problem with the underlying
// graphics llibrary.
func GetKey() Key {
	if !initialised {
		// this stops execution here, so ne need for an else after the if
		panic(notInitialisedMessage)
	}

	var event sdl.Event
	event = sdl.PollEvent()
	if event != nil {
		if isQuitEvent(event) {
			return ButtonClose
		}
		if isKeyDownEvent(event) {
			if isKeyUp(event) {
				return KeyUp
			}
			if isKeyDown(event) {
				return KeyDown
			}
			// We must always respond to the paused key being pressed - if the
			// game is not over.
			// If the game is running the pause key pauses the game.
			// But if the game is paused, we must still respond to the paused key.
			// This is the only way to unpause the game.
			if isKeyPause(event) {
				return KeyPause
			}
		}
	}
	return KeyNone
}
开发者ID:gophercoders,项目名称:toolbox,代码行数:47,代码来源:toolbox.go


示例17: Start

func (mc *MissionControl) Start() {
	var event sdl.Event
	var running bool = true

	for running {
		for event = sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
			switch t := event.(type) {
			case *sdl.QuitEvent:
				running = false
			case *sdl.MouseMotionEvent:
				fmt.Printf("[%d ms] MouseMotion\ttype:%d\tid:%d\tx:%d\ty:%d\txrel:%d\tyrel:%d\n",
					t.Timestamp, t.Type, t.Which, t.X, t.Y, t.XRel, t.YRel)
			case *sdl.MouseButtonEvent:
				fmt.Printf("[%d ms] MouseButton\ttype:%d\tid:%d\tx:%d\ty:%d\tbutton:%d\tstate:%d\n",
					t.Timestamp, t.Type, t.Which, t.X, t.Y, t.Button, t.State)
			case *sdl.MouseWheelEvent:
				fmt.Printf("[%d ms] MouseWheel\ttype:%d\tid:%d\tx:%d\ty:%d\n",
					t.Timestamp, t.Type, t.Which, t.X, t.Y)
			case *sdl.KeyUpEvent:
				fmt.Printf("[%d ms] Keyboard\ttype:%d\tsym:%c\tmodifiers:%d\tstate:%d\trepeat:%d\n",
					t.Timestamp, t.Type, t.Keysym.Sym, t.Keysym.Mod, t.State, t.Repeat)
				// Quit on escape
				if t.Keysym.Sym == sdl.K_ESCAPE {
					running = false
				}
			}
		}

		// Update each widget
		for _, d := range mc.drawables {
			d.Update()
		}

		// This will update the entire screen to this color
		SetDrawColor(mc.renderer, mc.background_color)
		mc.renderer.Clear()

		// Update the ui
		for _, d := range mc.drawables {
			d.Draw(mc.renderer)
		}

		mc.renderer.Present()

		// We need to sleep the remainder of the frame here
	}
}
开发者ID:jbott,项目名称:go-mission-control,代码行数:47,代码来源:missioncontrol.go


示例18: get_event

func get_event() {
	for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
		switch e := event.(type) {
		case *sdl.WindowEvent:
			if e.Event == sdl.WINDOWEVENT_FOCUS_LOST && game.state == PLAY {
				game.state = PAUSE
			}
		case *sdl.QuitEvent:
			window.Destroy()
			os.Exit(0)
		case *sdl.KeyDownEvent:
			control.UpdateKey(int(e.Keysym.Sym), true)
		case *sdl.KeyUpEvent:
			control.UpdateKey(int(e.Keysym.Sym), false)
		}
	}
}
开发者ID:queyenth,项目名称:QuestionMarkGame,代码行数:17,代码来源:main.go


示例19: run

func run() int {
	var window *sdl.Window
	var renderer *sdl.Renderer
	var event sdl.Event
	var running bool
	var err error

	window, err = sdl.CreateWindow(winTitle, sdl.WINDOWPOS_UNDEFINED, sdl.WINDOWPOS_UNDEFINED,
		winWidth, winHeight, sdl.WINDOW_SHOWN)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to create window: %s\n", err)
		return 1
	}
	defer window.Destroy()

	renderer, err = sdl.CreateRenderer(window, -1, sdl.RENDERER_ACCELERATED)
	if err != nil {
		fmt.Fprintf(os.Stderr, "Failed to create renderer: %s\n", err)
		return 2
	}
	defer renderer.Destroy()

	running = true
	for running {
		for event = sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
			switch t := event.(type) {
			case *sdl.QuitEvent:
				running = false
			case *sdl.MouseMotionEvent:
				fmt.Printf("[%d ms] MouseMotion\ttype:%d\tid:%d\tx:%d\ty:%d\txrel:%d\tyrel:%d\n",
					t.Timestamp, t.Type, t.Which, t.X, t.Y, t.XRel, t.YRel)
			case *sdl.MouseButtonEvent:
				fmt.Printf("[%d ms] MouseButton\ttype:%d\tid:%d\tx:%d\ty:%d\tbutton:%d\tstate:%d\n",
					t.Timestamp, t.Type, t.Which, t.X, t.Y, t.Button, t.State)
			case *sdl.MouseWheelEvent:
				fmt.Printf("[%d ms] MouseWheel\ttype:%d\tid:%d\tx:%d\ty:%d\n",
					t.Timestamp, t.Type, t.Which, t.X, t.Y)
			case *sdl.KeyUpEvent:
				fmt.Printf("[%d ms] Keyboard\ttype:%d\tsym:%c\tmodifiers:%d\tstate:%d\trepeat:%d\n",
					t.Timestamp, t.Type, t.Keysym.Sym, t.Keysym.Mod, t.State, t.Repeat)
			}
		}
	}

	return 0
}
开发者ID:tianon,项目名称:gb-integration-tests,代码行数:46,代码来源:events.go


示例20: Handle

func (i *Input) Handle() {
	var event sdl.Event

	copy(i.oldKeyStates, i.KeyStates)
	for event = sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
		switch e := event.(type) {
		case *sdl.QuitEvent:
			G.Quit = true
		case *sdl.MouseButtonEvent:
			i.handleMouseButtonEvent(e)
		case *sdl.KeyDownEvent:
			i.handleKeyDownEvent(e)
		case *sdl.KeyUpEvent:
			i.handleKeyUpEvent(e)
		}
	}
}
开发者ID:fmd,项目名称:gogol,代码行数:17,代码来源:input.go



注:本文中的github.com/veandco/go-sdl2/sdl.PollEvent函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Golang sdl.Quit函数代码示例发布时间:2022-05-28
下一篇:
Golang sdl.Init函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap