Skip to content

Commit

Permalink
fixed: some compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
dinau committed Sep 5, 2024
1 parent 19e0315 commit a08e313
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: windows-2019
strategy:
matrix:
nim: [ '2.0.6' ]
nim: [ '2.0.8' ]
name: Nim ${{ matrix.nim }} compilation
steps:
- uses: actions/checkout@v4
Expand Down
Binary file modified examples/glfw_opengl3_image_load/res/imguin64.res
Binary file not shown.
Binary file modified examples/glfw_opengl3_image_save/res/imguin64.res
Binary file not shown.
4 changes: 2 additions & 2 deletions examples/glfw_opengl3_image_save/saveImage.nim
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ proc saveImage*(fname:string, xs, ys, imageWidth, imageHeight:int, comp:int = RG
#// 読み取るOpneGLのバッファを指定 GL_FRONT:フロントバッファ GL_BACK:バックバッファ
glReadBuffer( GL_BACK )
#// OpenGLで画面に描画されている内容をバッファに格納
glReadPixels( xs, ys, # 読み取る領域の左下隅のx,y座標 //0 or getCurrentWidth() - 1
imageWidth, imageHeight, # 読み取る領域
glReadPixels( xs.GLint, ys.GLint, # 読み取る領域の左下隅のx,y座標 //0 or getCurrentWidth() - 1
imageWidth.GLsizei, imageHeight.GLsizei, # 読み取る領域
GL_RGB, # it means GL_BGR, //取得したい色情報の形式
GL_UNSIGNED_BYTE, # 読み取ったデータを保存する配列の型
texBuffer[0].addr # ビットマップのピクセルデータ(実際にはバイト配列)へのポインタ
Expand Down
Binary file modified examples/glfw_opengl3_imnodes/save_load.bytes
Binary file not shown.
4 changes: 2 additions & 2 deletions examples/glfw_opengl3_nimgl_imguin_jp/imgui.ini
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ Size=321,305
Collapsed=0

[Window][[ImGui: v1.91.0](起動時フォント:メイリオ - meiryo.ttc)]
Pos=60,60
Size=321,305
Pos=39,25
Size=357,358
Collapsed=0

[Docking][Data]
Expand Down
12 changes: 7 additions & 5 deletions examples/utils/loadImage.nim
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Install packages
# nimble stb_image nimgl
import os
import nimgl/[opengl,glfw]
import stb_nim/stb_image
import stb_image/read as stbi

#---------------------
# loadTextureFromFile
#---------------------
proc loadTextureFromFile*(filename: string, outTexture: var GLuint, outWidth: var int, outHeight: var int): bool =
var
channels: int
image_data = stbi_load(filename.cstring, outWidth.addr, outHeight.addr, channels.addr, STBI_rgb_alpha)
image_data = stbi.load(filename, outWidth, outHeight, channels, stbi.RGBA)

# Create a OpenGL texture identifier
glGenTextures(1, addr outTexture)
Expand Down Expand Up @@ -39,9 +40,10 @@ proc LoadTileBarIcon*(window:GLFWwindow,iconName:string) =
var
w, h: int
channels: int
let pixels = stbi_load(iconName.cstring, w.addr, h.addr, channels.addr, STBI_rgb_alpha)
let img = GLFWImage(width: w.int32, height: h.int32
, pixels: cast[ptr cuchar](pixels))
pixels: seq[byte]
pixels = stbi.load(iconName, w, h, channels, stbi.RGBA)
var img = GLFWImage(width: w.int32, height: h.int32
, pixels: cast[ptr cuchar](pixels[0].addr))
glfw.setWindowIcon(window, 1, img.addr)
else:
echo "Not found: ",iconName
Expand Down
8 changes: 5 additions & 3 deletions imguin.nimble
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
# Package

version = "1.91.0.1"
version = "1.91.0.2"
author = "dinau"
description = "Imguin: ImGui / ImPlot / ImNodes wrapper using Futhark"
license = "MIT"
srcDir = "src"
skipDirs = @["examples","src/img","src/imguin/private/updater"]
bin = @["imguin"]


# Dependencies

requires "nim >= 2.0.2"
requires "nimgl >= 1.3.2"
#requires "futhark >= 0.13.2"
#requires "futhark == 0.13.4"
requires "sdl2_nim"
requires "tinydialogs"
requires "https://github.com/DanielBelmes/stb_nim >= 0.1.0"
requires "stb_image"
requires "glfw"

let TARGET = "imguin"
let Opts =""
Expand Down
89 changes: 43 additions & 46 deletions src/imguin/cimgui_defs.nim

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/imguin/impl_sdl2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ proc currentSourceDir(): string {.compileTime.} =
# Definitions of abusolute path

const
MinGwPath = "c:/drvDx/msys32/mingw32" # for windows10
MinGwPath = "c:/drvdx/msys64/mingw64" # for windows10 or later

# Set root path of ImGui/CImGui
const CImguiRootPath = joinPath(currentSourceDir(),"private/cimgui")
Expand Down

0 comments on commit a08e313

Please sign in to comment.