-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMarkersAndText.nim
49 lines (42 loc) · 1.56 KB
/
MarkersAndText.nim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import imgui
import implot
import utils
#----------------------
# demo_MarkersAndText()
#----------------------
proc demo_MarkersAndText*() =
var
mk_size {.global.}:cfloat
mk_weight{.global.}:cfloat
once:
mk_size = ipGetStyle().markerSize
mk_weight = ipGetStyle().markerWeight
igDragFloat("Marker Size", addr mk_size ,0.1f,2.0f,10.0f,"%.2f px")
igDragFloat("Marker Weight", addr mk_weight,0.05f,0.5f,3.0f,"%.2f px")
if ipBeginPlot("##MarkerStyles", ImVec2(x: -1,y: 0), ImPlotFlags.CanvasOnly):
ipSetupAxes(nullptr, nullptr, ImPlotAxisFlags.NoDecorations, ImPlotAxisFlags.NoDecorations)
ipSetupAxesLimits(0, 10, 0, 12)
var
xs = [1'i8 ,4]
ys = [10'i8,11]
#// filled markers
for m in 0..<ImPlotMarker.COUNT.int32:
igPushID(m)
ipSetNextMarkerStyle(m.ImPlotMarker, mk_size, IMPLOT_AUTO_COL, mk_weight)
ipPlotLine("##Filled", xs.ptz, ys.ptz, 2)
igPopID()
dec ys[0]; dec ys[1]
xs[0] = 6; xs[1] = 9; ys[0] = 10; ys[1] = 11
#// open markers
for m in 0..<ImPlotMarker.COUNT.int32:
igPushID(m)
ipSetNextMarkerStyle(m.ImPlotMarker, mk_size, ImVec4(x: 0,y: 0,z: 0,w: 0), mk_weight)
ipPlotLine("##Open", xs.ptz, ys.ptz, 2)
igPopID()
dec ys[0]; dec ys[1]
ipPlotText("Filled Markers", 2.5f, 6.0f)
ipPlotText("Open Markers", 7.5f, 6.0f)
ipPushStyleColor(ImPlotCol.InlayText, ImVec4(x: 1,y: 0,z: 1,w: 1))
ipPlotText("Vertical Text", 5.0f, 6.0f, ImVec2(x: 0,y: 0), ImPlotTextFlags.Vertical)
ipPopStyleColor()
ipEndPlot()