76 |
/* |
/* |
77 |
** Coordinate conversion |
** Coordinate conversion |
78 |
*/ |
*/ |
|
|
|
79 |
void world_to_screen (const px::V2 & pos, int *x, int *y); |
void world_to_screen (const px::V2 & pos, int *x, int *y); |
80 |
WorldArea screen_to_world (const ScreenArea &a); |
WorldArea screen_to_world (const ScreenArea &a); |
81 |
ScreenArea world_to_screen (const WorldArea &a); |
ScreenArea world_to_screen (const WorldArea &a); |
96 |
void draw_all (px::GC &gc); |
void draw_all (px::GC &gc); |
97 |
|
|
98 |
private: |
private: |
99 |
|
void update_layer (DisplayLayer *l, WorldArea wa); |
|
void draw_field (px::GC &gc, int x, int y); |
|
100 |
|
|
101 |
/* |
/* |
102 |
** Variables |
** Variables |
137 |
** DisplayLayer interface. |
** DisplayLayer interface. |
138 |
*/ |
*/ |
139 |
virtual void draw (px::GC &gc, const WorldArea &a, int x, int y) = 0; |
virtual void draw (px::GC &gc, const WorldArea &a, int x, int y) = 0; |
140 |
|
virtual void draw_onepass (px::GC &gc) {} |
141 |
// virtual void notify_expose (px::Rect &area) {} |
// virtual void notify_expose (px::Rect &area) {} |
142 |
virtual void tick (double /*dtime*/) {} |
virtual void tick (double /*dtime*/) {} |
143 |
virtual void new_world (int /*w*/, int /*h*/) {} |
virtual void new_world (int /*w*/, int /*h*/) {} |
231 |
** DisplayLayer interface |
** DisplayLayer interface |
232 |
*/ |
*/ |
233 |
void draw (px::GC &gc, const WorldArea &a, int x, int y); |
void draw (px::GC &gc, const WorldArea &a, int x, int y); |
234 |
|
void draw_onepass (px::GC &gc); |
235 |
void new_world (int, int); |
void new_world (int, int); |
236 |
|
|
237 |
/* |
/* |
335 |
{ |
{ |
336 |
} |
} |
337 |
|
|
338 |
void draw (px::GC &gc, const WorldArea &a, int x, int y); |
void draw (px::GC &gc, const WorldArea &a, int x, int y) |
339 |
|
{} |
340 |
|
void draw_onepass (px::GC &gc); |
341 |
|
|
342 |
RubberHandle add_line (const V2 &p1, const V2 &p2); |
RubberHandle add_line (const V2 &p1, const V2 &p2); |
343 |
void set_startpoint (unsigned id, const V2 &p1); |
void set_startpoint (unsigned id, const V2 &p1); |
402 |
//---------------------------------------- |
//---------------------------------------- |
403 |
class Follower { |
class Follower { |
404 |
public: |
public: |
405 |
Follower (DisplayEngine *e) { m_engine = e; } |
Follower (DisplayEngine *e); |
406 |
virtual ~Follower() {} |
virtual ~Follower() {} |
407 |
virtual void tick(double dtime, const px::V2 &point) = 0; |
virtual void tick(double dtime, const px::V2 &point) = 0; |
408 |
virtual void center(const px::V2 &point) = 0; |
virtual void center(const px::V2 &point); |
409 |
|
|
410 |
|
protected: |
411 |
// void set_engine(DisplayEngine *e) { m_engine = e; } |
// void set_engine(DisplayEngine *e) { m_engine = e; } |
412 |
DisplayEngine *get_engine() const { return m_engine; } |
DisplayEngine *get_engine() const { return m_engine; } |
413 |
|
bool set_offset (V2 offs); |
414 |
|
int get_hoff() const { return m_hoff; } |
415 |
|
int get_voff() const { return m_voff; } |
416 |
|
|
417 |
private: |
private: |
418 |
DisplayEngine *m_engine; |
DisplayEngine *m_engine; |
419 |
|
int m_hoff, m_voff; |
420 |
}; |
}; |
421 |
|
|
422 |
class Follower_Screen : public Follower { |
class Follower_Screen : public Follower { |
423 |
public: |
public: |
424 |
Follower_Screen(DisplayEngine *e); |
Follower_Screen(DisplayEngine *e); |
425 |
void tick(double dtime, const px::V2 &point); |
void tick(double dtime, const px::V2 &point); |
|
void center(const px::V2 &point); |
|
|
private: |
|
|
bool set_offset (px::V2 offs); |
|
|
int m_hoff, m_voff; |
|
426 |
}; |
}; |
427 |
|
|
428 |
class Follower_Scrolling : public Follower { |
class Follower_Scrolling : public Follower { |