Skip to content

Commit

Permalink
0.0.6 - nodraw, 4 perspectives (jumping left)
Browse files Browse the repository at this point in the history
  • Loading branch information
penguin673 committed May 20, 2008
0 parents commit 7e27cf7
Show file tree
Hide file tree
Showing 38 changed files with 8,377 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
CXXFLAGS = -I./ -I../include -DTIXML_USE_STL -g3 -Wall
TINYXML_USE_STL := YES

.SUFFIXES: .cpp .OBJ

all: echo_gfx.o echo_loader.o echo_math.o echo_ns.o echo_stage.o echo_sys_linux.o escgrid.o grid.o hole.o main.o stair.o t_grid.o tinyxml/tinystr.o tinyxml/tinyxml.o tinyxml/tinyxmlerror.o tinyxml/tinyxmlparser.o
gcc tinyxml/*.o *.o -DTIXML_USE_STL -lGL -lGLU /usr/lib/libglut.so.3.8.0 -lpthread -g3 -Wall -o l-echo

.cpp.OBJ:
i586-mingw32msvc-g++ $(CXXFLAGS) -c -o $@ $<

echo_gfx.OBJ: echo_gfx.cpp
echo_loader.OBJ: echo_loader.cpp
echo_math.OBJ: echo_math.cpp
echo_ns.OBJ: echo_ns.cpp
echo_stage.OBJ: echo_stage.cpp
echo_sys_w32.OBJ: echo_sys_w32.cpp
escgrid.OBJ: escgrid.cpp
grid.OBJ: grid.cpp
hole.OBJ: hole.cpp
main.OBJ: main.cpp
stair.OBJ: stair.cpp
t_grid.OBJ: t_grid.cpp
tinyxml/tinystr.OBJ: tinyxml/tinystr.cpp
tinyxml/tinyxml.OBJ: tinyxml/tinyxml.cpp
tinyxml/tinyxmlerror.OBJ: tinyxml/tinyxmlerror.cpp
tinyxml/tinyxmlparser.OBJ: tinyxml/tinyxmlparser.cpp

w32: echo_gfx.OBJ echo_loader.OBJ echo_math.OBJ echo_ns.OBJ echo_stage.OBJ echo_sys_w32.OBJ escgrid.OBJ grid.OBJ hole.OBJ main.OBJ stair.OBJ t_grid.OBJ tinyxml/tinystr.OBJ tinyxml/tinyxml.OBJ tinyxml/tinyxmlerror.OBJ tinyxml/tinyxmlparser.OBJ
i586-mingw32msvc-g++ *.OBJ tinyxml/*.OBJ glut32.lib -lGL -lGLU -g3 -Wall -o l-echo.exe

clean:
rm *.o *.OBJ l-echo.exe l-echo || echo

clean-all: clean
rm tinyxml/*.o

run: all
./l-echo perspective_movement.xml

dbg: all
gdb ./l-echo

136 changes: 136 additions & 0 deletions echo_gfx.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
// echo_gfx.cpp

/*
This file is part of L-Echo.
L-Echo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
L-Echo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with L-Echo. If not, see <http://www.gnu.org/licenses/>.
*/

#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>

#include <grid.h>
#include <echo_gfx.h>
#include <echo_math.h>
#include <cstdlib>
#include <iostream>

void draw_line(vector3f p1, vector3f p2)
{
glColor3f(0, 0, 0);
glBegin(GL_LINES);
glVertex3f(p1.x, p1.y, p1.z);
glVertex3f(p2.x, p2.y, p2.z);
glEnd();
}

void draw_line(line3f ln)
{
draw_line(ln.p1, ln.p2);
}

static int has_line(line3f* ptr, line3f line)
{
return(ptr[0] == line || ptr[1] == line || ptr[2] == line || ptr[3] == line);
}

void draw_hole(vector3f pos)
{
glColor3f(0, 0, 0);
glPushMatrix();
glTranslatef(pos.x, pos.y + 0.03, pos.z);
glBegin(GL_QUADS);
glVertex3f(0, 0, HALF_GRID);
glVertex3f(HALF_GRID, 0, 0);
glVertex3f(0, 0, -HALF_GRID);
glVertex3f(-HALF_GRID, 0, 0);
glEnd();
glPopMatrix();
}

void draw_launcher(vector3f pos)
{
glColor3f(0, 0, 0);
glPushMatrix();
glTranslatef(pos.x, pos.y + 0.03, pos.z);
glBegin(GL_LINE_LOOP);
glVertex3f(0, 0, HALF_GRID);
glVertex3f(HALF_GRID, 0, 0);
glVertex3f(0, 0, -HALF_GRID);
glVertex3f(-HALF_GRID, 0, 0);
glEnd();
glPopMatrix();
}

void draw_circle(vector3f pos)
{
glColor3f(0, 0, 0);
glPushMatrix();
glTranslatef(pos.x, pos.y + 0.03, pos.z);
glRotatef(90, 1, 0, 0);
glutSolidCone(0.4, 0.01, 8, 8);
glPopMatrix();
}

void draw_n_lines(line3f* my_lines, vector3f angle, grid** others, int num_others)
{
line3f** lines = new line3f*[num_others];
if(!lines)
return;
int each = 0, line_count = 0;
while(each < num_others)
{
if(lines[line_count] = others[each]->get_lines(angle))
line_count++;
each++;
}
each = 0;
int each_lines = 0;
while(each < 4)
{
each_lines = 0;
while(each_lines < line_count)
{
if(has_line(lines[each_lines], my_lines[each]))
goto NODRAW;
each_lines++;
}
draw_line(my_lines[each]);
NODRAW:
each++;
}
delete[] lines;
}

void draw_rect(vector3f p1, vector3f p2, vector3f p3, vector3f p4)
{
glColor3f(1, 1, 1);
glBegin(GL_QUADS);
glVertex3f(p1.x, p1.y, p1.z);
glVertex3f(p2.x, p2.y, p2.z);
glVertex3f(p3.x, p3.y, p3.z);
glVertex3f(p4.x, p4.y, p4.z);
glEnd();
}

void draw_goal_gfx(vector3f pos, float goal_angle)
{
glColor3f(0.25f, 0.25f, 0.25f);
glPushMatrix();
glTranslatef(pos.x, pos.y + 0.5f, pos.z);
glRotatef(goal_angle, 0, 1, 0);
glutSolidTorus(0.05f, 0.4f, 8, 8);
glPopMatrix();
}
30 changes: 30 additions & 0 deletions echo_gfx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// echo_gfx.h

/*
This file is part of L-Echo.
L-Echo is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
L-Echo is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with L-Echo. If not, see <http://www.gnu.org/licenses/>.
*/

#include <grid.h>
#include <echo_math.h>

void draw_n_lines(line3f* my_lines, vector3f angle, grid** others, int num_lines);
void draw_line(vector3f p1, vector3f p2);
void draw_line(line3f ln);
void draw_rect(vector3f p1, vector3f p2, vector3f p3, vector3f p4);
void draw_circle(vector3f pos);
void draw_hole(vector3f pos);
void draw_launcher(vector3f pos);
void draw_goal_gfx(vector3f pos, float goal_angle);
Loading

0 comments on commit 7e27cf7

Please sign in to comment.