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

Golang glfw.SetKeyCallback函数代码示例

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

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



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

示例1: main

func main() {
	var err error

	if err = glfw.Init(); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		return
	}
	defer glfw.Terminate()

	if err = glfw.OpenWindow(Width, Height, 8, 8, 8, 8, 0, 8, glfw.Windowed); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		return
	}
	defer glfw.CloseWindow()

	glfw.SetSwapInterval(1)
	glfw.SetWindowTitle(Title)
	glfw.SetWindowSizeCallback(onResize)
	glfw.SetKeyCallback(onKey)

	gl.ShadeModel(gl.SMOOTH)
	gl.ClearColor(0, 0, 0, 0)
	gl.ClearDepth(1)
	gl.Enable(gl.TEXTURE_2D)

	for running && glfw.WindowParam(glfw.Opened) == 1 {
		update()
		draw()
	}
}
开发者ID:samnardoni,项目名称:ca,代码行数:30,代码来源:ca.go


示例2: main

func main() {
	log.Printf("Starting glfw window")

	err := glfw.Init()
	if err != nil {
		log.Fatalf("Error while starting glfw library: %v", err)
	}
	defer glfw.Terminate()

	err = glfw.OpenWindow(256, 256, 8, 8, 8, 0, 0, 0, glfw.Windowed)
	if err != nil {
		log.Fatalf("Error while opening glfw window: %v", err)
	}
	defer glfw.CloseWindow()

	glfw.SetSwapInterval(1) //vsync on

	glfw.SetWindowTitle("Colored Triangle")

	InitGL()

	glfw.SetWindowSizeCallback(func(w, h int) { InitGLWindow(w, h) })
	glfw.SetKeyCallback(func(key, state int) { HandleKey(key, state) })

	run := true
	for run && glfw.WindowParam(glfw.Opened) == 1 {
		select {
		case exitCode := <-exit:
			log.Printf("Received exit code: %d", exitCode)
			run = false
		default:
			Draw()
		}
	}
}
开发者ID:andrebq,项目名称:tinygl,代码行数:35,代码来源:triangle.go


示例3: Init

func (v *Video) Init(t <-chan []uint32, d <-chan []uint32, n string) {
	v.tick = t
	v.debug = d

	if err := glfw.Init(); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		return
	}

	if err := glfw.OpenWindow(512, 480, 0, 0, 0, 0, 0, 0, glfw.Windowed); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		return
	}

	if gl.Init() != 0 {
		panic("gl error")
	}

	gl.Enable(gl.TEXTURE_2D)

	glfw.SetWindowTitle(fmt.Sprintf("Fergulator - %s", n))
	glfw.SetWindowSizeCallback(reshape)
	glfw.SetWindowCloseCallback(quit_event)
	glfw.SetKeyCallback(KeyListener)
	reshape(512, 480)

	v.tex = gl.GenTexture()

	v.fpsmanager = gfx.NewFramerate()
	v.fpsmanager.SetFramerate(70)
}
开发者ID:wmbest2,项目名称:Fergulator,代码行数:31,代码来源:video.go


示例4: Open

func Open(w, h int, sWin string, fullscreen bool) *Window {

	if GWindow != nil {
		panic("only one Window is allowed")
	}
	listener.GListener = listener.New()
	win := &Window{width: w, height: h, title: sWin, inputListener: listener.GListener}
	GWindow = win

	var err error
	if err = glfw.Init(); err != nil {
		panic(fmt.Sprintf("[e] %v\n", err))
	}
	mode := glfw.Windowed
	if fullscreen {
		mode = glfw.Fullscreen
	}
	if err = glfw.OpenWindow(win.width, win.height, 8, 8, 8, 0, 16, 0, mode); err != nil {
		panic(fmt.Sprintf("[e] %v\n", err))
	}
	gl.Init() //WHY?? (shader creation fails when not)

	glfw.SetSwapInterval(1)        // Enable vertical sync on cards that support it.
	glfw.SetWindowTitle(win.title) // Set window title
	//CALLBACKS
	glfw.SetWindowSizeCallback(func(w, h int) { GWindow.reshape(w, h) })
	glfw.SetWindowCloseCallback(listener.OnClose)
	glfw.SetMouseButtonCallback(listener.OnMouseButton)
	glfw.SetMouseWheelCallback(listener.OnMouseWheel)
	glfw.SetKeyCallback(listener.OnKey)
	glfw.SetCharCallback(listener.OnChar)

	win.initGL()
	return win
}
开发者ID:swantescholz,项目名称:go,代码行数:35,代码来源:window.go


示例5: main

func main() {
	rand.Seed(time.Now().UnixNano())

	glfw.Init()
	defer glfw.Terminate()
	glfw.OpenWindow(Width, Height, 8, 8, 8, 8, 0, 8, glfw.Windowed)
	defer glfw.CloseWindow()

	glfw.SetSwapInterval(1)
	glfw.SetWindowTitle("Chipmunk demo")
	glfw.SetWindowSizeCallback(onResize)
	glfw.SetKeyCallback(onKey)

	initGL()
	initScene()

	Running = true

	for Running && glfw.WindowParam(glfw.Opened) == 1 {
		drawScene()
		space.Step(1.0 / 20.0 / 3.0)
		space.Step(1.0 / 20.0 / 3.0)
		space.Step(1.0 / 20.0 / 3.0)
	}
}
开发者ID:ftrvxmtrx,项目名称:gochipmunk,代码行数:25,代码来源:main.go


示例6: main

func main() {
	glfw.Init()
	defer glfw.Terminate()

	glfw.OpenWindow(640, 480, 8, 8, 8, 8, 0, 0, glfw.Windowed)
	defer glfw.CloseWindow()

	glfw.SetWindowTitle("Tile test")
	glfw.Enable(glfw.StickyKeys)
	glfw.SetSwapInterval(1)
	glfw.SetKeyCallback(inputCallback)

	gl.MatrixMode(gl.PROJECTION)
	gl.LoadIdentity()
	gl.Ortho(0, GridWidth, GridHeight, 0, -1, 1)
	gl.MatrixMode(gl.MODELVIEW)
	gl.Disable(gl.DEPTH_TEST)
	gl.Enable(gl.TEXTURE_2D)
	gl.Enable(gl.BLEND)
	gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)

	gl.ClearColor(0.0, 0.0, 0.0, 1.0)
	initResources()
	initWorld()

	for Running {
		if (time.Since(DT).Nanoseconds() / 1000000) > 15 { //don't loop faster than every 15ms
			DT = time.Now()
			gl.Clear(gl.COLOR_BUFFER_BIT)
			player.update()
			renderScene()
			glfw.SwapBuffers()
		}
	}
}
开发者ID:remirisque,项目名称:miniworld,代码行数:35,代码来源:main.go


示例7: main

func main() {
	var err error
	if err = glfw.Init(); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		return
	}

	defer glfw.Terminate()

	if err = glfw.OpenWindow(Width, Height, 8, 8, 8, 8, 0, 8, glfw.Windowed); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		return
	}

	defer glfw.CloseWindow()

	glfw.SetSwapInterval(1)
	glfw.SetWindowTitle(Title)
	glfw.SetWindowSizeCallback(onResize)
	glfw.SetKeyCallback(onKey)

	initGL()

	running = true
	for running && glfw.WindowParam(glfw.Opened) == 1 {
		drawScene()
	}
}
开发者ID:sycoso,项目名称:glfw,代码行数:28,代码来源:main.go


示例8: InitKeyHandlers

func InitKeyHandlers() {
	glfw.SetKeyCallback(func(key, state int) {
		if state == 0 {
			return
		}
		if key == Ret || key == Enter {
			Screenshot()
			return
		}
		if key == Q {
			recording = !recording
			log.Println("recording:", recording)
			return
		}

		if activeTarget != nil {
			switch key {
			case Left:
				(*activeTarget)[2]--
			case Right:
				(*activeTarget)[2]++
			case Down:
				(*activeTarget)[1]--
			case Up:
				(*activeTarget)[1]++
			case PgDown:
				(*activeTarget)[0]--
			case PgUp:
				(*activeTarget)[0]++
			}
		}

		if f, ok := postUpdate[mode]; ok {
			log.Println("post update", f)
			f()
		}

		if _, ok := keyTarget[key]; ok {
			activeTarget = keyTarget[key]
			mode = key
			log.Println("mode:", mode, "target:", activeTarget)
			return
		}

		if recording {
			Wantscrot = true
		}

		if core.DEBUG {
			log.Println("P:", Viewpos, "C:", Crop1, "V:", Crop2, "R:", Rot, "T:", Time[0])
		}
	})
}
开发者ID:shenyp09,项目名称:mx3,代码行数:53,代码来源:input.go


示例9: main

func main() {
	globalState.Mouse = make(map[int]bool)
	flag.Parse()
	var err error
	if err = glfw.Init(); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		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 glfw.Terminate()

	if err = glfw.OpenWindow(Width, Height, 8, 8, 8, 8, 0, 8, glfw.Windowed); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		return
	}

	defer glfw.CloseWindow()

	glfw.SetSwapInterval(1)
	glfw.SetWindowTitle(Title)
	glfw.SetWindowSizeCallback(onResize)
	glfw.SetKeyCallback(onKey)
	glfw.SetCharCallback(onChar)
	glfw.SetMouseWheelCallback(onWheel)
	glfw.SetMouseButtonCallback(onMouseButton)
	glfw.SetMousePosCallback(onMousePos)

	initGL()

	running = true
	for running && glfw.WindowParam(glfw.Opened) == 1 {
		handleInput()
		drawScene()
	}
}
开发者ID:andrebq,项目名称:wfobj,代码行数:52,代码来源:main.go


示例10: main

func main() {
	var err error
	if err = glfw.Init(); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		return
	}

	// Ensure glfw is cleanly terminated on exit.
	defer glfw.Terminate()

	if err = glfw.OpenWindow(256, 256, 8, 8, 8, 0, 0, 0, glfw.Windowed); err != nil {
		fmt.Fprintf(os.Stderr, "[e] %v\n", err)
		return
	}

	// Ensure window is cleanly closed on exit.
	defer glfw.CloseWindow()

	// Enable vertical sync on cards that support it.
	glfw.SetSwapInterval(1)

	// Set window title
	glfw.SetWindowTitle("Simple GLFW window")

	// Hook some events to demonstrate use of callbacks.
	// These are not necessary if you don't need them.
	glfw.SetWindowSizeCallback(onResize)
	glfw.SetWindowCloseCallback(onClose)
	glfw.SetMouseButtonCallback(onMouseBtn)
	glfw.SetMouseWheelCallback(onMouseWheel)
	glfw.SetKeyCallback(onKey)
	glfw.SetCharCallback(onChar)

	// Start loop
	running := true
	for running {
		// OpenGL rendering goes here.

		// Swap front and back rendering buffers. This also implicitly calls
		// glfw.PollEvents(), so we have valid key/mouse/joystick states after
		// this. This behavior can be disabled by calling glfw.Disable with the
		// argument glfw.AutoPollEvents. You must be sure to manually call
		// PollEvents() or WaitEvents() in this case.
		glfw.SwapBuffers()

		// Break out of loop when Escape key is pressed, or window is closed.
		running = glfw.Key(glfw.KeyEsc) == 0 && glfw.WindowParam(glfw.Opened) == 1
	}
}
开发者ID:andrebq,项目名称:glfw,代码行数:49,代码来源:main.go


示例11: main

func main() {
	flag.Parse()

	if *cpuprofile != "" {
		f, err := os.Create(*cpuprofile)
		if err != nil {
			log.Fatal(err)
		}

		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	if err := readModel(); err != nil {
		log.Fatal(err)
	}

	if err := glfw.Init(); err != nil {
		log.Fatal(err)
	}
	defer glfw.Terminate()

	glfw.OpenWindowHint(glfw.WindowNoResize, 1)

	if err := glfw.OpenWindow(Width, Height, 0, 0, 0, 0, 16, 0, glfw.Windowed); err != nil {
		log.Fatal(err)
		return
	}
	defer glfw.CloseWindow()

	glfw.SetSwapInterval(1)
	glfw.SetWindowTitle(Title)
	glfw.SetKeyCallback(onKey)

	if err := gl.Init(); err != nil {
		log.Fatal(err)
	}

	initScene()
	defer destroyScene()

	for glfw.WindowParam(glfw.Opened) == 1 {
		applyMove()
		drawScene()
		glfw.SwapBuffers()
	}
}
开发者ID:jayschwa,项目名称:groke,代码行数:47,代码来源:bspview.go


示例12: Init

func (o *OpenGl) Init() {
	if err := glfw.Init(); err != nil {
		fmt.Fprintf(os.Stderr, "glfw: %s\n", err)
		return
	}
	defer glfw.Terminate()

	if err := glfw.OpenWindow(o.width, o.height, 0, 0, 0, 0, 16, 0, glfw.Windowed); err != nil {
		fmt.Fprintf(os.Stderr, "glfw: %s\n", err)
		return
	}
	defer glfw.CloseWindow()

	glfw.SetSwapInterval(1)
	glfw.SetWindowTitle(o.title)

	if err := gl.Init(); err != nil {
		fmt.Fprintf(os.Stderr, "gl: %s\n", err)
	}

	glfw.SetKeyCallback(glfw.KeyHandler(o.keyboard))
	glfw.SetMouseButtonCallback(glfw.MouseButtonHandler(o.mouseClick))
	glfw.SetMousePosCallback(glfw.MousePosHandler(o.mouseMove))
	glfw.SetMouseWheelCallback(glfw.MouseWheelHandler(o.mouseWheel))

	if err := o.initScene(); err != nil {
		fmt.Fprintf(os.Stderr, "init: %s\n", err)
		return
	}

	for glfw.WindowParam(glfw.Opened) == 1 {
		gl.Clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT)

		if o.display3d != nil {
			o.set3dView()
			o.display3d()
		}
		if o.display2d != nil {
			o.set2dView()
			o.display2d()
		}

		glfw.SwapBuffers()
		time.Sleep(20 * time.Millisecond)
		//<-o.redisplay
	}
}
开发者ID:knickers,项目名称:GOpenGL,代码行数:47,代码来源:GOpenGL.go


示例13: main

func main() {
	if e := glfw.Init(); e != nil {
		panic(e.Error())
	}

	defer glfw.Terminate()

	if e := glfw.OpenWindow(468, 320, 0, 0, 0, 0, 0, 0, glfw.Windowed); e != nil {
		panic(e.Error())
	}

	if gl.Init() != 0 {
		panic("GL Err")
	}

	glfw.SetKeyCallback(escHandler)

	loop()
}
开发者ID:simonz05,项目名称:draw,代码行数:19,代码来源:draw.go


示例14: main

func main() {
	log.Printf("Starting glfw window")

	err := glfw.Init()
	if err != nil {
		log.Fatalf("Error while starting glfw library: %v", err)
	}
	defer glfw.Terminate()

	err = glfw.OpenWindow(256, 256, 8, 8, 8, 0, 0, 0, glfw.Windowed)
	if err != nil {
		log.Fatalf("Error while opening glfw window: %v", err)
	}
	defer glfw.CloseWindow()

	glfw.SetSwapInterval(1) //vsync on

	glfw.SetWindowTitle("Colored Triangle")

	InitGL()

	glfw.SetWindowSizeCallback(func(w, h int) { InitGLWindow(w, h) })
	glfw.SetKeyCallback(func(key, state int) { HandleKey(key, state) })

	// create a mesh with 3 vertices (a triangle)
	m := &Mesh{make([]*Vector, 3)}
	m.V[0] = &Vector{0, 1, 0, color.NRGBA{1, 0, 0, 0}}
	m.V[1] = &Vector{-1, -1, 0, color.NRGBA{0, 1, 0, 0}}
	m.V[2] = &Vector{1, -1, 0, color.NRGBA{0, 0, 1, 0}}

	run := true
	for run && glfw.WindowParam(glfw.Opened) == 1 {
		select {
		case exitCode := <-exit:
			log.Printf("Received exit code: %d", exitCode)
			run = false
		default:
			Draw(m)
		}
	}
}
开发者ID:andrebq,项目名称:tinygl,代码行数:41,代码来源:scene.go


示例15: main

func main() {

	// Set width and height.
	WIDTH := 960
	HEIGHT := 720

	// Open up a Window (that would potentially be used for OpenGL) with glfw
	if err := glfw.Init(); err != nil {
		// Error.
		fmt.Fprintf(os.Stderr, "Error: %v\n", err)
		return
	}
	defer glfw.Terminate()

	if err := glfw.OpenWindow(WIDTH, HEIGHT, 0, 0, 0, 0, 0, 0, glfw.Windowed); err != nil {
		// Error.
		fmt.Fprintf(os.Stderr, "Error: %v\n", err)
		return
	}

	glfw.SetWindowTitle("LifePack")

	// Initialize.
	// Initialize (pseudo) random number generator (used in other files).
	rand.Seed(time.Now().Unix())

	// We need a way for the user to exit the program.
	// This will be accomplished by making it so, when the user presses
	// the [ESC] key, that the program exists.
	//
	// The keyHandler function makes this happen, and will exit this
	// program if [ESC] is pressed.
	glfw.SetKeyCallback(keyHandler)

	// Set up OpenGL in a way that we can do 2D graphics (as opposed to 3D graphics).
	initialize(WIDTH, HEIGHT)

	// Run.
	run(WIDTH, HEIGHT)
}
开发者ID:reiver,项目名称:lifepack,代码行数:40,代码来源:main.go


示例16: setupWindow

func setupWindow(width int, height int, fullscreen bool) bool {
	// Create OpenGL window
	var windowType int
	if fullScreen {
		windowType = glfw.Fullscreen
	} else {
		windowType = glfw.Windowed
	}

	if err := glfw.OpenWindow(width, height, 8, 8, 8, 8, 24, 8, windowType); err != nil {
		glfw.Terminate()
		return false
	}

	// Disable vertical synchronization
	glfw.SetSwapInterval(0)

	// Set listeners
	glfw.SetWindowCloseCallback(windowCloseListener)
	glfw.SetKeyCallback(keyPressListener)
	glfw.SetMousePosCallback(mouseMoveListener)

	return true
}
开发者ID:floffel03,项目名称:gohorde,代码行数:24,代码来源:knight.go


示例17: main

func main() {
	log.SetFlags(log.Lshortfile)

	//parse flags
	flag.Parse()

	if flags.cpuprofile != "" {
		f, err := os.Create(flags.cpuprofile)
		if err != nil {
			log.Fatal(err)
		}
		pprof.StartCPUProfile(f)
		defer pprof.StopCPUProfile()
	}

	loadSettingsFile()
	Settings.Paused = flags.startPaused

	if flags.buildExamples {
		allExamples()
		return
	}

	wx, wy := 800, 600

	//initialize opengl & glfw
	{
		//init glfw
		if err := glfw.Init(); err != nil {
			log.Printf("Error initializing glfw: %v\n", err)
			return
		}
		defer glfw.Terminate()

		//set window hints
		glfw.OpenWindowHint(glfw.WindowNoResize, 1)

		//create the window
		if err := glfw.OpenWindow(wx, wy, 8, 8, 8, 8, 0, 8, glfw.Windowed); err != nil {
			log.Printf("Error opening Window: %v\n", err)
			return
		}
		defer glfw.CloseWindow()

		//init opengl
		if gl.Init() != 0 {
			panic("gl error")
		}

		//glfw config
		{
			glfw.SetSwapInterval(1)
			glfw.SetWindowTitle("mater test")
		}

		//set additional opengl stuff
		{
			gl.ClearColor(0, 0, 0, 0)
			gl.Enable(gl.BLEND)
			//gl.BlendFunc (gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
			gl.Enable(gl.TEXTURE_2D)
		}
	}

	//setup scene related stuff
	{
		//create empty space
		space = collision.NewSpace()
	}

	//reload settings so they take effect
	reloadSettings()
	saveSettingsFile()

	//set callbacks
	{
		glfw.SetWindowSizeCallback(OnResize)
		glfw.SetKeyCallback(OnKey)
	}

	//init debug console
	console.Init()

	//load savefile passed from the commandline if any
	if flags.file != "" {
		err := loadSpace(flags.file)
		Settings.Paused = true
		if err != nil {
			panic(err)
		}
	}

	//if set to true once a second
	printFPS := false

	//fix timestep to given fps
	const expectedFps = 30.0
	const expectedFrameTime = 1.0 / expectedFps

	//the time at the start of the last frame
//.........这里部分代码省略.........
开发者ID:vova616,项目名称:mater,代码行数:101,代码来源:main.go


示例18: initInput

func initInput() {
	glfw.SetKeyCallback(onKey)
	glfw.SetMouseButtonCallback(onMouseBttn)
	glfw.SetMousePosCallback(onMousePos)
}
开发者ID:dane-unltd,项目名称:gina,代码行数:5,代码来源:input.go


示例19: main

func main() {
	w := 500
	h := 500
	fov := 45.0
	clip_min := 0.1
	clip_max := 1000.0

	aspect_ratio := float64(w) / float64(h)

	glfw.Init()
	glfw.OpenWindow(w, h, 8, 8, 8, 8, 8, 0, glfw.Windowed)

	glfw.SetWindowTitle("Shader Test")
	glfw.SetWindowSizeCallback(resize_window)
	glfw.SetKeyCallback(key_callback)

	gl.ClearColor(0.3, 0.3, 0.3, 1.0)
	gl.ShadeModel(gl.SMOOTH)

	size_window(w, h, fov, aspect_ratio, clip_min, clip_max)

	//Testing sprites
	test_sprite := sprite{height: 1.0, width: 1.0}
	test_sprite.tex = texture("./assets/hedge.gif")
	test_sprite.Y = 3

	new_guy := sprite{height: 0.5, width: 0.5}
	new_guy.tex = texture("./assets/red2.png")
	new_guy.Y = 5

	renderees := new(list.List)
	renderees.PushBack(&new_guy)
	renderees.PushBack(&test_sprite)

	my_camera.init(Vector{0.0, -1.0, 0.0})
	my_camera.front = Vector{0.0, 1.0, 0.0}
	my_camera.top = Vector{0.0, 0.0, 1.0}
	//End testing sprites

	physics_objects := new(list.List)
	physics_objects.PushBack(my_camera)

	dt, err := time.ParseDuration("16.67ms")
	if err != nil {
		die(err)
	}

	fmt.Println("Timestep: ", dt)
	var t float64 = 0
	running := true
	for running {
		t0 := time.Now()
		update(physics_objects, float64(dt.Nanoseconds())/1e6)
		t += 0.025
		new_guy.X = math.Cos(t)
		new_guy.Y = math.Sin(t) + 3.0

		//my_camera.point_at(Vector{new_guy.X, new_guy.Y, new_guy.Z})

		general_render(renderees, my_camera)
		glfw.SwapBuffers()

		dt = time.Since(t0)
		rate := time.Microsecond * 16670
		if dt < rate {
			time.Sleep((rate - dt))
			//fmt.Println("This frame took", float64(dt.Nanoseconds())/1000000, "ms to render.")
		}
		running = glfw.Key(glfw.KeyEsc) == 0 && glfw.WindowParam(glfw.Opened) != 0
	}
}
开发者ID:esnowkropla,项目名称:dep,代码行数:71,代码来源:main.go


示例20: SetKeyCallback

func (w *window) SetKeyCallback(f func(Key, bool)) {
	glfw.SetKeyCallback(func(key, state int) {
		f(Key(key), state == 1)
	})
}
开发者ID:extemporalgenome,项目名称:baukasten,代码行数:5,代码来源:glfw.go



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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