![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Simple demo program of SeekBar, NumericLabel, and ButtonGroup. SeekBar, NumericLabel, ButtonGroup の簡単な使い方の例.
main.cpp@2:df50384a78e9, 2017-03-17 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Fri Mar 17 01:24:09 2017 +0000
- Revision:
- 2:df50384a78e9
- Parent:
- 1:81cfe85b6544
- Child:
- 3:2d0f4ed8babd
3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 1:81cfe85b6544 | 1 | //--------------------------------------------------------- |
MikamiUitOpen | 1:81cfe85b6544 | 2 | // SeekBar, NumericLabel, ButtonGroup のデモプログラム |
MikamiUitOpen | 1:81cfe85b6544 | 3 | // Demo program of SeekBar, NumericLabel, and ButtonGroup |
MikamiUitOpen | 0:5ee6e4aa18fc | 4 | // |
MikamiUitOpen | 2:df50384a78e9 | 5 | // 2017/03/17, Copyright (c) 2017 MIKAMI, Naoki |
MikamiUitOpen | 1:81cfe85b6544 | 6 | //--------------------------------------------------------- |
MikamiUitOpen | 0:5ee6e4aa18fc | 7 | |
MikamiUitOpen | 0:5ee6e4aa18fc | 8 | #include "F746_GUI.hpp" |
MikamiUitOpen | 0:5ee6e4aa18fc | 9 | using namespace Mikami; |
MikamiUitOpen | 0:5ee6e4aa18fc | 10 | |
MikamiUitOpen | 0:5ee6e4aa18fc | 11 | int main() |
MikamiUitOpen | 0:5ee6e4aa18fc | 12 | { |
MikamiUitOpen | 0:5ee6e4aa18fc | 13 | Label label1(240, 40, "Example", Label::CENTER, Font16); |
MikamiUitOpen | 2:df50384a78e9 | 14 | Label label2(240, 60, "SeekBar, NumericLabel, ButtonGroup", |
MikamiUitOpen | 2:df50384a78e9 | 15 | Label::CENTER, Font16); |
MikamiUitOpen | 0:5ee6e4aa18fc | 16 | |
MikamiUitOpen | 0:5ee6e4aa18fc | 17 | SeekBar myBar(100, 200, 250, -1,1, 0, "-1", "0", "1"); |
MikamiUitOpen | 0:5ee6e4aa18fc | 18 | NumericLabel<float> myLabel(210, 150, "%5.2f", 0); |
MikamiUitOpen | 2:df50384a78e9 | 19 | ButtonGroup bG(420, 196, 50, 36, 2, (string[]){"ON", "OFF"}, 0, 5, 1, 0); |
MikamiUitOpen | 0:5ee6e4aa18fc | 20 | |
MikamiUitOpen | 0:5ee6e4aa18fc | 21 | while (true) |
MikamiUitOpen | 0:5ee6e4aa18fc | 22 | { |
MikamiUitOpen | 0:5ee6e4aa18fc | 23 | float val = myBar.GetValue(); |
MikamiUitOpen | 0:5ee6e4aa18fc | 24 | // Slide thumb on SeekBar |
MikamiUitOpen | 0:5ee6e4aa18fc | 25 | // If thumb is not touched printf() is not executed |
MikamiUitOpen | 0:5ee6e4aa18fc | 26 | if (myBar.Slide()) printf("val = %f\r\n", val); |
MikamiUitOpen | 0:5ee6e4aa18fc | 27 | myLabel.Draw(val); |
MikamiUitOpen | 0:5ee6e4aa18fc | 28 | |
MikamiUitOpen | 0:5ee6e4aa18fc | 29 | int num; |
MikamiUitOpen | 0:5ee6e4aa18fc | 30 | if (bG.GetTouchedNumber(num)) |
MikamiUitOpen | 0:5ee6e4aa18fc | 31 | { |
MikamiUitOpen | 0:5ee6e4aa18fc | 32 | if (num == 0) myBar.Activate(); |
MikamiUitOpen | 0:5ee6e4aa18fc | 33 | else myBar.Inactivate(); |
MikamiUitOpen | 0:5ee6e4aa18fc | 34 | } |
MikamiUitOpen | 0:5ee6e4aa18fc | 35 | wait(0.05f); |
MikamiUitOpen | 0:5ee6e4aa18fc | 36 | } |
MikamiUitOpen | 0:5ee6e4aa18fc | 37 | } |