当前位置: 首页>>代码示例>>Golang>>正文


Golang Region.PushClipPlanes方法代码示例

本文整理汇总了Golang中github.com/runningwild/glop/gui.Region.PushClipPlanes方法的典型用法代码示例。如果您正苦于以下问题:Golang Region.PushClipPlanes方法的具体用法?Golang Region.PushClipPlanes怎么用?Golang Region.PushClipPlanes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/runningwild/glop/gui.Region的用法示例。


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

示例1: Draw

func (hv *HouseViewer) Draw(region gui.Region) {
	region.PushClipPlanes()
	defer region.PopClipPlanes()

	hv.Render_region = region

	hv.temp_floor_drawers = hv.temp_floor_drawers[0:0]
	if hv.Edit_mode {
		for _, spawn := range hv.house.Floors[0].Spawns {
			hv.temp_floor_drawers = append(hv.temp_floor_drawers, spawn)
		}
	}
	for _, fd := range hv.floor_drawers {
		hv.temp_floor_drawers = append(hv.temp_floor_drawers, fd)
	}

	hv.house.Floors[0].render(region, hv.fx, hv.fy, hv.angle, hv.zoom, hv.drawables, hv.Los_tex, hv.temp_floor_drawers)
}
开发者ID:RickDakan,项目名称:haunts,代码行数:18,代码来源:house_viewer.go

示例2: Draw

func (rv *RoomViewer) Draw(region gui.Region) {
	region.PushClipPlanes()
	defer region.PopClipPlanes()

	if rv.Render_region.X != region.X || rv.Render_region.Y != region.Y || rv.Render_region.Dx != region.Dx || rv.Render_region.Dy != region.Dy {
		rv.Render_region = region
		rv.makeMat()
	}

	gl.MatrixMode(gl.MODELVIEW)
	gl.PushMatrix()
	defer gl.PopMatrix()
	gl.LoadIdentity()
	gl.MultMatrixf(&rv.mat[0])

	// rv.room.render(rv.mat, rv.left_wall_mat, rv.right_wall_mat)
	rv.room.setupGlStuff()
	rv.room.far_left.wall_alpha = 255
	rv.room.far_right.wall_alpha = 255
	rv.room.render(rv.mat, rv.left_wall_mat, rv.right_wall_mat, rv.zoom, 255, nil, nil, nil)
	return

	rv.cstack.Push(1, 1, 1, 1)
	defer rv.cstack.Pop()
	drawPrep()
	drawWall(rv.room, rv.mat, rv.left_wall_mat, rv.right_wall_mat, rv.Temp.WallTexture, doorInfo{}, rv.cstack, nil, 1.0)
	drawFloor(rv.room, rv.mat, rv.Temp.WallTexture, rv.cstack, nil, 1.0, nil)
	rv.drawFloor()
	if rv.edit_mode == editCells {
		rv.cstack.Pop()
		rv.cstack.Push(1, 1, 1, 0.1)
	} else {
		rv.cstack.Push(1, 1, 1, 1)
		defer rv.cstack.Pop()
	}
	drawFurniture(0, 0, rv.mat, rv.zoom, rv.room.Furniture, rv.Temp.Furniture, nil, rv.cstack, nil, 1.0)
}
开发者ID:hilerchyn,项目名称:haunts,代码行数:37,代码来源:room_viewer.go

示例3: Draw

func (rc *RosterChooser) Draw(r gui.Region) {
	rc.Render_region = r
	r.PushClipPlanes()
	defer r.PopClipPlanes()
	gl.Enable(gl.TEXTURE_2D)

	{ // Up button
		x := r.X
		y := r.Y + r.Dy - rc.layout.Up.Data().Dy()
		rc.render.up.X = x
		rc.render.up.Y = y
		rc.render.up.Dx = rc.layout.Up.Data().Dx()
		rc.render.up.Dy = rc.layout.Up.Data().Dy()
		if rc.mouse.Inside(rc.render.up) {
			gl.Color4d(1, 1, 1, 1)
		} else {
			gl.Color4d(0.8, 0.8, 0.8, 1)
		}
		rc.layout.Up.Data().RenderNatural(x, y)
	}

	{ // Down button
		x := r.X
		y := r.Y + rc.layout.Down.Data().Dy()
		rc.render.down.X = x
		rc.render.down.Y = y
		rc.render.down.Dx = rc.layout.Down.Data().Dx()
		rc.render.down.Dy = rc.layout.Down.Data().Dy()
		if rc.mouse.Inside(rc.render.down) {
			gl.Color4d(1, 1, 1, 1)
		} else {
			gl.Color4d(0.8, 0.8, 0.8, 1)
		}
		rc.layout.Down.Data().RenderNatural(x, y)
	}

	{ // Options
		rc.render.all_options.X = r.X + rc.layout.Down.Data().Dx()
		rc.render.all_options.Y = r.Y + r.Dy - rc.layout.Num_options*rc.layout.Option.Dy
		rc.render.all_options.Dx = rc.layout.Option.Dx
		rc.render.all_options.Dy = rc.layout.Num_options * rc.layout.Option.Dy
		rc.render.all_options.PushClipPlanes()
		x := rc.render.all_options.X
		y := r.Y + r.Dy - rc.layout.Option.Dy + int(float64(rc.layout.Option.Dy)*rc.focus_pos)
		for i := range rc.options {
			rc.render.options[i] = gui.Region{
				gui.Point{x, y},
				gui.Dims{rc.layout.Option.Dx, rc.layout.Option.Dy},
			}
			hovered := rc.mouse.Inside(rc.render.options[i])
			selected := rc.selected[i]
			selectable := rc.selector(i, rc.selected, false)
			rc.options[i].Draw(hovered, selected, selectable, rc.render.options[i])
			y -= rc.layout.Option.Dy
		}

		rc.render.all_options.PopClipPlanes()
	}

	{ // Text
		d := base.GetDictionary(15)
		x := r.X
		y := float64(r.Y) + d.MaxHeight()/2
		x1 := float64(x + r.Dx/3)
		x2 := float64(x + (2*r.Dx)/3)

		rc.render.done = gui.Region{
			gui.Point{x, r.Y},
			gui.Dims{r.Dx / 2, int(d.MaxHeight() * 2)},
		}
		rc.render.undo = gui.Region{
			gui.Point{x + r.Dx/2, r.Y},
			gui.Dims{r.Dx / 2, int(d.MaxHeight() * 2)},
		}

		if rc.mouse.Inside(rc.render.done) {
			gl.Color4d(1, 1, 1, 1)
		} else {
			gl.Color4d(0.6, 0.6, 0.6, 1)
		}
		d.RenderString("Done", x1, y, 0, d.MaxHeight(), gui.Center)

		if rc.on_undo != nil {
			if rc.mouse.Inside(rc.render.undo) {
				gl.Color4d(1, 1, 1, 1)
			} else {
				gl.Color4d(0.6, 0.6, 0.6, 1)
			}
			d.RenderString("Undo", x2, y, 0, d.MaxHeight(), gui.Center)
		}

	}
}
开发者ID:RickDakan,项目名称:haunts,代码行数:93,代码来源:roster_chooser.go

示例4: Draw

func (gp *GamePanel) Draw(region gui.Region) {
	gp.AnchorBox.Draw(region)
	region.PushClipPlanes()
	defer region.PopClipPlanes()
}
开发者ID:RickDakan,项目名称:haunts,代码行数:5,代码来源:game.go

示例5: Draw

func (m *MainBar) Draw(region gui.Region) {
	m.region = region
	gl.Enable(gl.TEXTURE_2D)
	m.layout.Background.Data().Bind()
	gl.Color4d(1, 1, 1, 1)
	gl.Begin(gl.QUADS)
	gl.TexCoord2d(0, 0)
	gl.Vertex2i(region.X, region.Y)

	gl.TexCoord2d(0, -1)
	gl.Vertex2i(region.X, region.Y+region.Dy)

	gl.TexCoord2d(1, -1)
	gl.Vertex2i(region.X+region.Dx, region.Y+region.Dy)

	gl.TexCoord2d(1, 0)
	gl.Vertex2i(region.X+region.Dx, region.Y)
	gl.End()

	buttons := m.no_actions_buttons
	if m.ent != nil && len(m.ent.Actions) > m.layout.Actions.Count {
		buttons = m.all_buttons
	}
	for _, button := range buttons {
		button.RenderAt(region.X, region.Y)
	}

	ent := m.game.HoveredEnt()
	if ent == nil {
		ent = m.ent
	}
	if ent != nil && ent.Stats != nil {
		gl.Color4d(1, 1, 1, 1)
		ent.Still.Data().Bind()
		tdx := ent.Still.Data().Dx()
		tdy := ent.Still.Data().Dy()
		cx := region.X + m.layout.CenterStillFrame.X
		cy := region.Y + m.layout.CenterStillFrame.Y
		gl.Begin(gl.QUADS)
		gl.TexCoord2d(0, 0)
		gl.Vertex2i(cx-tdx/2, cy-tdy/2)

		gl.TexCoord2d(0, -1)
		gl.Vertex2i(cx-tdx/2, cy+tdy/2)

		gl.TexCoord2d(1, -1)
		gl.Vertex2i(cx+tdx/2, cy+tdy/2)

		gl.TexCoord2d(1, 0)
		gl.Vertex2i(cx+tdx/2, cy-tdy/2)
		gl.End()

		m.layout.Name.RenderString(ent.Name)
		m.layout.Ap.RenderString(fmt.Sprintf("Ap:%d", ent.Stats.ApCur()))
		m.layout.Hp.RenderString(fmt.Sprintf("Hp:%d", ent.Stats.HpCur()))
		m.layout.Corpus.RenderString(fmt.Sprintf("Corpus:%d", ent.Stats.Corpus()))
		m.layout.Ego.RenderString(fmt.Sprintf("Ego:%d", ent.Stats.Ego()))

		gl.Color4d(1, 1, 1, 1)
		m.layout.Divider.Data().Bind()
		tdx = m.layout.Divider.Data().Dx()
		tdy = m.layout.Divider.Data().Dy()
		cx = region.X + m.layout.Name.X
		cy = region.Y + m.layout.Name.Y - 5
		gl.Begin(gl.QUADS)
		gl.TexCoord2d(0, 0)
		gl.Vertex2i(cx-tdx/2, cy-tdy/2)

		gl.TexCoord2d(0, -1)
		gl.Vertex2i(cx-tdx/2, cy+(tdy+1)/2)

		gl.TexCoord2d(1, -1)
		gl.Vertex2i(cx+(tdx+1)/2, cy+(tdy+1)/2)

		gl.TexCoord2d(1, 0)
		gl.Vertex2i(cx+(tdx+1)/2, cy-tdy/2)
		gl.End()
	}
	if m.ent != nil && m.ent.Stats != nil {
		// Actions
		{
			spacing := m.layout.Actions.Icon_size * float64(m.layout.Actions.Count)
			spacing = m.layout.Actions.Width - spacing
			spacing /= float64(m.layout.Actions.Count - 1)
			m.state.Actions.space = spacing
			s := m.layout.Actions.Icon_size
			num_actions := len(m.ent.Actions)
			xpos := m.layout.Actions.X

			if num_actions > m.layout.Actions.Count {
				xpos -= m.state.Actions.scroll_pos * (s + spacing)
			}
			d := base.GetDictionary(10)
			var r gui.Region
			r.X = int(m.layout.Actions.X)
			r.Y = int(m.layout.Actions.Y - d.MaxHeight())
			r.Dx = int(m.layout.Actions.Width)
			r.Dy = int(m.layout.Actions.Icon_size + d.MaxHeight())
			r.PushClipPlanes()

//.........这里部分代码省略.........
开发者ID:RickDakan,项目名称:haunts,代码行数:101,代码来源:ui_main_bar.go


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