[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Adonthell-commits] CVS: adonthell/src Makefile.am,1.80.2.36,1.80.2.37 m
From: |
Alexandre Courbot <address@hidden> |
Subject: |
[Adonthell-commits] CVS: adonthell/src Makefile.am,1.80.2.36,1.80.2.37 main.cc,1.39.2.26,1.39.2.27 pytest.cc,1.1.2.1,1.1.2.2 |
Date: |
Sun, 11 Aug 2002 16:57:47 -0400 |
Update of /cvsroot/adonthell/adonthell/src
In directory subversions:/tmp/cvs-serv9639/src
Modified Files:
Tag: Branch_road_to_0-4
Makefile.am main.cc pytest.cc
Log Message:
UPDATED map engine specifications
ADDED Python callback functionality to the input system
RE-ENABLED (at least a little bit) the Python wrappers
Index: Makefile.am
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Makefile.am,v
retrieving revision 1.80.2.36
retrieving revision 1.80.2.37
diff -C2 -r1.80.2.36 -r1.80.2.37
*** Makefile.am 2 Jul 2002 13:23:01 -0000 1.80.2.36
--- Makefile.am 11 Aug 2002 20:57:45 -0000 1.80.2.37
***************
*** 14,19 ****
#moddata_DATA = adonthell.pyc
! bin_PROGRAMS = alextest schedtest joltest
! #pytest
EXTRA_DIST = .indent.pro prefs.l # py_adonthell.i adonthell.py
--- 14,18 ----
#moddata_DATA = adonthell.pyc
! bin_PROGRAMS = alextest schedtest joltest pytest
EXTRA_DIST = .indent.pro prefs.l # py_adonthell.i adonthell.py
***************
*** 105,119 ****
joltest_SOURCES = joltest.cc
! #pytest_SOURCES = pytest.cc
schedtest_SOURCES = schedtest.cc
! joltest_LDADD = gui/libgui.a gfx/libgfx.a input/libinput.a libbase.a
$(libbase_LDADD) $(libgui_LDADD)
! alextest_LDADD = lmap/libmap.a gfx/libgfx.a input/libinput.a libbase.a
$(libbase_LDADD)
! #pytest_LDADD = libbase.a libpython.a gfx/libgfx.a input/libinput.a
$(libbase_LDADD) $(libpython_LDADD)
! schedtest_LDADD = libbase.a python/libpython.a gfx/libgfx.a input/libinput.a
$(libbase_LDADD) $(libpython_LDADD)
# Note: .py files are also built by this target.
--- 104,118 ----
joltest_SOURCES = joltest.cc
! pytest_SOURCES = pytest.cc
schedtest_SOURCES = schedtest.cc
! joltest_LDADD = gui/libgui.a gfx/libgfx.a input/libinput.a python/libpython.a
libbase.a $(libbase_LDADD) $(libgui_LDADD) $(libpython_LDADD)
! alextest_LDADD = lmap/libmap.a gfx/libgfx.a input/libinput.a
python/libpython.a libbase.a $(libbase_LDADD) $(libpython_LDADD)
! pytest_LDADD = libbase.a python/libpython.a gfx/libgfx.a input/libinput.a
$(libbase_LDADD) $(libpython_LDADD) $(libpython_LDADD)
! schedtest_LDADD = libbase.a python/libpython.a gfx/libgfx.a
python/libpython.a input/libinput.a $(libbase_LDADD) $(libpython_LDADD)
# Note: .py files are also built by this target.
Index: main.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/main.cc,v
retrieving revision 1.39.2.26
retrieving revision 1.39.2.27
diff -C2 -r1.39.2.26 -r1.39.2.27
*** main.cc 1 Jul 2002 19:46:49 -0000 1.39.2.26
--- main.cc 11 Aug 2002 20:57:45 -0000 1.39.2.27
***************
*** 1,2 ****
--- 1,4 ----
+ #if 0
+
#include "lmap/landmap.h"
#include "gfx/animation.h"
***************
*** 365,368 ****
--- 367,371 ----
gametime::update ();
+ gfx::screen::display.draw_line(10, 10, 40, 100, 0xFFFFFF);
gfx::screen::show ();
gfx::screen::clear ();
***************
*** 373,374 ****
--- 376,497 ----
return 0;
}
+
+ #else
+ #include "gfx/image.h"
+ #include "input/manager.h"
+
+ #include <unistd.h>
+ #include <iostream>
+
+ class point
+ {
+ public:
+ point(const s_int16 x, const s_int16 y)
+ {
+ X = x;
+ Y = y;
+ }
+
+ s_int16 x () const { return X; }
+ s_int16 y () const { return Y; }
+
+ void draw () const
+ {
+ gfx::screen::display.lock ();
+ gfx::screen::display.put_pix (x (), y (), 0x0000FF);
+ gfx::screen::display.unlock ();
+ }
+
+ s_int16 X, Y;
+ };
+
+ class vector : public point
+ {
+ public:
+ vector (const s_int16 x, const s_int16 y) : point (x, y)
+ {
+ }
+
+ s_int16 crossproduct (vector v) const
+ {
+ return (x () * v.x () - y () * v.y ());
+ }
+ };
+
+ class line
+ {
+ public:
+ line (const point & p1, const point & p2) : P1 (p1), P2 (p2), Respoint
(0, 0)
+ {
+ }
+
+ line (const point p, const vector v) : P1 (p), P2 (p.x ()+ v.x (), p.y
()+ v.y ()), Respoint (0, 0)
+ {
+ }
+
+ void draw () const
+ {
+ gfx::screen::display.lock ();
+ gfx::screen::display.draw_line (P1.x (), P1.y (), P2.x (), P2.y (),
0xFFFFFF);
+ gfx::screen::display.unlock ();
+ }
+
+ bool intersect (const line & l) const
+ {
+ s_int16 t = (P2.x () - P1.x ()) * (l.P2.y () - l.P1.y ()) -
+ (P2.y() - P1.y()) * (l.P2.x () - l.P1.x());
+
+ if (!t) return false;
+
+ float denom = 1.0 / t;
+
+ s_int16 Tx = P1.x () - l.P1.x ();
+ s_int16 Ty = P1.y () - l.P1.y ();
+
+ float r = (Ty * (l.P2.x () - l.P1.x ()) - Tx * (l.P2.y () - l.P1.y
())) * denom;
+ float s = (Ty * (P2.x () - P1.x ()) - Tx * (P2.y () - P1.y ())) *
denom;
+
+ std::cout << r << " " << s << std::endl;
+
+ if (s >= 0 && s <= 1 && r >= 0 && r <= 1)
+ {
+ Respoint = point ((s_int16)P1.x () + r * (P2.x () - P1.x ()),
+ (s_int16)P1.y () + r * (P2.y () - P1.y ()));
+ return true;
+ }
+
+ return false;
+ }
+
+ point respoint () const { return Respoint; }
+
+ point P1, P2;
+ mutable point Respoint;
+ };
+
+ int main(int argc, char * argv[])
+ {
+ gfx::screen::init ();
+ gfx::screen::set_video_mode(640, 480);
+
+ input::manager::init();
+
+ input::listener il;
+
+ line l1 (point (10, 10), point (50, 70));
+ line l2 (point (60, 40), point (20, 80));
+
+ l1.draw();
+ l2.draw();
+ gfx::screen::show();
+
+ if (l1.intersect (l2))
+ std::cout << "Intersection point: " << l1.respoint ().x () << ", " <<
l1.respoint ().y () << std::endl;
+
+ sleep(1);
+
+ input::manager::cleanup();
+
+ return 0;
+ }
+ #endif
Index: pytest.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/Attic/pytest.cc,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -r1.1.2.1 -r1.1.2.2
*** pytest.cc 11 Apr 2002 14:08:42 -0000 1.1.2.1
--- pytest.cc 11 Aug 2002 20:57:45 -0000 1.1.2.2
***************
*** 1,3 ****
! #include "python_class.h"
extern "C" {
--- 1,3 ----
! #include "python/base.h"
extern "C" {
***************
*** 15,30 ****
void initinputc (void);
}
!
int main(int argc, char * argv[])
{
- // add the working directory to python's path (otherwise, scripts
- // without absolute path cannot be executed)
- // string path = dirname (argv[0]);
- // if (path[0] != '/')
- // {
- // string tmp = getcwd (NULL, 0);
- // path = tmp + path;
- // }
-
python::init();
initbasec();
--- 15,21 ----
void initinputc (void);
}
! extern "C"
int main(int argc, char * argv[])
{
python::init();
initbasec();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Adonthell-commits] CVS: adonthell/src Makefile.am,1.80.2.36,1.80.2.37 main.cc,1.39.2.26,1.39.2.27 pytest.cc,1.1.2.1,1.1.2.2,
Alexandre Courbot <address@hidden> <=