I try to make Nano draw "dotts" on the screen while the mouse is clicked, hold down and moving.
I want to paint on the UI screen whit the mouse, simple.
How do I connect the functions inside my class to do this? I tried for 3 days 100 different things.
code is not long you only need to look at 2 small files. DistoTVUI.cpp and .hpp
https://github.com/martinbangens/DistoTV
New programmer need help (onNanoDisplay and onMouse)
Moderators: MattKingUSA, khz
- marbangens
- Established Member
- Posts: 56
- Joined: Fri Nov 16, 2018 8:39 pm
- Been thanked: 6 times
- marbangens
- Established Member
- Posts: 56
- Joined: Fri Nov 16, 2018 8:39 pm
- Been thanked: 6 times
Re: New programmer need help (onNanoDisplay and onMouse)
It seem to me that the problem is that the screen wont get updated or re-drawn after I change the value of the array for the line with the mouse. onNanoDisplay get executed 2 times when the program starts. Then it wont update the screen, even if I call onNanoDisplay again after it wont re-draw.
I see that its possible to change the "position of dots"(the visual line) by defining values
from the start like this.
I see that its possible to change the "position of dots"(the visual line) by defining values
from the start like this.
Code: Select all
int line[190] = {1,2,3,4,5,6,7,8};
Re: New programmer need help (onNanoDisplay and onMouse)
Hi. I think you should update your value, and then call repaint() on the UI.
-
- Established Member
- Posts: 1067
- Joined: Mon May 12, 2014 7:11 am
- Has thanked: 15 times
- Been thanked: 36 times
Re: New programmer need help (onNanoDisplay and onMouse)
bit of pseudo code
repaint() is real code
https://distrho.github.io/DPF/classWindow.html
if the repaint is too stuttery then you need idleCallback(), but we'll cross that bridge when we get there.
Code: Select all
onMouse()
if (mousePress and UI.contains(x.y)
bool mouseDown is true
onMotion()
if (mouseDown and UI.contains(x,y))
get new x,y
repaint(); //
https://distrho.github.io/DPF/classWindow.html
if the repaint is too stuttery then you need idleCallback(), but we'll cross that bridge when we get there.
-
- Established Member
- Posts: 1067
- Joined: Mon May 12, 2014 7:11 am
- Has thanked: 15 times
- Been thanked: 36 times
Re: New programmer need help (onNanoDisplay and onMouse)
Also, why do you need nanovg ?
if you are using image widgets
for drawing you can use DGL code or plain old opengl
zam audio has some good examples
https://github.com/zamaudio/zam-plugins ... ynthUI.cpp
if you want, hop on irc freenode #lad, I'm often there.
or join my matrix room
http://riot.im/app/#/room/#clearlybroke ... ction=chat
if you are using image widgets
for drawing you can use DGL code or plain old opengl
zam audio has some good examples
https://github.com/zamaudio/zam-plugins ... ynthUI.cpp
if you want, hop on irc freenode #lad, I'm often there.
or join my matrix room
http://riot.im/app/#/room/#clearlybroke ... ction=chat
- marbangens
- Established Member
- Posts: 56
- Joined: Fri Nov 16, 2018 8:39 pm
- Been thanked: 6 times
Re: New programmer need help (onNanoDisplay and onMouse)
Hey all, wow thanks for the replies and the support <3
repaint() did it kind of.. Now I got 2 lines one strait and one whit curves
I though NanoVG was gonna be easy for this stuff, that's why . idel callback what is that?
In the documentation I saw something about NanoVG use "states" to redraw the screen?
repaint() did it kind of.. Now I got 2 lines one strait and one whit curves
I though NanoVG was gonna be easy for this stuff, that's why . idel callback what is that?
In the documentation I saw something about NanoVG use "states" to redraw the screen?
- marbangens
- Established Member
- Posts: 56
- Joined: Fri Nov 16, 2018 8:39 pm
- Been thanked: 6 times
Re: New programmer need help (onNanoDisplay and onMouse)
I't Works!! I dide't see it at first, cus I thought my circles where another size