model_blinkenlight.cc
Go to the documentation of this file.
1 //
3 // File: model_blinkenlight
4 // Author: Richard Vaughan
5 // Date: 7 March 2008
6 //
7 // CVS info:
8 // $Source: /home/tcollett/stagecvs/playerstage-cvs/code/stage/libstage/model_blinkenlight.cc,v $
9 // $Author: rtv $
10 // $Revision$
11 //
13 
50 //#define DEBUG 1
51 #include "stage.hh"
52 #include "worldfile.hh"
53 #include "option.hh"
54 using namespace Stg;
55 
56 //TODO make instance attempt to register an option (as customvisualizations do)
57 Option ModelBlinkenlight::showBlinkenData( "Show Blink", "show_blinken", "", true, NULL );
58 
59 
61  Model* parent,
62  const std::string& type ) :
63  Model( world, parent, type ),
64  dutycycle( 1.0 ),
65  enabled( true ),
66  period( 1000 ),
67  on( true )
68 {
69  PRINT_DEBUG2( "Constructing ModelBlinkenlight %d (%s)\n",
70  id, typestr );
71 
72  // Set up sensible defaults
73 
74  this->SetColor( Color( "green" ) );
75 
76 
77  Geom geom;
78  memset( &geom, 0, sizeof(geom)); // no size
79  geom.size.x = 0.02;
80  geom.size.y = 0.02;
81  geom.size.z = 0.02;
82  this->SetGeom( geom );
83 
84 
85  this->Startup();
86 
88 }
89 
91 {
92 }
93 
95 {
96  Model::Load();
97 
98  this->dutycycle = wf->ReadFloat( wf_entity, "dutycycle", this->dutycycle );
99  this->period = wf->ReadInt( wf_entity, "period", this->period );
100  this->enabled = wf->ReadInt( wf_entity, "dutycycle", this->enabled );
101 }
102 
103 
105 {
106  // invert
107  this->on = ! this->on;
108  Model::Update();
109 }
110 
111 
113 {
114  (void)cam; // avoid warning about unused var
115 
116  // TODO XX
117  if( on && showBlinkenData )
118  {
119  //LISTMETHOD( this->blocks, Block*, Draw );
120  }
121 }
122 
Model class
Definition: stage.hh:1742
static Option showBlinkenData
Definition: stage.hh:2832
World class
Definition: stage.hh:814
The Stage library uses its own namespace.
Definition: canvas.hh:8
meters_t x
Definition: stage.hh:228
Geom geom
Definition: stage.hh:1883
Size size
extent
Definition: stage.hh:395
ModelBlinkenlight(World *world, Model *parent, const std::string &type)
#define PRINT_DEBUG2(m, a, b)
Definition: stage.hh:668
Worldfile * wf
Definition: stage.hh:2015
int wf_entity
Definition: stage.hh:2016
void RegisterOption(Option *opt)
Definition: model.cc:996
meters_t y
Definition: stage.hh:228
meters_t z
Definition: stage.hh:228
virtual void Startup()
Definition: model.cc:707
virtual void Update()
Definition: model.cc:735
virtual void DataVisualize(Camera *cam)
virtual void Load()
Definition: model.cc:1422
double ReadFloat(int entity, const char *name, double value)
Definition: worldfile.cc:1434
int ReadInt(int entity, const char *name, int value)
Definition: worldfile.cc:1398
void SetGeom(const Geom &src)
Definition: model.cc:1243
void SetColor(Color col)
Definition: model.cc:1260


stage
Author(s): Richard Vaughan , Brian Gerkey , Reed Hedges , Andrew Howard , Toby Collett , Pooya Karimian , Jeremy Asher , Alex Couture-Beil , Geoff Biggs , Rich Mattes , Abbas Sadat
autogenerated on Mon Jun 10 2019 15:06:09