Skip to content

Commit

Permalink
Update mwe_04.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
ufechner7 committed Mar 28, 2024
1 parent 50f71d2 commit 354db63
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions mwes/mwe_04.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,9 @@ end
stats = Stats(333, 3900, 25)

function show_stats(stats::Stats)
fig = GLMakie.Figure(size = (400, 400))
lscene = GLMakie.LScene(fig[1, 1], show_axis=false)
if Sys.islinux()
lin_font="/usr/share/fonts/truetype/ttf-bitstream-vera/VeraMono.ttf"
if isfile(lin_font)
font=lin_font
else
font="/usr/share/fonts/truetype/freefont/FreeMono.ttf"
end
else
font="Courier New"
end
function print(lbl::String, value::String; line, font=font)
GLMakie.text!(lscene, position = GLMakie.Point2f( 10, 360-line*32), lbl; fontsize = 24, space=:pixel)
GLMakie.text!(lscene, position = GLMakie.Point2f(250, 360-line*32), value; fontsize = 24, font, space=:pixel)
line +=1
end
line = print("energy: ", @sprintf("%5.0f Wh", stats.e_mech); line = 1)
line = print("max force: ", @sprintf("%5.0f N", stats.max_force); line)
line = print("min height:", @sprintf("%5.0f m", stats.min_height); line)

display(GLMakie.Screen(), fig)
# fig = GLMakie.Figure(size = (400, 400))
scene = GLMakie.Scene()
GLMakie.text!(scene, 20, 0, text="hello", fontsize = 30)
display(GLMakie.Screen(), scene)
nothing
end

0 comments on commit 354db63

Please sign in to comment.