00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "Teddy/SpaceGame/Sight.h"
00026 #include "Teddy/PhysicalComponents/LayoutConstraint.h"
00027 #include "Teddy/PhysicalComponents/GradientFill.h"
00028 #include "Teddy/PhysicalComponents/Frame.h"
00029 #include "Teddy/Graphics/Features.h"
00030 #include "Teddy/Graphics/View.h"
00031 using namespace Teddy::PhysicalComponents;
00032
00033
00034 namespace Teddy {
00035 namespace SpaceGame {
00036
00037
00038 void Sight::place( int offset_x, int offset_y ){
00039 Area::place( offset_x, offset_y );
00040 }
00041
00042
00044 Sight::Sight():Area("Sight"){
00045 size = 16;
00046
00047 constraint = new LayoutConstraint();
00048 constraint->local_x_offset_relative = -0.5;
00049 constraint->local_y_offset_relative = -0.5;
00050 constraint->parent_x_offset_relative = 0.5;
00051 constraint->parent_y_offset_relative = 0.5;
00052 constraint->local_x_fill_pixels = 4*size;
00053 constraint->local_y_fill_pixels = 4*size;
00054 }
00055
00056
00058 Sight::~Sight(){
00059 }
00060
00061
00062
00064 void Sight::drawSelf(){
00065 view->disable( TEXTURE_2D );
00066 color( C_LIGHT_GREEN );
00067 beginLines();
00068 vertex2i( 0*size, 2*size );
00069 vertex2i( 1*size, 2*size );
00070 vertex2i( 3*size, 2*size );
00071 vertex2i( 4*size, 2*size );
00072 vertex2i( 2*size, 0*size );
00073 vertex2i( 2*size, 1*size );
00074 vertex2i( 2*size, 3*size );
00075 vertex2i( 2*size, 4*size );
00076 end();
00077
00078 color( C_BLACK );
00079 beginLines();
00080 vertex2i( 0*size, 2*size-1 );
00081 vertex2i( 1*size, 2*size-1 );
00082 vertex2i( 3*size, 2*size-1 );
00083 vertex2i( 4*size, 2*size-1 );
00084 vertex2i( 0*size, 2*size+1 );
00085 vertex2i( 1*size, 2*size+1 );
00086 vertex2i( 3*size, 2*size+1 );
00087 vertex2i( 4*size, 2*size+1 );
00088 vertex2i( 2*size-1, 0*size );
00089 vertex2i( 2*size-1, 1*size );
00090 vertex2i( 2*size-1, 3*size );
00091 vertex2i( 2*size-1, 4*size );
00092 vertex2i( 2*size+1, 0*size );
00093 vertex2i( 2*size+1, 1*size );
00094 vertex2i( 2*size+1, 3*size );
00095 vertex2i( 2*size+1, 4*size );
00096 end();
00097 }
00098
00099
00100 };
00101 };