差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
| fltk:example-app-countdown_timer [2025/05/27 17:15] – [プログラムのソースコード] Update program freemikan | fltk:example-app-countdown_timer [2025/06/12 11:45] (現在) – [スクリーンショット] Remove imagebox freemikan | ||
|---|---|---|---|
| 行 1: | 行 1: | ||
| - | ====== | + | ====== |
| - | {{: | + | [[fltk:|{{: |
| ===== スクリーンショット ===== | ===== スクリーンショット ===== | ||
| - | + | {{ : | |
| - | {{ : | + | |
| ===== プロジェクトレイアウト ===== | ===== プロジェクトレイアウト ===== | ||
| 行 44: | 行 43: | ||
| #include < | #include < | ||
| - | #include < | ||
| - | #include < | ||
| #include < | #include < | ||
| #include < | #include < | ||
| 行 52: | 行 49: | ||
| int start = 10; | int start = 10; | ||
| int count = 0; | int count = 0; | ||
| - | Fl_Box *countdown_digits; | + | Fl_Box *digits; |
| Fl_Button *start_button; | Fl_Button *start_button; | ||
| Fl_Button *reset_button; | Fl_Button *reset_button; | ||
| 行 60: | 行 57: | ||
| AppContext *as_app_context(void *ptr) { return static_cast< | AppContext *as_app_context(void *ptr) { return static_cast< | ||
| - | void update_countdown_digits_label(AppContext *ctx) { | + | void update_digits_label(AppContext *ctx) { |
| ctx-> | ctx-> | ||
| std:: | std:: | ||
| - | ctx->countdown_digits-> | + | ctx->digits-> |
| } | } | ||
| 行 70: | 行 67: | ||
| if (ctx-> | if (ctx-> | ||
| + | // Finished | ||
| ctx-> | ctx-> | ||
| return; | return; | ||
| 行 76: | 行 74: | ||
| --ctx-> | --ctx-> | ||
| - | | + | |
| Fl:: | Fl:: | ||
| 行 82: | 行 80: | ||
| void start_button_cb(Fl_Widget *w, void *data) { | void start_button_cb(Fl_Widget *w, void *data) { | ||
| - | auto ctx = as_app_context(data); | ||
| if (!Fl:: | if (!Fl:: | ||
| - | // Start pressed | + | // Start button |
| Fl:: | Fl:: | ||
| w-> | w-> | ||
| } else { | } else { | ||
| - | // Pause pressed | + | // Pause button |
| Fl:: | Fl:: | ||
| w-> | w-> | ||
| 行 97: | 行 94: | ||
| auto ctx = as_app_context(data); | auto ctx = as_app_context(data); | ||
| ctx-> | ctx-> | ||
| - | | + | |
| } | } | ||
| 行 103: | 行 100: | ||
| auto window = new Fl_Window(300, | auto window = new Fl_Window(300, | ||
| - | auto countdown_digits | + | auto digits |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| auto start_button = new Fl_Button(10, | auto start_button = new Fl_Button(10, | ||
| 行 117: | 行 114: | ||
| .start = countdown_start, | .start = countdown_start, | ||
| .count = countdown_start, | .count = countdown_start, | ||
| - | .countdown_digits | + | .digits |
| .start_button = start_button, | .start_button = start_button, | ||
| .reset_button = reset_button, | .reset_button = reset_button, | ||
| }; | }; | ||
| - | | + | |
| start_button-> | start_button-> | ||
| reset_button-> | reset_button-> | ||
