00001 /* 00002 Gel2D Game Engine - Cross-platform 2D gaming middleware 00003 Copyright (C) 2010-2011 Mark D. Procarione 00004 00005 Gel2D is free software: you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation, either version 3 of the License, or 00008 (at your option) any later version. 00009 00010 Gel2D is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 */ 00015 00016 #ifndef __GELLINE_H__ 00017 #define __GELLINE_H__ 00018 00019 #include "gelObject.h" 00020 #include "gelColor.h" 00021 #include "gelSprite.h" // for vert struct, temporarily 00022 00023 #define MAX_GELLINE_VERTS 64 00024 00025 namespace gel 00026 { 00027 class GelLine : public GelObject 00028 { 00029 public: 00031 GelLine(); 00032 00034 00035 GelLine( float ln_width ); 00036 00038 00040 GelLine( const GelSprite &sprite ); 00041 00043 00046 GelLine( float ln_width, Gel2dVec ln_pos, float ln_rot ); 00047 00049 00050 void setWidth( float w ) { width = w; } 00051 00053 00054 float getWidth() const { return width; } 00055 00056 void setPointSize( float size ) { pointSize = size; } 00057 00058 float getPointSize() const { return pointSize; } 00059 00061 00064 GelColor getCol( int i = 0 ) const { return v[i].col; } 00066 00069 void setCol( GelColor col, int i = -1 ); 00071 00076 void setRGB( float r, float g, float b, int i = -1 ); 00078 00081 float getAlpha( int i = 0 ) const { return v[i].col.a; } 00083 00087 void setAlpha( float alpha, int i = -1 ); 00088 00089 void setLineMode( LineMode mode ) { lineMode = mode; } 00090 LineMode getLineMode() const { return lineMode; } 00091 00093 00094 void drawPoints( bool state ) { dpoints = state; } 00095 00097 00098 void smoothLines( bool mode ) { smooth = mode; } 00099 00101 00102 bool isSmooth() const { return smooth; } 00103 00105 int getNVerts() const { return vnum; } 00106 00108 00109 void addVert( Gel2dVec v_pos ); 00110 00112 00113 void removeVert( int index ); 00114 00116 void render(); 00117 00118 private: 00119 int _pointIntersect( float locx, float locy ); 00120 00121 public: 00122 GelVert v[MAX_GELLINE_VERTS]; 00123 00124 private: 00125 float width; 00126 float pointSize; 00127 00128 LineMode lineMode; 00129 bool dpoints; 00130 bool smooth; 00131 int vnum; 00132 }; 00133 } 00134 00135 #endif // __GELLINE_H__
API Documentation by Mark D. Procarione | Generated by |