![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Simple demo program of SeekBar, NumericLabel, and ButtonGroup. SeekBar, NumericLabel, ButtonGroup の簡単な使い方の例.
Diff: main.cpp
- Revision:
- 0:5ee6e4aa18fc
- Child:
- 1:81cfe85b6544
diff -r 000000000000 -r 5ee6e4aa18fc main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Nov 19 08:26:07 2016 +0000 @@ -0,0 +1,37 @@ +//----------------------------------------------------- +// Label, NumericLabel, SeekBar のデモプログラム +// Demo program of Label, NumericLabel, and SeekBar +// +// 2016/11/19, Copyright (c) 2016 MIKAMI, Naoki +//----------------------------------------------------- + +#include "F746_GUI.hpp" + +using namespace Mikami; + +int main() +{ + Label label1(240, 40, "Example", Label::CENTER, Font16); + Label label2(240, 60, "SeekBar, NumericLabel, ButtonGroup", Label::CENTER, Font16); + + SeekBar myBar(100, 200, 250, -1,1, 0, "-1", "0", "1"); + NumericLabel<float> myLabel(210, 150, "%5.2f", 0); + ButtonGroup bG(400, 200, 50, 30, 2, (string[]){"ON", "OFF"}, 0, 5, 1, 0); + + while (true) + { + float val = myBar.GetValue(); + // Slide thumb on SeekBar + // If thumb is not touched printf() is not executed + if (myBar.Slide()) printf("val = %f\r\n", val); + myLabel.Draw(val); + + int num; + if (bG.GetTouchedNumber(num)) + { + if (num == 0) myBar.Activate(); + else myBar.Inactivate(); + } + wait(0.05f); + } +}