Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
Merge pull request #11 from inkyblackness/prepare-for-v4
Browse files Browse the repository at this point in the history
Prepare for v4
  • Loading branch information
dertseha authored Mar 14, 2021
2 parents b01e28d + c87a270 commit a8e1038
Show file tree
Hide file tree
Showing 14 changed files with 117 additions and 15 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ run:
- sdl

linters:
# Take an aggressive approach: enable everything and only disable if not useful.
# So far there are fewer to disable than to enable explicitly.
enable-all: true

# linters are disabled if their majority of issues is considered false-positive (intended code)
# and the remaining issues (if existing) aren't worth it.
disable:
- gochecknoglobals
- gocognit # disabled because of the high complexity of demo files
- goimports # disabled because of so many false-positives with "imgui-go"
- gofumpt # disabled because no extra need
- gosec
- maligned
- nestif # disabled because of the high complexity of demo files
- gomnd # disabled as most OpenGL stuff are direct constants.
- funlen # disabled because of example code. While people will probably tend to duplicate this, they'll handle it on their own.
- wsl # this one became too pedantic and with a different style than I would.
Expand Down
Binary file modified assets/screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion cmd/example_glfw_opengl2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"os"

"github.com/inkyblackness/imgui-go/v3"
"github.com/inkyblackness/imgui-go/v4"

"github.com/inkyblackness/imgui-go-examples/internal/example"
"github.com/inkyblackness/imgui-go-examples/internal/platforms"
Expand Down
2 changes: 1 addition & 1 deletion cmd/example_glfw_opengl3/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"os"

"github.com/inkyblackness/imgui-go/v3"
"github.com/inkyblackness/imgui-go/v4"

"github.com/inkyblackness/imgui-go-examples/internal/example"
"github.com/inkyblackness/imgui-go-examples/internal/platforms"
Expand Down
2 changes: 1 addition & 1 deletion cmd/example_sdl_opengl2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"os"

"github.com/inkyblackness/imgui-go/v3"
"github.com/inkyblackness/imgui-go/v4"

"github.com/inkyblackness/imgui-go-examples/internal/example"
"github.com/inkyblackness/imgui-go-examples/internal/platforms"
Expand Down
2 changes: 1 addition & 1 deletion cmd/example_sdl_opengl3/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"os"

"github.com/inkyblackness/imgui-go/v3"
"github.com/inkyblackness/imgui-go/v4"

"github.com/inkyblackness/imgui-go-examples/internal/example"
"github.com/inkyblackness/imgui-go-examples/internal/platforms"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7
github.com/go-gl/glfw v0.0.0-20191125211704-12ad95a8df72
github.com/inkyblackness/imgui-go/v3 v3.0.0
github.com/inkyblackness/imgui-go/v4 v4.0.1
github.com/veandco/go-sdl2 v0.4.0
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluN
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk=
github.com/go-gl/glfw v0.0.0-20191125211704-12ad95a8df72 h1:LgLYrxDRSVv3kStk6louYTP1ekZ6t7HZY/X05KUyaeM=
github.com/go-gl/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/inkyblackness/imgui-go/v3 v3.0.0 h1:+gOBA/xlr528SOGDteKQS+q7QkyBcOi+znhn18BMs/8=
github.com/inkyblackness/imgui-go/v3 v3.0.0/go.mod h1:WdM5LZHuTrjd1d+yd2fA19t3mG538kJ6zOLB2sAXF6U=
github.com/inkyblackness/imgui-go/v4 v4.0.1 h1:TzbdvkDsmuPQ6pEsDkOqFxhOyA0RLbP7r34yRnCUz6Q=
github.com/inkyblackness/imgui-go/v4 v4.0.1/go.mod h1:g8SAGtOYUP7rYaOB2AsVKCEHmPMDmJKgt4z6d+flhb0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
104 changes: 101 additions & 3 deletions internal/demo/Window.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package demo
import (
"fmt"

"github.com/inkyblackness/imgui-go/v3"
"github.com/inkyblackness/imgui-go/v4"
)

type windowFlags struct {
Expand All @@ -18,8 +18,8 @@ type windowFlags struct {
noBringToFront bool
}

func (f windowFlags) combined() int {
flags := 0
func (f windowFlags) combined() imgui.WindowFlags {
flags := imgui.WindowFlagsNone
if f.noTitlebar {
flags |= imgui.WindowFlagsNoTitleBar
}
Expand Down Expand Up @@ -58,6 +58,7 @@ var window = struct {
layout layout
popups popups
columns columns
tables tables
misc misc
}{}

Expand Down Expand Up @@ -153,6 +154,7 @@ func Show(keepOpen *bool) {
window.layout.show()
window.popups.show()
window.columns.show()
window.tables.show()
window.misc.show()

// End of ShowDemoWindow()
Expand Down Expand Up @@ -226,6 +228,102 @@ func (widgets *widgets) show() {
}
}

type tables struct {
background bool
borders bool
noInnerBorders bool
header bool
}

var demoTableHeader = []string{
"Name", "Favourite Food", "Favourite Colour",
}

var demoTable = [][]string{
{"Eric", "Bannana", "Yellow"},
{"Peter", "Apple", "Red"},
{"Bruce", "Liquorice", "Black"},
{"Aaron", "Chocolates", "Blue"},
}

func (tables *tables) show() {
if !imgui.CollapsingHeader("Tables") {
return
}

if imgui.TreeNode("Rows & Columns") {
if imgui.BeginTable("tableRowsAndColumns", 3) {
for row := 0; row < 4; row++ {
imgui.TableNextRow()
for column := 0; column < 3; column++ {
imgui.TableSetColumnIndex(column)
imgui.Text(fmt.Sprintf("Row %d Column %d", row, column))
}
}
imgui.EndTable()
}
imgui.TreePop()
}

if imgui.TreeNode("Options") {
// tables are useful for more than tabulated data. we use tables here
// to facilitate layout of the option checkboxes
if imgui.BeginTable("tableOptions", 2) {
imgui.TableNextRow()
if imgui.TableNextColumn() {
imgui.Checkbox("Background", &tables.background)
}
if imgui.TableNextColumn() {
imgui.Checkbox("Header Row", &tables.header)
}

imgui.TableNextRow()
if imgui.TableNextColumn() {
imgui.Checkbox("Borders", &tables.borders)
}
if tables.borders {
if imgui.TableNextColumn() {
imgui.Checkbox("No Inner Borders", &tables.noInnerBorders)
}
}

imgui.EndTable()
}

// set flags according to the options that have been selected
flgs := imgui.TableFlagsNone
if tables.background {
flgs |= imgui.TableFlagsRowBg
}
if tables.borders {
flgs |= imgui.TableFlagsBorders
if tables.noInnerBorders {
flgs |= imgui.TableFlagsNoBordersInBody
}
}

if imgui.BeginTableV("tableRowsAndColumns", len(demoTableHeader), flgs, imgui.Vec2{}, 0.0) {
if tables.header {
imgui.TableHeadersRow()
for column := 0; column < len(demoTableHeader); column++ {
imgui.TableSetColumnIndex(column)
imgui.Text(demoTableHeader[column])
}
}

for row := 0; row < len(demoTable); row++ {
imgui.TableNextRow()
for column := 0; column < len(demoTableHeader); column++ {
imgui.TableSetColumnIndex(column)
imgui.Text(demoTable[row][column])
}
}
imgui.EndTable()
}
imgui.TreePop()
}
}

type layout struct {
}

Expand Down
2 changes: 1 addition & 1 deletion internal/example/Run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/inkyblackness/imgui-go/v3"
"github.com/inkyblackness/imgui-go/v4"

"github.com/inkyblackness/imgui-go-examples/internal/demo"
)
Expand Down
2 changes: 1 addition & 1 deletion internal/platforms/glfw.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"runtime"

"github.com/go-gl/glfw/v3.2/glfw"
"github.com/inkyblackness/imgui-go/v3"
"github.com/inkyblackness/imgui-go/v4"
)

// GLFWClientAPI identifies the render system that shall be initialized.
Expand Down
2 changes: 1 addition & 1 deletion internal/platforms/sdl.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"
"runtime"

"github.com/inkyblackness/imgui-go/v3"
"github.com/inkyblackness/imgui-go/v4"
"github.com/veandco/go-sdl2/sdl"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/renderers/OpenGL2.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"unsafe"

"github.com/go-gl/gl/v2.1/gl"
"github.com/inkyblackness/imgui-go/v3"
"github.com/inkyblackness/imgui-go/v4"
)

// OpenGL2 implements a renderer based on github.com/go-gl/gl (v2.1).
Expand Down
2 changes: 1 addition & 1 deletion internal/renderers/OpenGL3.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"unsafe"

"github.com/go-gl/gl/v3.2-core/gl"
"github.com/inkyblackness/imgui-go/v3"
"github.com/inkyblackness/imgui-go/v4"
)

// OpenGL3 implements a renderer based on github.com/go-gl/gl (v3.2-core).
Expand Down

0 comments on commit a8e1038

Please sign in to comment.