1 /*
2  * Copyright (C) 2004 Ivo Danihelka (ivo@danihelka.net)
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  */
9 #include "RopeDecor.h"
10 
11 #include "Cube.h"
12 
13 #include "View.h"
14 
15 #include "SDL_gfxPrimitives.h"
16 
17 //-----------------------------------------------------------------
RopeDecor(const Cube * model1,const Cube * model2,const V2 & shift1,const V2 & shift2)18 RopeDecor::RopeDecor(const Cube *model1, const Cube *model2,
19         const V2 &shift1, const V2 &shift2)
20 : m_shift1(shift1), m_shift2(shift2)
21 {
22     m_model1 = model1;
23     m_model2 = model2;
24 }
25 //-----------------------------------------------------------------
26 /**
27  * Draw line from one model to second model.
28  */
29 void
drawOnScreen(const View * view,SDL_Surface * screen)30 RopeDecor::drawOnScreen(const View *view, SDL_Surface *screen)
31 {
32     V2 loc1 = view->getScreenPos(m_model1).plus(m_shift1);
33     V2 loc2 = view->getScreenPos(m_model2).plus(m_shift2);
34 
35     //NOTE: steel color
36     Uint32 colorRGBA = 0x30404eff;
37     lineColor(screen, loc1.getX(), loc1.getY(),
38             loc2.getX(), loc2.getY(), colorRGBA);
39 }
40 
41