Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImVec2 resetting to zero unsafely #83

Open
Patitotective opened this issue Aug 3, 2022 · 1 comment
Open

ImVec2 resetting to zero unsafely #83

Patitotective opened this issue Aug 3, 2022 · 1 comment

Comments

@Patitotective
Copy link

  • What is the current behaviour?
    data[^1].padding is ImVec2(x: 0f, y: 0f).

  • Please provide the steps to reproduce and if possible a minimal demo of the problem

import nimgl/imgui

type Toast = object
  title*: string
  content*: string
  padding*: ImVec2
  opacity*: float32
  separator*: bool

var data: seq[Toast]

data.add(Toast(padding: ImVec2(x: 10, y: 10)))

assert data[^1].padding == ImVec2(x: 0, y: 0)
  • What is the expected behaviour?
    data[^1].padding to be ImVec2(x: 10f, y: 10f),

  • Please tell us about your environment

    • Version: 1.3.2
    • OS: Linux
    • Bindings: ImGui
    • Backend: CPP
    • Nim Version: 1.6.5
    • Compiler used: GCC
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, docs.gl, documentation etc)

@xrfez
Copy link

xrfez commented Oct 25, 2022

Toast should be a ref object.

import nimgl/imgui

type Toast = ref object
  title*: string
  content*: string
  padding*: ImVec2
  opacity*: float32
  separator*: bool

var data: seq[Toast]

data.add(Toast(padding: ImVec2(x: 10, y: 10)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants