source: cpp/frams/userinput/modelcheckpoints.h @ 1203

Last change on this file since 1203 was 741, checked in by Maciej Komosinski, 7 years ago

Added just for inspiration/as an example of implementation; now these sources are not used in SDK directly

File size: 2.0 KB
Line 
1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
4
5#ifndef _MODELCHECKPOINTS_H_
6#define _MODELCHECKPOINTS_H_
7
8#include <frams/userinput/modelviewiface.h>
9#include <frams/userinput/modelselprop.h>
10
11/**
12Helper class that manages interactions between checkpoint selector, model display and model selection.
131. Showing geno without checkpoints -> disable checkpoint selector, enable model selection, pass to model display
142. Showing geno with checkpoints -> enable checkpoint selector
152a. Checkpoint selected -> disable model selection, display selected checkpoint
162b. Final stage selected -> enable model selection, display final stage
17*/
18class ModelCheckpointSupport : public ModelViewInterface
19{
20        ModelSelectionPropagator &mod_sel_prop;
21        ModelViewInterface &model_view;
22        Model *mod, *mod_checkpoints;
23        float current_value, max_value;
24        int current_index;
25        bool selection_enabled;
26        int current_checkpoint;
27        bool use_checkpoints;
28        void freeModel();
29        void enableSelection(bool e);
30
31public:
32        enum CheckpointsMode {
33                Disabled /** not displaying checkpoints because use_checkpoints=false in showGeno  */,
34                EnabledUnknown /** checkpoints enabled, displaying main model, checkpoint availability not known, slider not clicked yet */,
35                EnabledActive /** checkpoints enabled, displaying checkpoints or main model depending on the slider  */,
36                EnabledUnavailable /** checkpoints enabled but only the main model is available */
37        };
38        ModelCheckpointSupport(ModelSelectionPropagator &msp, ModelViewInterface &_model_view);
39        virtual ~ModelCheckpointSupport();
40
41        void fromguiPhase(float p);
42        virtual void toguiCheckpoints(CheckpointsMode mode, float maxvalue, float value) {}
43        SString checkpointHint();
44
45        int showGeno(const Geno*, bool use_checkpoints);
46        int showModel(const Model *m);
47        Model *getModel();
48        ModelSelection& getModelSelection();
49        CheckpointsMode getCheckpointsMode();
50};
51
52#endif
Note: See TracBrowser for help on using the repository browser.