its just a test, wait a week...

This commit is contained in:
andrey
2010-02-03 09:10:40 +03:00
parent 835518ce1a
commit d20473731f
72 changed files with 679 additions and 37791 deletions

View File

@@ -2,9 +2,6 @@ hello
this is the source code of wavetrace(base part of game)
to compilling this code you must have QT4 library and gcc compiller
to make this project you cad do:
$ qmake
$ make clean
$ make distclean
$ qmake
$ make
or open the aliendefender.pro file in Qt-Creator and run aplication.

293
Makefile
View File

@@ -1,293 +0,0 @@
#############################################################################
# Makefile for building: aliendefender
# Generated by qmake (2.01a) (Qt 4.5.2) on: ?? ????. 12 14:04:38 2009
# Project: aliendefender.pro
# Template: app
# Command: /usr/bin/qmake -Wall -spec ../../share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile aliendefender.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I../../share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtNetwork -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4 -I/usr/include -I. -I.
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -L/usr/lib/qt4 -L/usr/X11R6/lib -lQtOpenGL -L/usr/lib/qt4 -L/usr/X11R6/lib -pthread -pthread -pthread -pthread -pthread -pthread -pthread -pthread -lQtGui -pthread -lpng -lfreetype -lgobject-2.0 -lSM -lICE -pthread -pthread -lXrender -lXrandr -lXinerama -lfontconfig -lXext -lX11 -lQtNetwork -pthread -pthread -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lGLU -lGL -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -sf
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = main.cpp \
mainwindow.cpp \
adpainter.cpp \
aliens.cpp \
udpsender.cpp \
towers.cpp moc_mainwindow.cpp \
moc_udpsender.cpp \
qrc_res.cpp
OBJECTS = main.o \
mainwindow.o \
adpainter.o \
aliens.o \
udpsender.o \
towers.o \
moc_mainwindow.o \
moc_udpsender.o \
qrc_res.o
DIST = ../../share/qt4/mkspecs/common/g++.conf \
../../share/qt4/mkspecs/common/unix.conf \
../../share/qt4/mkspecs/common/linux.conf \
../../share/qt4/mkspecs/qconfig.pri \
../../share/qt4/mkspecs/features/qt_functions.prf \
../../share/qt4/mkspecs/features/qt_config.prf \
../../share/qt4/mkspecs/features/exclusive_builds.prf \
../../share/qt4/mkspecs/features/default_pre.prf \
../../share/qt4/mkspecs/features/debug.prf \
../../share/qt4/mkspecs/features/default_post.prf \
../../share/qt4/mkspecs/features/warn_on.prf \
../../share/qt4/mkspecs/features/qt.prf \
../../share/qt4/mkspecs/features/unix/opengl.prf \
../../share/qt4/mkspecs/features/unix/thread.prf \
../../share/qt4/mkspecs/features/moc.prf \
../../share/qt4/mkspecs/features/resources.prf \
../../share/qt4/mkspecs/features/uic.prf \
../../share/qt4/mkspecs/features/yacc.prf \
../../share/qt4/mkspecs/features/lex.prf \
../../share/qt4/mkspecs/features/include_source_dir.prf \
aliendefender.pro
QMAKE_TARGET = aliendefender
DESTDIR =
TARGET = aliendefender
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
####### Build rules
all: Makefile $(TARGET)
$(TARGET): ui_mainwindow.h $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: aliendefender.pro ../../share/qt4/mkspecs/linux-g++/qmake.conf ../../share/qt4/mkspecs/common/g++.conf \
../../share/qt4/mkspecs/common/unix.conf \
../../share/qt4/mkspecs/common/linux.conf \
../../share/qt4/mkspecs/qconfig.pri \
../../share/qt4/mkspecs/features/qt_functions.prf \
../../share/qt4/mkspecs/features/qt_config.prf \
../../share/qt4/mkspecs/features/exclusive_builds.prf \
../../share/qt4/mkspecs/features/default_pre.prf \
../../share/qt4/mkspecs/features/debug.prf \
../../share/qt4/mkspecs/features/default_post.prf \
../../share/qt4/mkspecs/features/warn_on.prf \
../../share/qt4/mkspecs/features/qt.prf \
../../share/qt4/mkspecs/features/unix/opengl.prf \
../../share/qt4/mkspecs/features/unix/thread.prf \
../../share/qt4/mkspecs/features/moc.prf \
../../share/qt4/mkspecs/features/resources.prf \
../../share/qt4/mkspecs/features/uic.prf \
../../share/qt4/mkspecs/features/yacc.prf \
../../share/qt4/mkspecs/features/lex.prf \
../../share/qt4/mkspecs/features/include_source_dir.prf \
/usr/lib/qt4/libQtOpenGL.prl \
/usr/lib/qt4/libQtGui.prl \
/usr/lib/qt4/libQtCore.prl \
/usr/lib/qt4/libQtNetwork.prl
$(QMAKE) -Wall -spec ../../share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile aliendefender.pro
../../share/qt4/mkspecs/common/g++.conf:
../../share/qt4/mkspecs/common/unix.conf:
../../share/qt4/mkspecs/common/linux.conf:
../../share/qt4/mkspecs/qconfig.pri:
../../share/qt4/mkspecs/features/qt_functions.prf:
../../share/qt4/mkspecs/features/qt_config.prf:
../../share/qt4/mkspecs/features/exclusive_builds.prf:
../../share/qt4/mkspecs/features/default_pre.prf:
../../share/qt4/mkspecs/features/debug.prf:
../../share/qt4/mkspecs/features/default_post.prf:
../../share/qt4/mkspecs/features/warn_on.prf:
../../share/qt4/mkspecs/features/qt.prf:
../../share/qt4/mkspecs/features/unix/opengl.prf:
../../share/qt4/mkspecs/features/unix/thread.prf:
../../share/qt4/mkspecs/features/moc.prf:
../../share/qt4/mkspecs/features/resources.prf:
../../share/qt4/mkspecs/features/uic.prf:
../../share/qt4/mkspecs/features/yacc.prf:
../../share/qt4/mkspecs/features/lex.prf:
../../share/qt4/mkspecs/features/include_source_dir.prf:
/usr/lib/qt4/libQtOpenGL.prl:
/usr/lib/qt4/libQtGui.prl:
/usr/lib/qt4/libQtCore.prl:
/usr/lib/qt4/libQtNetwork.prl:
qmake: FORCE
@$(QMAKE) -Wall -spec ../../share/qt4/mkspecs/linux-g++ -unix CONFIG+=debug -o Makefile aliendefender.pro
dist:
@$(CHK_DIR_EXISTS) .tmp/aliendefender1.0.0 || $(MKDIR) .tmp/aliendefender1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/aliendefender1.0.0/ && $(COPY_FILE) --parents mainwindow.h adpainter.h aliens.h basestruct.h udpsender.h towers.h .tmp/aliendefender1.0.0/ && $(COPY_FILE) --parents res.qrc .tmp/aliendefender1.0.0/ && $(COPY_FILE) --parents main.cpp mainwindow.cpp adpainter.cpp aliens.cpp udpsender.cpp towers.cpp .tmp/aliendefender1.0.0/ && $(COPY_FILE) --parents mainwindow.ui .tmp/aliendefender1.0.0/ && (cd `dirname .tmp/aliendefender1.0.0` && $(TAR) aliendefender1.0.0.tar aliendefender1.0.0 && $(COMPRESS) aliendefender1.0.0.tar) && $(MOVE) `dirname .tmp/aliendefender1.0.0`/aliendefender1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/aliendefender1.0.0
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all: moc_mainwindow.cpp moc_udpsender.cpp
compiler_moc_header_clean:
-$(DEL_FILE) moc_mainwindow.cpp moc_udpsender.cpp
moc_mainwindow.cpp: adpainter.h \
basestruct.h \
aliens.h \
udpsender.h \
mainwindow.h
/usr/bin/moc $(DEFINES) $(INCPATH) mainwindow.h -o moc_mainwindow.cpp
moc_udpsender.cpp: udpsender.h
/usr/bin/moc $(DEFINES) $(INCPATH) udpsender.h -o moc_udpsender.cpp
compiler_rcc_make_all: qrc_res.cpp
compiler_rcc_clean:
-$(DEL_FILE) qrc_res.cpp
qrc_res.cpp: res.qrc \
images/Aliens/Al_0_5.png \
images/Aliens/Al_0_1.png \
images/Aliens/Al_0_9.png \
images/Aliens/Al_0_19.png \
images/Aliens/Al_0_15.png \
images/Aliens/Al_0_11.png \
images/Aliens/Al_0_4.png \
images/Aliens/Al_0_0.png \
images/Aliens/Al_0_8.png \
images/Aliens/Al_0_16.png \
images/Aliens/Al_0_12.png \
images/Aliens/Al_0_3.png \
images/Aliens/Al_0_7.png \
images/Aliens/Al_0_17.png \
images/Aliens/Al_0_13.png \
images/Aliens/Al_0_2.png \
images/Aliens/Al_0_6.png \
images/Aliens/Al_0_18.png \
images/Aliens/Al_0_14.png \
images/Aliens/Al_0_10.png
/usr/bin/rcc -name res res.qrc -o qrc_res.cpp
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all: ui_mainwindow.h
compiler_uic_clean:
-$(DEL_FILE) ui_mainwindow.h
ui_mainwindow.h: mainwindow.ui
/usr/bin/uic mainwindow.ui -o ui_mainwindow.h
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_uic_clean
####### Compile
main.o: main.cpp mainwindow.h \
adpainter.h \
basestruct.h \
aliens.h \
udpsender.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
mainwindow.o: mainwindow.cpp mainwindow.h \
adpainter.h \
basestruct.h \
aliens.h \
udpsender.h \
ui_mainwindow.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o mainwindow.o mainwindow.cpp
adpainter.o: adpainter.cpp adpainter.h \
basestruct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o adpainter.o adpainter.cpp
aliens.o: aliens.cpp aliens.h \
basestruct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o aliens.o aliens.cpp
udpsender.o: udpsender.cpp udpsender.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o udpsender.o udpsender.cpp
towers.o: towers.cpp towers.h \
basestruct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o towers.o towers.cpp
moc_mainwindow.o: moc_mainwindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_mainwindow.o moc_mainwindow.cpp
moc_udpsender.o: moc_udpsender.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_udpsender.o moc_udpsender.cpp
qrc_res.o: qrc_res.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o qrc_res.o qrc_res.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:

View File

@@ -1,216 +0,0 @@
#############################################################################
# Makefile for building: aliendefender
# Generated by qmake (2.01a) (Qt 4.5.2) on: ?? 6. ??? 19:08:54 2009
# Project: aliendefender.pro
# Template: app
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
CFLAGS = -g -Wall $(DEFINES)
CXXFLAGS = -g -frtti -fexceptions -mthreads -Wall $(DEFINES)
INCPATH = -I"..\Qt\2009.03\qt\include\QtCore" -I"..\Qt\2009.03\qt\include\QtNetwork" -I"..\Qt\2009.03\qt\include\QtGui" -I"..\Qt\2009.03\qt\include\QtOpenGL" -I"..\Qt\2009.03\qt\include" -I"..\Qt\2009.03\qt\include\ActiveQt" -I"debug" -I"." -I"..\Qt\2009.03\qt\mkspecs\win32-g++"
LINK = g++
LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows
LIBS = -L"d:\Qt\2009.03\qt\lib" -lopengl32 -lglu32 -lgdi32 -luser32 -lmingw32 -lqtmaind -lQtOpenGLd4 -lQtGuid4 -lQtNetworkd4 -lQtCored4
QMAKE = d:\Qt\2009.03\qt\bin\qmake.exe
IDC = d:\Qt\2009.03\qt\bin\idc.exe
IDL = midl
ZIP = zip -r -9
DEF_FILE =
RES_FILE =
COPY = copy /y
COPY_FILE = $(COPY)
COPY_DIR = xcopy /s /q /y /i
DEL_FILE = del
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
INSTALL_FILE = $(COPY_FILE)
INSTALL_PROGRAM = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
####### Output directory
OBJECTS_DIR = debug
####### Files
SOURCES = main.cpp \
mainwindow.cpp \
adpainter.cpp \
aliens.cpp \
udpsender.cpp \
towers.cpp debug\moc_mainwindow.cpp \
debug\moc_udpsender.cpp \
debug\qrc_res.cpp
OBJECTS = debug/main.o \
debug/mainwindow.o \
debug/adpainter.o \
debug/aliens.o \
debug/udpsender.o \
debug/towers.o \
debug/moc_mainwindow.o \
debug/moc_udpsender.o \
debug/qrc_res.o
DIST =
QMAKE_TARGET = aliendefender
DESTDIR = debug\ #avoid trailing-slash linebreak
TARGET = aliendefender.exe
DESTDIR_TARGET = debug\aliendefender.exe
####### Implicit rules
.SUFFIXES: .cpp .cc .cxx .c
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
####### Build rules
first: all
all: Makefile.Debug $(DESTDIR_TARGET)
$(DESTDIR_TARGET): ui_mainwindow.h $(OBJECTS)
$(LINK) $(LFLAGS) -o $(DESTDIR_TARGET) $(OBJECTS) $(LIBS)
qmake: FORCE
@$(QMAKE) -Wall -spec ..\Qt\2009.03\qt\mkspecs\win32-g++ -win32 -o Makefile.Debug aliendefender.pro
dist:
$(ZIP) aliendefender.zip $(SOURCES) $(DIST) aliendefender.pro ..\Qt\2009.03\qt\mkspecs\qconfig.pri ..\Qt\2009.03\qt\mkspecs\features\qt_functions.prf ..\Qt\2009.03\qt\mkspecs\features\qt_config.prf ..\Qt\2009.03\qt\mkspecs\features\exclusive_builds.prf ..\Qt\2009.03\qt\mkspecs\features\default_pre.prf ..\Qt\2009.03\qt\mkspecs\features\win32\default_pre.prf ..\Qt\2009.03\qt\mkspecs\features\debug.prf ..\Qt\2009.03\qt\mkspecs\features\debug_and_release.prf ..\Qt\2009.03\qt\mkspecs\features\default_post.prf ..\Qt\2009.03\qt\mkspecs\features\win32\default_post.prf ..\Qt\2009.03\qt\mkspecs\features\build_pass.prf ..\Qt\2009.03\qt\mkspecs\features\win32\rtti.prf ..\Qt\2009.03\qt\mkspecs\features\win32\exceptions.prf ..\Qt\2009.03\qt\mkspecs\features\win32\stl.prf ..\Qt\2009.03\qt\mkspecs\features\shared.prf ..\Qt\2009.03\qt\mkspecs\features\warn_on.prf ..\Qt\2009.03\qt\mkspecs\features\qt.prf ..\Qt\2009.03\qt\mkspecs\features\win32\opengl.prf ..\Qt\2009.03\qt\mkspecs\features\win32\thread.prf ..\Qt\2009.03\qt\mkspecs\features\moc.prf ..\Qt\2009.03\qt\mkspecs\features\win32\windows.prf ..\Qt\2009.03\qt\mkspecs\features\resources.prf ..\Qt\2009.03\qt\mkspecs\features\uic.prf ..\Qt\2009.03\qt\mkspecs\features\yacc.prf ..\Qt\2009.03\qt\mkspecs\features\lex.prf ..\Qt\2009.03\qt\mkspecs\features\include_source_dir.prf d:\Qt\2009.03\qt\lib\qtmaind.prl HEADERS RESOURCES IMAGES SOURCES OBJECTIVE_SOURCES FORMS YACCSOURCES YACCSOURCES LEXSOURCES
clean: compiler_clean
-$(DEL_FILE) debug\main.o debug\mainwindow.o debug\adpainter.o debug\aliens.o debug\udpsender.o debug\towers.o debug\moc_mainwindow.o debug\moc_udpsender.o debug\qrc_res.o
distclean: clean
-$(DEL_FILE) $(DESTDIR_TARGET)
-$(DEL_FILE) Makefile.Debug
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all: debug/moc_mainwindow.cpp debug/moc_udpsender.cpp
compiler_moc_header_clean:
-$(DEL_FILE) debug\moc_mainwindow.cpp debug\moc_udpsender.cpp
debug/moc_mainwindow.cpp: adpainter.h \
basestruct.h \
aliens.h \
udpsender.h \
mainwindow.h
D:/Qt/2009.03/qt/bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 mainwindow.h -o debug\moc_mainwindow.cpp
debug/moc_udpsender.cpp: udpsender.h
D:/Qt/2009.03/qt/bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 udpsender.h -o debug\moc_udpsender.cpp
compiler_rcc_make_all: debug/qrc_res.cpp
compiler_rcc_clean:
-$(DEL_FILE) debug\qrc_res.cpp
debug/qrc_res.cpp: res.qrc \
images/Aliens/Al_0_5.png \
images/Aliens/Al_0_1.png \
images/Aliens/Al_0_9.png \
images/Aliens/Al_0_19.png \
images/Aliens/Al_0_15.png \
images/Aliens/Al_0_11.png \
images/Aliens/Al_0_4.png \
images/Aliens/Al_0_0.png \
images/Aliens/Al_0_8.png \
images/Aliens/Al_0_16.png \
images/Aliens/Al_0_12.png \
images/Aliens/Al_0_3.png \
images/Aliens/Al_0_7.png \
images/Aliens/Al_0_17.png \
images/Aliens/Al_0_13.png \
images/Aliens/Al_0_2.png \
images/Aliens/Al_0_6.png \
images/Aliens/Al_0_18.png \
images/Aliens/Al_0_14.png \
images/Aliens/Al_0_10.png
d:\Qt\2009.03\qt\bin\rcc.exe -name res res.qrc -o debug\qrc_res.cpp
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all: ui_mainwindow.h
compiler_uic_clean:
-$(DEL_FILE) ui_mainwindow.h
ui_mainwindow.h: mainwindow.ui
d:\Qt\2009.03\qt\bin\uic.exe mainwindow.ui -o ui_mainwindow.h
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_uic_clean
####### Compile
debug/main.o: main.cpp mainwindow.h \
adpainter.h \
basestruct.h \
aliens.h \
udpsender.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\main.o main.cpp
debug/mainwindow.o: mainwindow.cpp mainwindow.h \
adpainter.h \
basestruct.h \
aliens.h \
udpsender.h \
ui_mainwindow.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\mainwindow.o mainwindow.cpp
debug/adpainter.o: adpainter.cpp adpainter.h \
basestruct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\adpainter.o adpainter.cpp
debug/aliens.o: aliens.cpp aliens.h \
basestruct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\aliens.o aliens.cpp
debug/udpsender.o: udpsender.cpp udpsender.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\udpsender.o udpsender.cpp
debug/towers.o: towers.cpp towers.h \
basestruct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\towers.o towers.cpp
debug/moc_mainwindow.o: debug/moc_mainwindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\moc_mainwindow.o debug\moc_mainwindow.cpp
debug/moc_udpsender.o: debug/moc_udpsender.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\moc_udpsender.o debug\moc_udpsender.cpp
debug/qrc_res.o: debug/qrc_res.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\qrc_res.o debug\qrc_res.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:

View File

@@ -1,216 +0,0 @@
#############################################################################
# Makefile for building: aliendefender
# Generated by qmake (2.01a) (Qt 4.5.2) on: ?? 6. ??? 19:08:54 2009
# Project: aliendefender.pro
# Template: app
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
CFLAGS = -O2 -Wall $(DEFINES)
CXXFLAGS = -O2 -frtti -fexceptions -mthreads -Wall $(DEFINES)
INCPATH = -I"..\Qt\2009.03\qt\include\QtCore" -I"..\Qt\2009.03\qt\include\QtNetwork" -I"..\Qt\2009.03\qt\include\QtGui" -I"..\Qt\2009.03\qt\include\QtOpenGL" -I"..\Qt\2009.03\qt\include" -I"..\Qt\2009.03\qt\include\ActiveQt" -I"release" -I"." -I"..\Qt\2009.03\qt\mkspecs\win32-g++"
LINK = g++
LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows
LIBS = -L"d:\Qt\2009.03\qt\lib" -lopengl32 -lglu32 -lgdi32 -luser32 -lmingw32 -lqtmain -lQtOpenGL4 -lQtGui4 -lQtNetwork4 -lQtCore4
QMAKE = d:\Qt\2009.03\qt\bin\qmake.exe
IDC = d:\Qt\2009.03\qt\bin\idc.exe
IDL = midl
ZIP = zip -r -9
DEF_FILE =
RES_FILE =
COPY = copy /y
COPY_FILE = $(COPY)
COPY_DIR = xcopy /s /q /y /i
DEL_FILE = del
DEL_DIR = rmdir
MOVE = move
CHK_DIR_EXISTS= if not exist
MKDIR = mkdir
INSTALL_FILE = $(COPY_FILE)
INSTALL_PROGRAM = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
####### Output directory
OBJECTS_DIR = release
####### Files
SOURCES = main.cpp \
mainwindow.cpp \
adpainter.cpp \
aliens.cpp \
udpsender.cpp \
towers.cpp release\moc_mainwindow.cpp \
release\moc_udpsender.cpp \
release\qrc_res.cpp
OBJECTS = release/main.o \
release/mainwindow.o \
release/adpainter.o \
release/aliens.o \
release/udpsender.o \
release/towers.o \
release/moc_mainwindow.o \
release/moc_udpsender.o \
release/qrc_res.o
DIST =
QMAKE_TARGET = aliendefender
DESTDIR = release\ #avoid trailing-slash linebreak
TARGET = aliendefender.exe
DESTDIR_TARGET = release\aliendefender.exe
####### Implicit rules
.SUFFIXES: .cpp .cc .cxx .c
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
####### Build rules
first: all
all: Makefile.Release $(DESTDIR_TARGET)
$(DESTDIR_TARGET): ui_mainwindow.h $(OBJECTS)
$(LINK) $(LFLAGS) -o $(DESTDIR_TARGET) $(OBJECTS) $(LIBS)
qmake: FORCE
@$(QMAKE) -Wall -spec ..\Qt\2009.03\qt\mkspecs\win32-g++ -win32 -o Makefile.Release aliendefender.pro
dist:
$(ZIP) aliendefender.zip $(SOURCES) $(DIST) aliendefender.pro ..\Qt\2009.03\qt\mkspecs\qconfig.pri ..\Qt\2009.03\qt\mkspecs\features\qt_functions.prf ..\Qt\2009.03\qt\mkspecs\features\qt_config.prf ..\Qt\2009.03\qt\mkspecs\features\exclusive_builds.prf ..\Qt\2009.03\qt\mkspecs\features\default_pre.prf ..\Qt\2009.03\qt\mkspecs\features\win32\default_pre.prf ..\Qt\2009.03\qt\mkspecs\features\release.prf ..\Qt\2009.03\qt\mkspecs\features\debug_and_release.prf ..\Qt\2009.03\qt\mkspecs\features\default_post.prf ..\Qt\2009.03\qt\mkspecs\features\win32\default_post.prf ..\Qt\2009.03\qt\mkspecs\features\build_pass.prf ..\Qt\2009.03\qt\mkspecs\features\win32\rtti.prf ..\Qt\2009.03\qt\mkspecs\features\win32\exceptions.prf ..\Qt\2009.03\qt\mkspecs\features\win32\stl.prf ..\Qt\2009.03\qt\mkspecs\features\shared.prf ..\Qt\2009.03\qt\mkspecs\features\warn_on.prf ..\Qt\2009.03\qt\mkspecs\features\qt.prf ..\Qt\2009.03\qt\mkspecs\features\win32\opengl.prf ..\Qt\2009.03\qt\mkspecs\features\win32\thread.prf ..\Qt\2009.03\qt\mkspecs\features\moc.prf ..\Qt\2009.03\qt\mkspecs\features\win32\windows.prf ..\Qt\2009.03\qt\mkspecs\features\resources.prf ..\Qt\2009.03\qt\mkspecs\features\uic.prf ..\Qt\2009.03\qt\mkspecs\features\yacc.prf ..\Qt\2009.03\qt\mkspecs\features\lex.prf ..\Qt\2009.03\qt\mkspecs\features\include_source_dir.prf d:\Qt\2009.03\qt\lib\qtmain.prl HEADERS RESOURCES IMAGES SOURCES OBJECTIVE_SOURCES FORMS YACCSOURCES YACCSOURCES LEXSOURCES
clean: compiler_clean
-$(DEL_FILE) release\main.o release\mainwindow.o release\adpainter.o release\aliens.o release\udpsender.o release\towers.o release\moc_mainwindow.o release\moc_udpsender.o release\qrc_res.o
distclean: clean
-$(DEL_FILE) $(DESTDIR_TARGET)
-$(DEL_FILE) Makefile.Release
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_moc_header_make_all: release/moc_mainwindow.cpp release/moc_udpsender.cpp
compiler_moc_header_clean:
-$(DEL_FILE) release\moc_mainwindow.cpp release\moc_udpsender.cpp
release/moc_mainwindow.cpp: adpainter.h \
basestruct.h \
aliens.h \
udpsender.h \
mainwindow.h
D:/Qt/2009.03/qt/bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 mainwindow.h -o release\moc_mainwindow.cpp
release/moc_udpsender.cpp: udpsender.h
D:/Qt/2009.03/qt/bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 udpsender.h -o release\moc_udpsender.cpp
compiler_rcc_make_all: release/qrc_res.cpp
compiler_rcc_clean:
-$(DEL_FILE) release\qrc_res.cpp
release/qrc_res.cpp: res.qrc \
images/Aliens/Al_0_5.png \
images/Aliens/Al_0_1.png \
images/Aliens/Al_0_9.png \
images/Aliens/Al_0_19.png \
images/Aliens/Al_0_15.png \
images/Aliens/Al_0_11.png \
images/Aliens/Al_0_4.png \
images/Aliens/Al_0_0.png \
images/Aliens/Al_0_8.png \
images/Aliens/Al_0_16.png \
images/Aliens/Al_0_12.png \
images/Aliens/Al_0_3.png \
images/Aliens/Al_0_7.png \
images/Aliens/Al_0_17.png \
images/Aliens/Al_0_13.png \
images/Aliens/Al_0_2.png \
images/Aliens/Al_0_6.png \
images/Aliens/Al_0_18.png \
images/Aliens/Al_0_14.png \
images/Aliens/Al_0_10.png
d:\Qt\2009.03\qt\bin\rcc.exe -name res res.qrc -o release\qrc_res.cpp
compiler_image_collection_make_all: qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all: ui_mainwindow.h
compiler_uic_clean:
-$(DEL_FILE) ui_mainwindow.h
ui_mainwindow.h: mainwindow.ui
d:\Qt\2009.03\qt\bin\uic.exe mainwindow.ui -o ui_mainwindow.h
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_uic_clean
####### Compile
release/main.o: main.cpp mainwindow.h \
adpainter.h \
basestruct.h \
aliens.h \
udpsender.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\main.o main.cpp
release/mainwindow.o: mainwindow.cpp mainwindow.h \
adpainter.h \
basestruct.h \
aliens.h \
udpsender.h \
ui_mainwindow.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\mainwindow.o mainwindow.cpp
release/adpainter.o: adpainter.cpp adpainter.h \
basestruct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\adpainter.o adpainter.cpp
release/aliens.o: aliens.cpp aliens.h \
basestruct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\aliens.o aliens.cpp
release/udpsender.o: udpsender.cpp udpsender.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\udpsender.o udpsender.cpp
release/towers.o: towers.cpp towers.h \
basestruct.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\towers.o towers.cpp
release/moc_mainwindow.o: release/moc_mainwindow.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\moc_mainwindow.o release\moc_mainwindow.cpp
release/moc_udpsender.o: release/moc_udpsender.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\moc_udpsender.o release\moc_udpsender.cpp
release/qrc_res.o: release/qrc_res.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\qrc_res.o release\qrc_res.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:

View File

@@ -3,123 +3,160 @@
adpainter::adpainter(int width, int height, int adpcellsize)
{
cellsize = adpcellsize;
buff = new QPixmap(width,height);
background = new QPixmap(width,height);
pen = new QPen();
brush = new QBrush();
QString str;
QPixmap tmpAlPixmap;
int i=1;
cellsize = adpcellsize;
buff = new QPixmap(width,height);
background = new QPixmap(width,height);
pen = new QPen();
brush = new QBrush();
str.setNum(i);
while (i != 0) {
str.setNum(i);
tmpAlPixmap.load("./images/Aliens/Al_00_" + str + ".png");
//qDebug() << tmpAlPixmap.isNull();
if (!tmpAlPixmap.isNull()) {
AlienPix.push_back(tmpAlPixmap);
tmpAlPixmap = 0;
i++;
}
else i = 0;
}
qDebug() << "pictures:" << AlienPix.size();
AnimAlien = 0;
StepAlien = 0;
}
void adpainter::clear()
{
painter.begin(background);
pen->setColor(QColor::fromRgb(qRgb(150,150,150)));
painter.setPen(*pen);
painter.fillRect(buff->rect(),QColor::fromRgb(qRgb(150,150,150)));
painter.end();
painter.begin(background);
pen->setColor(QColor::fromRgb(qRgb(150,150,150)));
painter.setPen(*pen);
painter.fillRect(buff->rect(),QColor::fromRgb(qRgb(150,150,150)));
painter.end();
}
void adpainter::drawgrid()
{
int i;
painter.begin(background);
pen->setColor(QColor::fromRgb(qRgb(100,100,100)));
painter.setPen(*pen);
for (i = 0;i<buff->width()/cellsize;i++)
{
painter.drawLine(i*cellsize,0,i*cellsize,background->height());
}
for (i = 0;i<buff->height()/cellsize;i++)
{
painter.drawLine(0,i*cellsize,background->width(),i*cellsize);
}
painter.end();
int i;
painter.begin(background);
pen->setColor(QColor::fromRgb(qRgb(100,100,100)));
painter.setPen(*pen);
for (i = 0;i<buff->width()/cellsize;i++)
{
painter.drawLine(i*cellsize,0,i*cellsize,background->height());
}
for (i = 0;i<buff->height()/cellsize;i++)
{
painter.drawLine(0,i*cellsize,background->width(),i*cellsize);
}
painter.end();
}
void adpainter::drawAliens(Alien * al,QVector<QPixmap> * pixmaps)
void adpainter::drawAliens(QVector<QPointF> path, FPVector * position)
{
//float tmpdx,tmpdy,arctg,tmpdx1,tmpdy1;
//arctg = 0;
QRectF rect;
painter.begin(buff);
pen->setColor(QColor::fromRgb(qRgb(80,200,100)));
brush->setColor(QColor::fromRgb(qRgb(230,10,10)));
brush->setStyle(Qt::SolidPattern);
painter.setPen(*pen);
painter.setBrush(*brush);
painter.drawPixmap(0,0,*background);
for (int i = 0; i < al->path.size(); i++){
rect.setRect(al->path[i].x() * cellsize +1, al->path[i].y() * cellsize +1, cellsize - 2, cellsize - 2);
painter.drawEllipse(rect);
}
//tmpdx = position->pnt.x() - path.at(StepAlien).x()*cellsize;
//tmpdy = position->pnt.y() - path.at(StepAlien).y()*cellsize;
//if (StepAlien + 1 < path.size()) {
// tmpdx1 = position->pnt.x() - path.at(StepAlien+1).x()*cellsize;
// tmpdy1 = position->pnt.y() - path.at(StepAlien+1).y()*cellsize;
//}
//arctg = atanf(tmpdx1/tmpdy1);
//position->angle = 180*(-arctg)/3.1415;
//if (tmpdy1 < 0) position->angle = 180 + position->angle;
//if (AlienPix.size() > 0) {
//qDebug() << "angle:" << position->angle;
/* if (qAbs(tmpdx) < 1 && qAbs(tmpdy) < 1) StepAlien++;
else {
if (qAbs(tmpdx) <= qAbs(tmpdy)) {
if (tmpdy < 0) position->pnt.ry()++;
else position->pnt.ry()--;
}
if (qAbs(tmpdx) >= qAbs(tmpdy)) {
if (tmpdx < 0) position->pnt.rx()++;
else position->pnt.rx()--;
}
}*/
painter.translate(al->Position.pnt.x()+cellsize/2, al->Position.pnt.y()+cellsize/2);
painter.rotate(al->Position.angle);
painter.drawPixmap(-cellsize, -cellsize, cellsize*2, cellsize*2, pixmaps->at(al->PicIndex));
//AnimAlien++;
//if (AnimAlien >= AlienPix.size()) AnimAlien = 0;
/*if (StepAlien >= path.size()) {
StepAlien = 0;
position->pnt.setX(path.at(0).x()*cellsize);
position->pnt.setY(path.at(0).y()*cellsize);
}*/
//qDebug() << StepAlien;
//}
painter.end();
float tmpdx,tmpdy,arctg,tmpdx1,tmpdy1;
//unsigned char dd[4];
//int gg;
arctg = 0;
//qDebug() << path.size();
//QTransform rotated;
painter.begin(buff);
pen->setColor(QColor::fromRgb(qRgb(80,200,100)));
brush->setColor(QColor::fromRgb(qRgb(230,10,10)));
brush->setStyle(Qt::SolidPattern);
painter.setPen(*pen);
painter.setBrush(*brush);
painter.drawPixmap(0,0,*background);
for (int i = 0; i < path.size(); i++){
painter.drawEllipse(path[i].x() * cellsize +1, path[i].y() * cellsize +1, cellsize - 2, cellsize - 2);
}
tmpdx = position->pnt.x() - path[StepAlien].x()*cellsize;
tmpdy = position->pnt.y() - path[StepAlien].y()*cellsize;
if (StepAlien + 1 < path.size()) {
tmpdx1 = position->pnt.x() - path[StepAlien+1].x()*cellsize;
tmpdy1 = position->pnt.y() - path[StepAlien+1].y()*cellsize;
}
arctg = atanf(tmpdx1/tmpdy1);
//memcpy(&gg,&arctg,4);
position->angle = 180*(-arctg)/3.1415;
if (tmpdy1 < 0) position->angle = 180 + position->angle;
if (AlienPix.size() > 0) {
//painter.rotate((arctg/3.1415)*180);
//rotated.rotateRadians(arctg/* + 3.1415/2*/);
//qDebug() << "angle:" << position->angle;
//rotated.reset();
if (qAbs(tmpdx) < 1 && qAbs(tmpdy) < 1) StepAlien++;
else {
if (qAbs(tmpdx) <= qAbs(tmpdy)) {
if (tmpdy < 0) {
position->pnt.ry()++;
//position->angle = - position->angle;
}
else {
position->pnt.ry()--;
}
}
if (qAbs(tmpdx) >= qAbs(tmpdy)) {
if (tmpdx < 0) {
position->pnt.rx()++;
//position->angle = - position->angle;
}
else position->pnt.rx()--;
}
}
//painter.save();
painter.translate(position->pnt.x()+cellsize/2, position->pnt.y()+cellsize/2);
//if (arctg == 0) painter.rotate(90);
//memcpy(dd,&gg,4);
//dd[0]=0xFF;
//qDebug() << "angle:" << position->angle;
//qDebug() << dd[0] << dd[1] << dd[2] << dd[3];
painter.rotate(position->angle);
//position->pnt.setX(path.at(0).x());
//position->pnt.setY(path.at(0).y());
painter.drawPixmap(-cellsize, -cellsize, cellsize*2, cellsize*2, AlienPix.at(AnimAlien));
AnimAlien++;
//painter.restore();
if (AnimAlien >= AlienPix.size()) AnimAlien = 0;
if (StepAlien >= path.size()) StepAlien = 0;
//qDebug() << StepAlien;
}
painter.end();
}
void adpainter::drawcell(QPoint pnt)
{
painter.begin(background);
pen->setColor(QColor::fromRgb(qRgb(0,0,0)));
brush->setColor(QColor::fromRgb(qRgb(0,0,0)));
brush->setStyle(Qt::SolidPattern);
painter.setPen(*pen);
painter.setBrush(*brush);
painter.drawRect(pnt.x()*cellsize+1,pnt.y()*cellsize+1,cellsize - 2, cellsize - 2);
painter.end();
painter.begin(background);
pen->setColor(QColor::fromRgb(qRgb(0,0,0)));
brush->setColor(QColor::fromRgb(qRgb(0,0,0)));
brush->setStyle(Qt::SolidPattern);
painter.setPen(*pen);
painter.setBrush(*brush);
painter.drawRect(pnt.x()*cellsize+1,pnt.y()*cellsize+1,cellsize - 2, cellsize - 2);
painter.end();
}
void adpainter::clearcell(QPoint pnt)
{
painter.begin(background);
pen->setColor(QColor::fromRgb(qRgb(150,150,150)));
brush->setColor(QColor::fromRgb(qRgb(150,150,150)));
brush->setStyle(Qt::SolidPattern);
painter.setPen(*pen);
painter.setBrush(*brush);
painter.drawRect(pnt.x()*cellsize+1,pnt.y()*cellsize+1,cellsize - 2, cellsize - 2);
painter.end();
painter.begin(background);
pen->setColor(QColor::fromRgb(qRgb(150,150,150)));
brush->setColor(QColor::fromRgb(qRgb(150,150,150)));
brush->setStyle(Qt::SolidPattern);
painter.setPen(*pen);
painter.setBrush(*brush);
painter.drawRect(pnt.x()*cellsize+1,pnt.y()*cellsize+1,cellsize - 2, cellsize - 2);
painter.end();
}
QPixmap * adpainter::getPixmap()
{
return buff;
return buff;
}

View File

@@ -3,6 +3,8 @@
#include "basestruct.h"
#include <cmath>
#include <QPainter>
#include <QTransform>
#include <QPaintEvent>
@@ -15,23 +17,27 @@
#include <QPoint>
#include <QDebug>
using std::atan;
class adpainter
{
public:
adpainter(int width, int height, int adpcellsize);
void drawgrid();
void drawcell(QPoint pnt);
void clearcell(QPoint pnt);
void clear();
QPixmap * getPixmap();
void drawAliens(Alien * al, QVector<QPixmap> * pixmaps);
adpainter(int width, int height, int adpcellsize);
void drawgrid();
void drawcell(QPoint pnt);
void clearcell(QPoint pnt);
void clear();
QPixmap * getPixmap();
void drawAliens(QVector<QPointF> path, FPVector * position);
int AnimAlien, StepAlien;
private:
QPixmap * buff;
QPixmap * background;
QPainter painter;
QPen * pen;
QBrush * brush;
int cellsize;
QPixmap * buff;
QPixmap * background;
QPainter painter;
QPen * pen;
QBrush * brush;
QVector<QPixmap> AlienPix;
int cellsize;
};

Binary file not shown.

Binary file not shown.

View File

@@ -10,12 +10,15 @@ SOURCES += main.cpp \
adpainter.cpp \
aliens.cpp \
udpsender.cpp \
towers.cpp
towers.cpp \
map.cpp \
game.cpp
HEADERS += mainwindow.h \
adpainter.h \
aliens.h \
basestruct.h \
udpsender.h \
towers.h
towers.h \
map.h \
game.h
FORMS += mainwindow.ui
RESOURCES += res.qrc

View File

@@ -78,8 +78,7 @@
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString" >Debug</value>
<value key="QtVersionId" type="int" >0</value>
<value key="addQDumper" type="" ></value>
<value key="buildDirectory" type="QString" ></value>
<value key="useShadowBuild" type="bool" >false</value>
<value key="buildDirectory" type="QString" >/home/andrey/documents/sm11/Alien Defender/ad</value>
</valuemap>
</data>
<data>
@@ -95,64 +94,47 @@
<valuemap type="QVariantMap" >
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString" >Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList" >
<value type="QString" >ANT_HOME=/usr/share/ant</value>
<value type="QString" >CONFIG_PROTECT_MASK=/etc/gentoo-release /etc/sandbox.d /etc/env.d/java/ /etc/udev/rules.d /etc/fonts/fonts.conf /etc/gconf /etc/terminfo /etc/ca-certificates.conf /etc/revdep-rebuild</value>
<value type="QString" >CVS_RSH=ssh</value>
<value type="QString" >DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-OomOx141X7,guid=4e8fac1ae1f40787aeb1f16e4aa53a4f</value>
<value type="QString" >DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-S5Q8zKlbhY,guid=6ef5dd4aeeaf9cb3055a39934b629f00</value>
<value type="QString" >DESKTOP_SESSION=gnome</value>
<value type="QString" >DESKTOP_STARTUP_ID=</value>
<value type="QString" >DISPLAY=:0.0</value>
<value type="QString" >EDITOR=/bin/nano</value>
<value type="QString" >GCC_SPECS=</value>
<value type="QString" >GDK_USE_XFT=1</value>
<value type="QString" >GDMSESSION=gnome</value>
<value type="QString" >GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString" >GDM_LANG=ru_RU.UTF-8</value>
<value type="QString" >GDM_XSERVER_LOCATION=local</value>
<value type="QString" >GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString" >GNOME_KEYRING_SOCKET=/tmp/keyring-qB4w8J/socket</value>
<value type="QString" >GNOME_KEYRING_SOCKET=/tmp/keyring-116Pb7/socket</value>
<value type="QString" >GTK_MODULES=canberra-gtk-module</value>
<value type="QString" >GTK_RC_FILES=/etc/gtk/gtkrc:/home/andrey/.gtkrc-1.2-gnome2</value>
<value type="QString" >HOME=/home/andrey</value>
<value type="QString" >INFOPATH=/usr/share/info:/usr/share/binutils-data/i686-pc-linux-gnu/2.19.1/info:/usr/share/gcc-data/i486-pc-linux-gnu/4.1.2/info:/usr/share/gcc-data/i686-pc-linux-gnu/4.3.3/info</value>
<value type="QString" >JAVAC=/home/andrey/.gentoo/java-config-2/current-user-vm/bin/javac</value>
<value type="QString" >JAVA_HOME=/home/andrey/.gentoo/java-config-2/current-user-vm</value>
<value type="QString" >JDK_HOME=/home/andrey/.gentoo/java-config-2/current-user-vm</value>
<value type="QString" >LANG=ru_RU.UTF-8</value>
<value type="QString" >LESS=-R -M --shift 5</value>
<value type="QString" >LESSOPEN=|lesspipe.sh %s</value>
<value type="QString" >LD_LIBRARY_PATH=/usr/lib/qtcreator:</value>
<value type="QString" >LOGNAME=andrey</value>
<value type="QString" >MANPATH=/home/andrey/.gentoo/java-config-2/current-user-vm/man:/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/i686-pc-linux-gnu/2.19.1/man:/usr/share/gcc-data/i486-pc-linux-gnu/4.1.2/man:/usr/share/gcc-data/i686-pc-linux-gnu/4.3.3/man:/etc/java-config/system-vm/man/:/usr/qt/3/doc/man:/opt/opera/share/man</value>
<value type="QString" >OPENGL_PROFILE=xorg-x11</value>
<value type="QString" >ORBIT_SOCKETDIR=/tmp/orbit-andrey</value>
<value type="QString" >PAGER=/usr/bin/less</value>
<value type="QString" >PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i486-pc-linux-gnu/gcc-bin/4.1.2:/usr/i686-pc-linux-gnu/gcc-bin/4.3.3:/usr/qt/3/bin:/usr/games/bin</value>
<value type="QString" >PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString" >PWD=/home/andrey</value>
<value type="QString" >QMAKESPEC=linux-g++</value>
<value type="QString" >QTDIR=/usr</value>
<value type="QString" >SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/5720,unix/buull-eeePC:/tmp/.ICE-unix/5720</value>
<value type="QString" >SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1205,unix/buull-eeePC:/tmp/.ICE-unix/1205</value>
<value type="QString" >SHELL=/bin/bash</value>
<value type="QString" >SHLVL=0</value>
<value type="QString" >SSH_AGENT_PID=5745</value>
<value type="QString" >SSH_AUTH_SOCK=/tmp/keyring-qB4w8J/socket.ssh</value>
<value type="QString" >SPEECHD_PORT=7560</value>
<value type="QString" >SSH_AGENT_PID=1318</value>
<value type="QString" >SSH_AUTH_SOCK=/tmp/keyring-116Pb7/socket.ssh</value>
<value type="QString" >USER=andrey</value>
<value type="QString" >USERNAME=andrey</value>
<value type="QString" >WINDOWPATH=7:7</value>
<value type="QString" >XAUTHORITY=/home/andrey/.Xauthority</value>
<value type="QString" >XDG_CONFIG_DIRS=/etc/xdg</value>
<value type="QString" >XDG_DATA_DIRS=/usr/local/share:/usr/share:/usr/share/gdm</value>
<value type="QString" >XDG_SESSION_COOKIE=998ded06c94c2e848fb0b05949c4e51c-1252342350.758829-1556553659</value>
<value type="QString" >XSESSION=icewm</value>
<value type="QString" >XAUTHORITY=/var/run/gdm/auth-for-andrey-9AQSnh/database</value>
<value type="QString" >XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString" >XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1264754424.556816-274237329</value>
</valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList" >
<value type="QString" >/home/andrey/aliendefender/aliendefender.pro</value>
<value type="QString" >/home/andrey/documents/sm11/Alien Defender/ad/aliendefender.pro</value>
<value type="QString" >-spec</value>
<value type="QString" >/usr/share/qt4/mkspecs/linux-g++</value>
<value type="QString" >-r</value>
<value type="QString" >CONFIG+=debug</value>
<value type="QString" >-Wall</value>
</valuelist>
<value key="abstractProcess.command" type="QString" >/usr/bin/qmake</value>
<value key="abstractProcess.command" type="QString" >/usr/bin/qmake-qt4</value>
<value key="abstractProcess.enabled" type="bool" >false</value>
<value key="abstractProcess.workingDirectory" type="QString" >/home/andrey/aliendefender</value>
<value key="abstractProcess.workingDirectory" type="QString" >/home/andrey/documents/sm11/Alien Defender/ad</value>
<value key="buildConfiguration" type="int" >2</value>
<valuelist key="qmakeArgs" type="QVariantList" >
<value type="QString" >-Wall</value>
@@ -164,52 +146,35 @@
<valuemap type="QVariantMap" >
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString" >Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList" >
<value type="QString" >ANT_HOME=/usr/share/ant</value>
<value type="QString" >CONFIG_PROTECT_MASK=/etc/gentoo-release /etc/sandbox.d /etc/env.d/java/ /etc/udev/rules.d /etc/fonts/fonts.conf /etc/gconf /etc/terminfo /etc/ca-certificates.conf /etc/revdep-rebuild</value>
<value type="QString" >CVS_RSH=ssh</value>
<value type="QString" >DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-OomOx141X7,guid=4e8fac1ae1f40787aeb1f16e4aa53a4f</value>
<value type="QString" >DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-S5Q8zKlbhY,guid=6ef5dd4aeeaf9cb3055a39934b629f00</value>
<value type="QString" >DESKTOP_SESSION=gnome</value>
<value type="QString" >DESKTOP_STARTUP_ID=</value>
<value type="QString" >DISPLAY=:0.0</value>
<value type="QString" >EDITOR=/bin/nano</value>
<value type="QString" >GCC_SPECS=</value>
<value type="QString" >GDK_USE_XFT=1</value>
<value type="QString" >GDMSESSION=gnome</value>
<value type="QString" >GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString" >GDM_LANG=ru_RU.UTF-8</value>
<value type="QString" >GDM_XSERVER_LOCATION=local</value>
<value type="QString" >GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString" >GNOME_KEYRING_SOCKET=/tmp/keyring-qB4w8J/socket</value>
<value type="QString" >GNOME_KEYRING_SOCKET=/tmp/keyring-116Pb7/socket</value>
<value type="QString" >GTK_MODULES=canberra-gtk-module</value>
<value type="QString" >GTK_RC_FILES=/etc/gtk/gtkrc:/home/andrey/.gtkrc-1.2-gnome2</value>
<value type="QString" >HOME=/home/andrey</value>
<value type="QString" >INFOPATH=/usr/share/info:/usr/share/binutils-data/i686-pc-linux-gnu/2.19.1/info:/usr/share/gcc-data/i486-pc-linux-gnu/4.1.2/info:/usr/share/gcc-data/i686-pc-linux-gnu/4.3.3/info</value>
<value type="QString" >JAVAC=/home/andrey/.gentoo/java-config-2/current-user-vm/bin/javac</value>
<value type="QString" >JAVA_HOME=/home/andrey/.gentoo/java-config-2/current-user-vm</value>
<value type="QString" >JDK_HOME=/home/andrey/.gentoo/java-config-2/current-user-vm</value>
<value type="QString" >LANG=ru_RU.UTF-8</value>
<value type="QString" >LESS=-R -M --shift 5</value>
<value type="QString" >LESSOPEN=|lesspipe.sh %s</value>
<value type="QString" >LD_LIBRARY_PATH=/usr/lib/qtcreator:</value>
<value type="QString" >LOGNAME=andrey</value>
<value type="QString" >MANPATH=/home/andrey/.gentoo/java-config-2/current-user-vm/man:/usr/local/share/man:/usr/share/man:/usr/share/binutils-data/i686-pc-linux-gnu/2.19.1/man:/usr/share/gcc-data/i486-pc-linux-gnu/4.1.2/man:/usr/share/gcc-data/i686-pc-linux-gnu/4.3.3/man:/etc/java-config/system-vm/man/:/usr/qt/3/doc/man:/opt/opera/share/man</value>
<value type="QString" >OPENGL_PROFILE=xorg-x11</value>
<value type="QString" >ORBIT_SOCKETDIR=/tmp/orbit-andrey</value>
<value type="QString" >PAGER=/usr/bin/less</value>
<value type="QString" >PATH=/usr/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i486-pc-linux-gnu/gcc-bin/4.1.2:/usr/i686-pc-linux-gnu/gcc-bin/4.3.3:/usr/qt/3/bin:/usr/games/bin</value>
<value type="QString" >PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString" >PWD=/home/andrey</value>
<value type="QString" >QMAKESPEC=linux-g++</value>
<value type="QString" >QTDIR=/usr</value>
<value type="QString" >SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/5720,unix/buull-eeePC:/tmp/.ICE-unix/5720</value>
<value type="QString" >SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1205,unix/buull-eeePC:/tmp/.ICE-unix/1205</value>
<value type="QString" >SHELL=/bin/bash</value>
<value type="QString" >SHLVL=0</value>
<value type="QString" >SSH_AGENT_PID=5745</value>
<value type="QString" >SSH_AUTH_SOCK=/tmp/keyring-qB4w8J/socket.ssh</value>
<value type="QString" >SPEECHD_PORT=7560</value>
<value type="QString" >SSH_AGENT_PID=1318</value>
<value type="QString" >SSH_AUTH_SOCK=/tmp/keyring-116Pb7/socket.ssh</value>
<value type="QString" >USER=andrey</value>
<value type="QString" >USERNAME=andrey</value>
<value type="QString" >WINDOWPATH=7:7</value>
<value type="QString" >XAUTHORITY=/home/andrey/.Xauthority</value>
<value type="QString" >XDG_CONFIG_DIRS=/etc/xdg</value>
<value type="QString" >XDG_DATA_DIRS=/usr/local/share:/usr/share:/usr/share/gdm</value>
<value type="QString" >XDG_SESSION_COOKIE=998ded06c94c2e848fb0b05949c4e51c-1252342350.758829-1556553659</value>
<value type="QString" >XSESSION=icewm</value>
<value type="QString" >XAUTHORITY=/var/run/gdm/auth-for-andrey-9AQSnh/database</value>
<value type="QString" >XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString" >XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1264754424.556816-274237329</value>
</valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList" >
<value type="QString" >-j3</value>
@@ -217,7 +182,7 @@
</valuelist>
<value key="abstractProcess.command" type="QString" >/usr/bin/make</value>
<value key="abstractProcess.enabled" type="bool" >true</value>
<value key="abstractProcess.workingDirectory" type="QString" >/home/andrey/aliendefender</value>
<value key="abstractProcess.workingDirectory" type="QString" >/home/andrey/documents/sm11/Alien Defender/ad</value>
<valuelist key="makeargs" type="QVariantList" >
<value type="QString" >-j3</value>
</valuelist>
@@ -228,43 +193,43 @@
<valuemap type="QVariantMap" >
<value key="ProjectExplorer.BuildConfiguration.DisplayName" type="QString" >Debug</value>
<valuelist key="abstractProcess.Environment" type="QVariantList" >
<value type="QString" >ALLUSERSPROFILE=C:\Documents and Settings\All Users</value>
<value type="QString" >APPDATA=C:\Documents and Settings\Andrey\Application Data</value>
<value type="QString" >COMMONPROGRAMFILES=C:\Program Files\Common Files</value>
<value type="QString" >COMPUTERNAME=COMP</value>
<value type="QString" >COMSPEC=C:\WINDOWS\system32\cmd.exe</value>
<value type="QString" >FP_NO_HOST_CHECK=NO</value>
<value type="QString" >HOMEDRIVE=C:</value>
<value type="QString" >HOMEPATH=\Documents and Settings\Andrey</value>
<value type="QString" >LOGONSERVER=\\COMP</value>
<value type="QString" >NUMBER_OF_PROCESSORS=2</value>
<value type="QString" >OS=Windows_NT</value>
<value type="QString" >PATH=D:\Qt\2009.03\mingw\bin;D:\Qt\2009.03\qt\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem</value>
<value type="QString" >PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH</value>
<value type="QString" >PROCESSOR_ARCHITECTURE=x86</value>
<value type="QString" >PROCESSOR_IDENTIFIER=x86 Family 6 Model 23 Stepping 6, GenuineIntel</value>
<value type="QString" >PROCESSOR_LEVEL=6</value>
<value type="QString" >PROCESSOR_REVISION=1706</value>
<value type="QString" >PROGRAMFILES=C:\Program Files</value>
<value type="QString" >QTDIR=D:/Qt/2009.03/qt</value>
<value type="QString" >SESSIONNAME=Console</value>
<value type="QString" >SYSTEMDRIVE=C:</value>
<value type="QString" >SYSTEMROOT=C:\WINDOWS</value>
<value type="QString" >TEMP=C:\DOCUME~1\Andrey\LOCALS~1\Temp</value>
<value type="QString" >TMP=C:\DOCUME~1\Andrey\LOCALS~1\Temp</value>
<value type="QString" >USERDOMAIN=COMP</value>
<value type="QString" >USERNAME=Andrey</value>
<value type="QString" >USERPROFILE=C:\Documents and Settings\Andrey</value>
<value type="QString" >VS90COMNTOOLS=D:\Programming\Microsoft Visual Studio 9.0\Common7\Tools\</value>
<value type="QString" >WINDIR=C:\WINDOWS</value>
<value type="QString" >DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-S5Q8zKlbhY,guid=6ef5dd4aeeaf9cb3055a39934b629f00</value>
<value type="QString" >DESKTOP_SESSION=gnome</value>
<value type="QString" >DESKTOP_STARTUP_ID=</value>
<value type="QString" >DISPLAY=:0.0</value>
<value type="QString" >GDMSESSION=gnome</value>
<value type="QString" >GDM_KEYBOARD_LAYOUT=us</value>
<value type="QString" >GDM_LANG=ru_RU.UTF-8</value>
<value type="QString" >GNOME_DESKTOP_SESSION_ID=this-is-deprecated</value>
<value type="QString" >GNOME_KEYRING_SOCKET=/tmp/keyring-116Pb7/socket</value>
<value type="QString" >GTK_MODULES=canberra-gtk-module</value>
<value type="QString" >GTK_RC_FILES=/etc/gtk/gtkrc:/home/andrey/.gtkrc-1.2-gnome2</value>
<value type="QString" >HOME=/home/andrey</value>
<value type="QString" >LANG=ru_RU.UTF-8</value>
<value type="QString" >LD_LIBRARY_PATH=/usr/lib/qtcreator:</value>
<value type="QString" >LOGNAME=andrey</value>
<value type="QString" >ORBIT_SOCKETDIR=/tmp/orbit-andrey</value>
<value type="QString" >PATH=/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games</value>
<value type="QString" >PWD=/home/andrey</value>
<value type="QString" >QTDIR=/usr</value>
<value type="QString" >SESSION_MANAGER=local/buull-eeePC:@/tmp/.ICE-unix/1205,unix/buull-eeePC:/tmp/.ICE-unix/1205</value>
<value type="QString" >SHELL=/bin/bash</value>
<value type="QString" >SPEECHD_PORT=7560</value>
<value type="QString" >SSH_AGENT_PID=1318</value>
<value type="QString" >SSH_AUTH_SOCK=/tmp/keyring-116Pb7/socket.ssh</value>
<value type="QString" >USER=andrey</value>
<value type="QString" >USERNAME=andrey</value>
<value type="QString" >XAUTHORITY=/var/run/gdm/auth-for-andrey-9AQSnh/database</value>
<value type="QString" >XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
<value type="QString" >XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1264754424.556816-274237329</value>
</valuelist>
<valuelist key="abstractProcess.arguments" type="QVariantList" >
<value type="QString" >clean</value>
<value type="QString" >-w</value>
</valuelist>
<value key="abstractProcess.command" type="QString" >D:/Qt/2009.03/mingw/bin/mingw32-make.exe</value>
<value key="abstractProcess.command" type="QString" >/usr/bin/make</value>
<value key="abstractProcess.enabled" type="bool" >true</value>
<value key="abstractProcess.workingDirectory" type="QString" >D:/aliendefender</value>
<value key="abstractProcess.workingDirectory" type="QString" >/home/andrey/documents/sm11/Alien Defender/ad</value>
</valuemap>
</data>
<data>

View File

@@ -2,442 +2,306 @@
//using std::vector;
Aliens::Aliens(int TmpDestx, int TmpDesty, int afw, int afh, int alcellsize)
Aliens::Aliens(GameData *dataAliens)
{
cellsize = alcellsize;
DestPoint.setX(TmpDestx - 1);
DestPoint.setY(TmpDesty);
fw = afw;
fh = afh;
//AliensCnt = -1;
CurWave = -1;
Cells = new int*[fw];
TmpCells = new int*[fw];
for (int i = 0; i < fw; i++) {
Cells[i] = new int[fh];
TmpCells[i] = new int[fh];
}
clearCells();
Alien al;
al.PicType = 0;
al.PathIndex = 1;
al.PicIndex = 0;
al.PicFrame = 0;
al.Speed = 0.1;
loadPixmaps(&al);
srcAliens.push_back(al);
CurWave = 0;
data = dataAliens;
TmpCells = new int*[data->size.width()];
for (int i = 0; i < data->size.width(); i++) TmpCells[i] = new int[data->size.height()];
}
bool Aliens::loadPixmaps(Alien * al)
/*int Aliens::loadAlienImages(int PicType)
{
bool load = true;
int i = 0;
while(load) {
QVector<QPixmap> pixmaps;
if (loadPixmap(i,&pixmaps) > 0) {
AliensPixmaps.push_back(pixmaps);
i++;
}
else load = false;
}
qDebug() << "Pictures loaded for" << AliensPixmaps.size() << "alien types!";
if (AliensPixmaps.size() > 0) return true;
else return false;
}
int Aliens::loadPixmap(int PicType, QVector<QPixmap> * pixmaps)
{
int i = 1;
QString str1,str2;
QPixmap tmpAlPixmap;
str1.setNum(i);
str2.setNum(PicType);
qDebug() << PicType;
while (i != 0) {
str1.setNum(i-1);
tmpAlPixmap.load(":/images/Aliens/Al_" + str2 + "_" + str1 + ".png");
if (!tmpAlPixmap.isNull()) {
pixmaps->push_back(tmpAlPixmap);
tmpAlPixmap = 0;
i++;
}
else i = 0;
}
qDebug() << "pictures:" << pixmaps->size();
return pixmaps->size();
}
void Aliens::clearCells()
{
for (int i = 0; i < fw; i++) for (int j = 0; j < fh; j++) Cells[i][j] = 0;
}
int i = 1;
QString str1,str2;
QPixmap tmpAlPixmap;
str1.setNum(i);
str2.setNum(PicType);
while (i != 0) {
str1.setNum(i);
tmpAlPixmap.load("./images/Aliens/Al_" + str2 + "_" + str1 + ".png");
//qDebug() << tmpAlPixmap.isNull();
if (!tmpAlPixmap.isNull()) {
//AlienPix.push_back(tmpAlPixmap);
tmpAlPixmap = 0;
i++;
}
else i = 0;
}
//qDebug() << "pictures:" << AlienPix.size();
return i;
}*/
bool Aliens::AddAlien()
{
//if (CurWave < 0) CurWave = 0;
curAliens.push_back(srcAliens.at(CurWave));
//curAliens[AliensCnt].Level = CurWave + 1;
curAliens[curAliens.size()-1].Position.pnt.setX(0*cellsize);
curAliens[curAliens.size()-1].Position.pnt.setY(fh/2*cellsize); //(int)(fh/2+(1-0.58)*6);
//DestPoint.setX(fw - 1);
//DestPoint.setY(fh / 2); //curAliens[AliensCnt].Position.pnt.y();
curAliens[curAliens.size()-1].DestPnt = DestPoint;
for (int i = 0; i < fw; i++) {
for (int j = 0; j < fh; j++) TmpCells[i][j] = Cells[i][j];
}
if (CreatePath(&curAliens[curAliens.size()-1])) {
curAliens[curAliens.size()-1].Position.pnt.setX(
curAliens[curAliens.size()-1].path[0].x()*cellsize);
curAliens[curAliens.size()-1].Position.pnt.setY(
curAliens[curAliens.size()-1].path[0].y()*cellsize);
return true;
}
return false;
//bool ok;
Alien al;
//AliensCnt++;
//if (CurWave < 0) CurWave = 0;
//if (AliensCnt > curAliens.size()) ReDim Preserve Aliens(AliensCnt) As Alien
//Aliens(AliensCnt) = SrcAliens(CurWave)
curAliens.push_back(al); //srcAliens[CurWave]);
//curAliens[AliensCnt].Level = CurWave + 1;
curAliens[0].Position.pnt = data->start*data->cellsize;
; //(int)(fh/2+(1-0.58)*6);
//DestPoint.setX(fw - 1);
//DestPoint.setY(fh / 2); //curAliens[AliensCnt].Position.pnt.y();
curAliens[0].DestPnt = data->finish;
// curAliens[AliensCnt].MaxFrame = 0; //srcAliens[CurWave].MaxFrame;
// curAliens[AliensCnt].PicFrame = 0;
return CreatePath(&curAliens[0]);
}
bool Aliens::CreatePath(Alien * al)
{
QPointF tp;
QVector<QPointF> tmpPnt;
if (WaveTrace(al))
{
for (int j=0; j<4; j++)
{
tmpPnt.clear();
tp = al->path[0];
//qDebug() << al->path.at(0);
tmpPnt.push_back(tp);
for (int i = 0; i < al->path.size() - 1; i++)
{
tp.setX((al->path[i].x() + al->path[i + 1].x()) / 2.0);
tp.setY((al->path[i].y() + al->path[i + 1].y()) / 2.0);
tmpPnt.push_back(tp);
}
tp = al->path[al->path.size() - 1];
tmpPnt.push_back(tp);
//qDebug() << tmpPnt.size();
al->path = tmpPnt;
}
tmpPnt.clear();
return true;
}
return false;
}
void Aliens::updateAliens()
{
qDebug("*********************");
//qDebug() << curAliens[0].path;
for (int i = 0; i < curAliens.size(); i++) updateAlienPos(&curAliens[i]);
qDebug("*********************");
QPointF tp;
QVector<QPointF> tmpPnt;
//tmpPnt.clear();
// AliensTmpDestX = fw - 1;//al->Destpnt.x();
// AliensTmpDestY = fh / 2;//al->Destpnt.y();
// al->Position.pnt.x() = 0;
// al->Position.pnt.y() = fh / 2;
for (int i = 0; i < data->size.width(); i++) {
for (int j = 0; j < data->size.height(); j++) TmpCells[i][j] = data->Cells[i][j];
}
al->path.clear();
al->PathIndex = 0;
if (WaveTrace(al))
{
for (int j=0; j<4; j++)
{
tmpPnt.clear();
tp = al->path[0];
tmpPnt.push_back(tp);
for (int i = 0; i < al->path.size() - 1; i++)
{
tp.setX((al->path[i].x() + al->path[i + 1].x()) / 2);
tp.setY((al->path[i].y() + al->path[i + 1].y()) / 2);
tmpPnt.push_back(tp);
}
tp = al->path[al->path.size() - 1];
tmpPnt.push_back(tp);
qDebug() << tmpPnt.size();
al->path = tmpPnt;
//al->Position.pnt.setX(al->path[0].x()*data->cellsize);
//al->Position.pnt.setY(al->path[0].y()*data->cellsize);
}
tmpPnt.clear();
return true;
}
return false;
//return WaveTrace(al);
}
void Aliens::updateAlienPos(Alien * al)
{
float arctg = 0;
float px,py,dk;
float dx,dy,fdx,fdy;
//qDebug() << cellsize;
px = al->path[al->PathIndex].x() - al->path[al->PathIndex - 1].x();
py = al->path[al->PathIndex].y() - al->path[al->PathIndex - 1].y();
dx = al->Position.pnt.x() - al->path[al->PathIndex].x() * cellsize;
dy = al->Position.pnt.y() - al->path[al->PathIndex].y() * cellsize;
dk = cellsize / sqrtf(px * px + py * py);
qDebug() << dx << ";" << dy;
qDebug() << px << ";" << py;
//qDebug() << al->path;//[al->PathIndex];
//qDebug() << al->path.size();
qDebug() << "PathIndex" << al->PathIndex;
//qDebug() << al->path[al->PathIndex-1];
if (al->PathIndex + 1 < al->path.size()) {
fdx = al->Position.pnt.x() - al->path[al->PathIndex+1].x() * cellsize;
fdy = al->Position.pnt.y() - al->path[al->PathIndex+1].y() * cellsize;
if (fdy != 0) arctg = atanf(fdx/fdy);
else if (fdx < 0) arctg = -3.1415/2;
else arctg = 3.1415/2;
}
//qDebug() << fdx << ";" << fdy;
al->Position.angle = 180*(-arctg)/3.1415;
if (fdy < 0) al->Position.angle = 180 + al->Position.angle;
//qDebug() << al->Position.angle;
qDebug() << al->Position.pnt;
if (qAbs(dx) <= al->Speed * dk && qAbs(dy) <= al->Speed * dk) {
qDebug("next");
al->Position.pnt.setX(al->path[al->PathIndex].x() * cellsize);
al->Position.pnt.setY(al->path[al->PathIndex].y() * cellsize);
al->PathIndex++;
}
else {
qDebug("go");
al->Position.pnt.setX(al->Position.pnt.x()+px * al->Speed * dk);
al->Position.pnt.setY(al->Position.pnt.y()+py * al->Speed * dk);
}
qDebug() << al->Position.pnt;
al->PicIndex++;
//qDebug() << "PicIndex" << al->PicIndex;
//qDebug() << "PicType" << al->PicType;
//qDebug() << AliensPixmaps[al->PicType].size();
if (al->PicIndex >= AliensPixmaps[al->PicType].size()) al->PicIndex = 0;
if (al->PathIndex >= al->path.size()) {
//qDebug() << "run agan";
al->PathIndex = 1;
al->Position.pnt.setX(al->path.value(0).x()*cellsize);
al->Position.pnt.setY(al->path.value(0).y()*cellsize);
}
}
/*bool Aliens::PathIntersect(Alien* Al, Rectangle rect)
{
//PathIntersect = False
for (int i = Al->PathIndex; i<=Al->path.size(); i++) // To UBound(Al.path(), 1)
if (Al->path[i].x + 0.5 >= rect.x0 - 1 && Al->path[i].x + 0.5 <= rect.x1 + 1)
if (Al->path[i].y + 0.5 >= rect.y0 - 1 && Al->path[i].y + 0.5 <= rect.y1 + 1)
return true; //PathIntersect = True //Exit Function
return false;
//PathIntersect = False
for (int i = Al->PathIndex; i<=Al->path.size(); i++) // To UBound(Al.path(), 1)
if (Al->path[i].x + 0.5 >= rect.x0 - 1 && Al->path[i].x + 0.5 <= rect.x1 + 1)
if (Al->path[i].y + 0.5 >= rect.y0 - 1 && Al->path[i].y + 0.5 <= rect.y1 + 1)
return true; //PathIntersect = True //Exit Function
return false;
}*/
bool Aliens::recreatePath()
{
QVector <QPointF> tmpPath;
QPointF tmppnt;
//bool trace;
for (int i = 0; i < fw; i++)
for (int j = 0; j < fh; j++) TmpCells[i][j] = Cells[i][j];
for (int i = 0; i < curAliens.size(); i++) {
qDebug() << "##############";
qDebug() << "Alinen N" << i;
qDebug() << curAliens[i].Position.pnt;
qDebug() << curAliens[i].PathIndex;
if (curAliens[i].Position.pnt.x() - curAliens[i].path[curAliens[i].PathIndex].x()*cellsize < cellsize/2
&& curAliens[i].Position.pnt.y() - curAliens[i].path[curAliens[i].PathIndex].y()*cellsize < cellsize/2)
qDebug() << "Yes!!";
else qDebug() << "NO!!";
tmppnt = curAliens[i].Position.pnt;
curAliens[i].Position.pnt.setX(curAliens[i].path[curAliens[i].PathIndex - 1].x() * cellsize);
curAliens[i].Position.pnt.setY(curAliens[i].path[curAliens[i].PathIndex - 1].y() * cellsize);
curAliens[i].PathIndex = 1;
qDebug() << curAliens[i].Position.pnt;
tmpPath = curAliens[i].path;
curAliens[i].path.clear();
//trace = CreatePath(&curAliens[i]);
if (!CreatePath(&curAliens[i])) {
curAliens[i].path = tmpPath;
curAliens[i].Position.pnt = tmppnt;
tmpPath.clear();
//trace = false;
qDebug() << "##############";
return false;
}
curAliens[i].Position.pnt = tmppnt;
qDebug() << curAliens[i].Position.pnt;
qDebug() << "===============";
}
tmpPath.clear();
qDebug() << "Re-create path sucsess!";
return true;
}
bool Aliens::WaveTrace(Alien * al)
{
bool stop = false;
int step = 2;
QPoint cp, tp;
QRect fr(0, 0, fw, fh);
QVector<QPoint> tmpp, curp;
cp.setX(al->Position.pnt.x()/cellsize);
cp.setY(al->Position.pnt.y()/cellsize);
curp.push_back(cp);
TmpCells[cp.x()][cp.y()] = 1;
while (!stop) {
//qDebug() << "trace";
tmpp = curp;
curp.clear();
//qDebug() << tmpp.size();
stop = true;
for (int i = 0; i < tmpp.size(); i++) {
cp = tmpp[i];
if (cp == al->DestPnt) {
TmpCells[cp.x()][cp.y()] = step;
qDebug() << "Wawe trace done";
InvWaveTrace(cp, step, al);
qDebug() << al->path.size();
return true;
}
tp.setX(cp.x() - 1);
tp.setY(cp.y());
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
tp.setX(cp.x() + 1);
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
tp.setX(cp.x());
tp.setY(cp.y() - 1);
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
tp.setY(cp.y() + 1);
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
}
step++;
}
qDebug() << "false wawetrace";
return false;
bool Aliens::WaveTrace(Alien * al) {
bool stop = false;
int step = 2;
QPoint cp, tp;
QRect fr(0, 0, data->size.width(), data->size.height());
QVector<QPoint> tmpp, curp;
cp = al->Position.pnt/data->cellsize;
curp.push_back(cp);
TmpCells[cp.x()][cp.y()] = 1;
while (!stop) {
qDebug() << "trace";
tmpp = curp;
curp.clear();
qDebug() << tmpp.size();
stop = true;
for (int i = 0; i < tmpp.size(); i++) {
cp = tmpp[i];
if (cp == al->DestPnt) {
TmpCells[cp.x()][cp.y()] = step;
qDebug() << "true";
InvWaveTrace(cp, step, al);
qDebug() << al->path.size();
return true;
}
tp.setX(cp.x() - 1);
tp.setY(cp.y());
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
tp.setX(cp.x() + 1);
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
tp.setX(cp.x());
tp.setY(cp.y() - 1);
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
tp.setY(cp.y() + 1);
if (fr.contains(tp) && TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
}
step++;
}
qDebug() << "false";
return false;
}
void Aliens::InvWaveTrace(QPoint cp, int cnt, Alien * al)
{
QPoint wp, Ppnt;
int Ind, c, AliensTmpDestX, AliensTmpDestY, xpp, ypp, xnn, ynn;
unsigned char chk;
Ppnt = wp = cp;
xnn=0;
xpp=0;
ynn=0;
ypp=0;
cnt--;
al->path.push_front(Ppnt);
AliensTmpDestX = al->Position.pnt.x();
AliensTmpDestY = al->Position.pnt.y();
while (cnt > 1)
{
cnt--;
chk = 0;
Ind = 0;
c = 0;
if (wp.x() - 1 >= 0 && TmpCells[wp.x()-1][wp.y()] == cnt)
{
chk = chk | 0x01;
c++;
}
if (wp.x() + 1 < fw && TmpCells[wp.x()+1][wp.y()] == cnt)
{
chk = chk | 0x02;
c++;
}
if (wp.y() - 1 >= 0 && TmpCells[wp.x()][wp.y()-1] == cnt)
{
chk = chk | 0x04;
c++;
}
if (wp.y() + 1 < fh && TmpCells[wp.x()][wp.y()+1] == cnt)
{
chk = chk | 0x08;
c++;
}
if (c == 0 || chk == 0) qDebug() << "ERROR!!!";
if (c > 1)
{
if ((chk & 0x01)==0x01 && (chk & 0x04)==0x04)
{
if (xnn <= ynn && Ind == 0){
wp.rx()--;
xnn++;
if (xnn == ynn) xnn++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()--;
ynn++;
ynn++;
Ind = 1;
}
}
if ((chk & 0x02)==0x02 && (chk & 0x04)==0x04)
{
if (xpp <= ynn && Ind == 0){
wp.rx()++;
xpp++;
if (xpp == ynn) xpp++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()--;
ynn++;
ynn++;
Ind = 1;
}
}
if ((chk & 0x01)==0x01 && (chk & 0x08)==0x08)
{
if (xnn <= ypp && Ind == 0){
wp.rx()--;
xnn++;
if (xnn == ypp) xnn++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()++;
ypp++;
ypp++;
Ind = 1;
}
}
if ((chk & 0x02)==0x02 && (chk & 0x08)==0x08)
{
if (xpp <= ypp && Ind == 0){
wp.rx()++;
xpp++;
if (xpp == ypp) xpp++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()++;
ypp++;
ypp++;
Ind = 1;
}
}
}
if (c == 1 || Ind == 0)
{
xnn=0;
xpp=0;
ynn=0;
ypp=0;
if ((chk & 0x01)==0x01) {
wp.rx()--;
xnn++;
}
else if ((chk & 0x02)==0x02) {
wp.rx()++;
xpp++;
}
else if ((chk & 0x04)==0x04) {
wp.ry()--;
ynn++;
}
else if ((chk & 0x08)==0x08) {
wp.ry()++;
ypp++;
}
}
Ppnt = wp;
al->path.push_front(Ppnt);
}
QPoint wp, Ppnt;
int Ind, c, AliensTmpDestX, AliensTmpDestY, xpp, ypp, xnn, ynn;
unsigned char chk;
Ppnt = wp = cp;
xnn=0;
xpp=0;
ynn=0;
ypp=0;
cnt--;
al->path.push_front(Ppnt);
AliensTmpDestX = al->Position.pnt.x();
AliensTmpDestY = al->Position.pnt.y();
while (cnt > 1)
{
cnt--;
chk = 0;
Ind = 0;
c = 0;
if (wp.x() - 1 >= 0 && TmpCells[wp.x()-1][wp.y()] == cnt)
{
chk = chk | 0x01;
c++;
}
if (wp.x() + 1 < data->size.width() && TmpCells[wp.x()+1][wp.y()] == cnt)
{
chk = chk | 0x02;
c++;
}
if (wp.y() - 1 >= 0 && TmpCells[wp.x()][wp.y()-1] == cnt)
{
chk = chk | 0x04;
c++;
}
if (wp.y() + 1 < data->size.height() && TmpCells[wp.x()][wp.y()+1] == cnt)
{
chk = chk | 0x08;
c++;
}
if (c == 0 || chk == 0) qDebug() << "ERROR!!!";
if (c > 1)
{
if ((chk & 0x01)==0x01 && (chk & 0x04)==0x04)
{
if (xnn <= ynn && Ind == 0){
wp.rx()--;
xnn++;
if (xnn == ynn) xnn++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()--;
ynn++;
ynn++;
Ind = 1;
}
}
if ((chk & 0x02)==0x02 && (chk & 0x04)==0x04)
{
if (xpp <= ynn && Ind == 0){
wp.rx()++;
xpp++;
if (xpp == ynn) xpp++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()--;
ynn++;
ynn++;
Ind = 1;
}
}
if ((chk & 0x01)==0x01 && (chk & 0x08)==0x08)
{
if (xnn <= ypp && Ind == 0){
wp.rx()--;
xnn++;
if (xnn == ypp) xnn++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()++;
ypp++;
ypp++;
Ind = 1;
}
}
if ((chk & 0x02)==0x02 && (chk & 0x08)==0x08)
{
if (xpp <= ypp && Ind == 0){
wp.rx()++;
xpp++;
if (xpp == ypp) xpp++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()++;
ypp++;
ypp++;
Ind = 1;
}
}
}
if (c == 1 || Ind == 0)
{
xnn=0;
xpp=0;
ynn=0;
ypp=0;
if ((chk & 0x01)==0x01) {
wp.rx()--;
xnn++;
}
else if ((chk & 0x02)==0x02) {
wp.rx()++;
xpp++;
}
else if ((chk & 0x04)==0x04) {
wp.ry()--;
ynn++;
}
else if ((chk & 0x08)==0x08) {
wp.ry()++;
ypp++;
}
}
Ppnt = wp;
al->path.push_front(Ppnt);
}
}
void Aliens::clearAliens()
{
curAliens.clear();
//AliensCnt = - 1;
curAliens.clear();
}

View File

@@ -2,36 +2,27 @@
#define ALIENS_H
#include "basestruct.h"
//#include <vector>
class Aliens
{
public:
Aliens(int TmpDestx, int TmpDesty, int afw, int afh, int alcellsize);
public:
Aliens(GameData *dataAliens);
QVector<Alien> srcAliens;
QVector<Alien> curAliens;
int ** Cells;
int CurWave;
//bool PathIntersect(Alien* Al, Rectangle rect);
QVector<Alien> srcAliens;
QVector<Alien> curAliens;
//bool PathIntersect(Alien* Al, Rectangle rect);
bool AddAlien();
void clearAliens();
void clearCells();
bool recreatePath();
void updateAliens();
QVector<QVector<QPixmap> > AliensPixmaps;
private:
int cellsize;
int ** TmpCells;
int fw, fh;
QPoint DestPoint;
bool WaveTrace(Alien* al);
bool CreatePath(Alien* al);
void InvWaveTrace(QPoint cp, int cnt, Alien* al);
void updateAlienPos(Alien * al);
int loadPixmap(int PicType, QVector<QPixmap> * pixmaps);
bool loadPixmaps(Alien * al);
bool AddAlien();
void clearAliens();
bool CreatePath(Alien* al);
private:
int ** TmpCells;
GameData * data;
QVector< QVector<QPixmap> > AliensPixmaps;
bool WaveTrace(Alien* al);
void InvWaveTrace(QPoint cp, int cnt, Alien* al);
void updateAlienPos(Alien * al);
//int loadAlienImages(int PicType);
};
#endif // ALIENS_H

BIN
aliens.o

Binary file not shown.

View File

@@ -5,23 +5,28 @@
#include <QPoint>
#include <QString>
#include <QPixmap>
#include <QPointF>
#include <QRect>
#include <QSize>
#include <QDebug>
#include <cmath>
//#include <deque>
using std::atan;
//using std::deque;
struct FPVector
{
QPointF pnt;
float angle;
QPoint pnt;
float angle;
};
struct GameData
{
QSize size;
QPoint start;
QPoint finish;
int cellsize;
int ** Cells;
};
/*struct Effect
{
float Health;
@@ -33,11 +38,10 @@ struct FPVector
};*/
struct AlienImages
/*struct AlienImages
{
QVector<QPixmap> pix;
int type;
};
vector<QPixmap> pix;
};*/
struct Alien
@@ -59,8 +63,8 @@ struct Alien
float PicFrame;
//float PicI;
//float Regeneration;
QVector<QPointF> path;//path() As Point
QPoint DestPnt;
QVector<QPointF> path;//path() As Point
QPoint DestPnt;
// Effect Effects;
};
@@ -72,7 +76,7 @@ struct Tower
//float angle;
//int flx;
//int fly;
QPointF Center;
QPoint Center;
//Point FirePnt;
//int BaseType;
//int Damage;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,73 +0,0 @@
/****************************************************************************
** Meta object code from reading C++ file 'mainwindow.h'
**
** Created: Sun 6. Sep 19:03:09 2009
** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../mainwindow.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'mainwindow.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 61
#error "This file was generated using the moc from 4.5.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_MainWindow[] = {
// content:
2, // revision
0, // classname
0, 0, // classinfo
1, 12, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
// slots: signature, parameters, type, tag, flags
12, 11, 11, 11, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_MainWindow[] = {
"MainWindow\0\0ADrender()\0"
};
const QMetaObject MainWindow::staticMetaObject = {
{ &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow,
qt_meta_data_MainWindow, 0 }
};
const QMetaObject *MainWindow::metaObject() const
{
return &staticMetaObject;
}
void *MainWindow::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_MainWindow))
return static_cast<void*>(const_cast< MainWindow*>(this));
return QMainWindow::qt_metacast(_clname);
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: ADrender(); break;
default: ;
}
_id -= 1;
}
return _id;
}
QT_END_MOC_NAMESPACE

Binary file not shown.

View File

@@ -1,73 +0,0 @@
/****************************************************************************
** Meta object code from reading C++ file 'udpsender.h'
**
** Created: Sun 6. Sep 19:03:10 2009
** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../udpsender.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'udpsender.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 61
#error "This file was generated using the moc from 4.5.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_UdpSender[] = {
// content:
2, // revision
0, // classname
0, 0, // classinfo
1, 12, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
// slots: signature, parameters, type, tag, flags
11, 10, 10, 10, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_UdpSender[] = {
"UdpSender\0\0slotRead()\0"
};
const QMetaObject UdpSender::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_UdpSender,
qt_meta_data_UdpSender, 0 }
};
const QMetaObject *UdpSender::metaObject() const
{
return &staticMetaObject;
}
void *UdpSender::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_UdpSender))
return static_cast<void*>(const_cast< UdpSender*>(this));
return QObject::qt_metacast(_clname);
}
int UdpSender::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: slotRead(); break;
default: ;
}
_id -= 1;
}
return _id;
}
QT_END_MOC_NAMESPACE

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

15
game.cpp Normal file
View File

@@ -0,0 +1,15 @@
#include "game.h"
game::game(QSize size, QPoint start, QPoint finish, int cellsize)
{
data = new GameData();
data->size = size/cellsize;
data->start = start/cellsize;
data->finish = finish/cellsize;
data->cellsize = cellsize;
data->Cells = new int*[data->size.width()];
for (int i = 0; i < data->size.width(); i++) {
data->Cells[i] = new int[data->size.height()];
for (int j = 0; j < data->size.height(); j++) data->Cells[i][j] = 0;
}
}

13
game.h Normal file
View File

@@ -0,0 +1,13 @@
#ifndef GAME_H
#define GAME_H
#include "basestruct.h"
class game
{
public:
game(QSize size, QPoint start, QPoint finish, int cellsize);
GameData *data;
};
#endif // GAME_H

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

BIN
main.o

Binary file not shown.

View File

@@ -3,108 +3,106 @@
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
qDebug() << "Load START!";
ui->setupUi(this);
sndr = new UdpSender("127.0.0.1",10101);
sndr->connectSend("hellow");
cellsize = 16;
destx = this->width() / cellsize;
desty = this->height() / cellsize / 2;
QTimer *timer = new QTimer(this);
adp = new adpainter(this->width(),this->height(),cellsize);
adp->clear();
adp->drawgrid();
connect(timer, SIGNAL(timeout()), this, SLOT(ADrender()));
aliens = new Aliens(destx, desty, this->width() / cellsize ,this->height() / cellsize, cellsize);
if (!aliens->AddAlien()) qDebug() << "Error Loading";
this->setGeometry(100,100,this->width(),this->height());
//qDebug() << "QT version" << qVersion();
timer->start(50);
qDebug() << "Load DONE!";
qDebug() << "Load START!";
ui->setupUi(this);
sndr = new UdpSender("127.0.0.1",10101);
sndr->connectSend("hellow");
cellsize = 16;
destx = this->width() / cellsize;
desty = this->height() / cellsize / 2;
timer = new QTimer(this);
adp = new adpainter(this->width(),this->height(),cellsize);
adp->clear();
adp->drawgrid();
connect(timer, SIGNAL(timeout()), this, SLOT(ADrender()));
GameMain = new game(this->size(),QPoint(0,this->height()/2),QPoint(this->width()-cellsize,this->height()/2), cellsize);
aliens = new Aliens(GameMain->data);
aliens->AddAlien();
this->setGeometry(100,100,this->width(),this->height());
//qDebug() << "QT version" << qVersion();
//AnimAlien = 0;
timer->start(50);
qDebug() << "Load DONE!";
}
void MainWindow::ADrender()
{
//aliens->AddAlien();
aliens->updateAliens();
adp->drawAliens(&aliens->curAliens[0], &aliens->AliensPixmaps[0]);
this->repaint();
adp->drawAliens(aliens->curAliens[0].path, &aliens->curAliens[0].Position);
this->repaint();
}
void MainWindow::paintEvent(QPaintEvent*)
{
QPainter painter;
painter.begin(this);
painter.drawPixmap(0,0,*adp->getPixmap());
painter.end();
QPainter painter;
painter.begin(this);
painter.drawPixmap(0,0,*adp->getPixmap());
painter.end();
}
void MainWindow::mouseMoveEvent ( QMouseEvent * event )
{
if (mousebt == 1) ClearCell(event->x(),event->y());
else SetCell(event->x(),event->y());
if (mousebt == 1) ClearCell(event->x(),event->y());
else SetCell(event->x(),event->y());
}
void MainWindow::mousePressEvent ( QMouseEvent * event )
{
if (event->button() == Qt::RightButton) {
ClearCell(event->x(),event->y());
mousebt = 1;
} else {
SetCell(event->x(),event->y());
mousebt = 0;
}
if (event->button() == Qt::RightButton) {
ClearCell(event->x(),event->y());
mousebt = 1;
} else {
SetCell(event->x(),event->y());
mousebt = 0;
}
}
void MainWindow::SetCell(int x, int y)
{
QPoint cp;
QRect wdrect(0, 0, (this->width() / cellsize) * cellsize, (this->height() / cellsize) * cellsize);
if (wdrect.contains(x,y)) {
cp.setX((int) x / cellsize);
cp.setY((int) y / cellsize);
//qDebug() << "click: " << cp.x() << ";" << cp.y();
aliens->Cells[cp.x()][cp.y()] = - 1;
adp->drawcell(cp);
//aliens->recreatePath();
//adp->AnimAlien=0;
//aliens->curAliens[aliens->CurWave].Position.pnt = aliens->curAliens[aliens->CurWave-1].path[adp->StepAlien];
if (!aliens->recreatePath()) {
aliens->Cells[cp.x()][cp.y()] = 0;
adp->clearcell(cp);
qDebug() << "DONT CLOSE THE PATH";
}
}
QPoint cp;
QRect wdrect(0, 0, (this->width() / cellsize) * cellsize, (this->height() / cellsize) * cellsize);
if (wdrect.contains(x,y)) {
cp.setX((int) x / cellsize);
cp.setY((int) y / cellsize);
//qDebug() << "click: " << cp.x() << ";" << cp.y();
GameMain->data->Cells[cp.x()][cp.y()] = - 1;
adp->drawcell(cp);
//aliens->clearAliens();
//adp->StepAlien=0;
//adp->AnimAlien=0;
if (!aliens->CreatePath(&(aliens->curAliens[0]))) ClearCell(x,y);
else adp->StepAlien=0;
}
}
void MainWindow::ClearCell(int x, int y)
{
QPoint cp;
QRect wdrect(0, 0, (this->width() / cellsize) * cellsize, (this->height() / cellsize) * cellsize);
if (wdrect.contains(x,y)) {
cp.setX((int) x / cellsize);
cp.setY((int) y / cellsize);
//qDebug() << "click: " << cp.x() << ";" << cp.y();
aliens->Cells[cp.x()][cp.y()] = 0;
adp->clearcell(cp);
aliens->recreatePath();
//aliens->clearAliens();
//aliens->AddAlien();
}
QPoint cp;
QRect wdrect(0, 0, (this->width() / cellsize) * cellsize, (this->height() / cellsize) * cellsize);
if (wdrect.contains(x,y)) {
cp.setX((int) x / cellsize);
cp.setY((int) y / cellsize);
//qDebug() << "click: " << cp.x() << ";" << cp.y();
GameMain->data->Cells[cp.x()][cp.y()] = 0;
adp->clearcell(cp);
//aliens->clearAliens();
//aliens->AddAlien();
aliens->CreatePath(&(aliens->curAliens[0]));
adp->StepAlien=0;
}
}
MainWindow::~MainWindow()
{
delete ui;
delete aliens;
delete adp;
delete ui;
delete aliens;
delete adp;
}

View File

@@ -2,40 +2,42 @@
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
#include <QtDebug>
#include <QTimer>
#include "adpainter.h"
#include "aliens.h"
#include "udpsender.h"
#include "game.h"
namespace Ui
{
class MainWindow;
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void ADrender();
void ADrender();
private:
void paintEvent(QPaintEvent*);
void SetCell(int x, int y);
void ClearCell(int x, int y);
void mouseMoveEvent ( QMouseEvent * event );
void mousePressEvent ( QMouseEvent * event );
Ui::MainWindow *ui;
void paintEvent(QPaintEvent*);
void SetCell(int x, int y);
void ClearCell(int x, int y);
void mouseMoveEvent ( QMouseEvent * event );
void mousePressEvent ( QMouseEvent * event );
Ui::MainWindow *ui;
Aliens * aliens;
UdpSender * sndr;
adpainter * adp;
bool mousebt;
int cellsize, destx, desty;
//unsigned int AnimAlien;
UdpSender * sndr;
adpainter * adp;
game * GameMain;
QTimer *timer;
bool mousebt;
int cellsize, destx, desty;
//unsigned int AnimAlien;
};

Binary file not shown.

View File

@@ -31,18 +31,7 @@
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="widget">
<widget class="QWidget" name="paintWidget" native="true">
<property name="geometry">
<rect>
<x>40</x>
<y>20</y>
<width>361</width>
<height>181</height>
</rect>
</property>
</widget>
</widget>
<widget class="QWidget" name="widget"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>

6
map.cpp Normal file
View File

@@ -0,0 +1,6 @@
#include "map.h"
map::map(GameData *dataMap)
{
}

13
map.h Normal file
View File

@@ -0,0 +1,13 @@
#ifndef MAP_H
#define MAP_H
#include "basestruct.h"
class map
{
public:
map(GameData *dataMap);
QPixmap * background;
};
#endif // MAP_H

View File

@@ -1,73 +0,0 @@
/****************************************************************************
** Meta object code from reading C++ file 'mainwindow.h'
**
** Created: Sat Sep 12 14:04:46 2009
** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "mainwindow.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'mainwindow.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 61
#error "This file was generated using the moc from 4.5.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_MainWindow[] = {
// content:
2, // revision
0, // classname
0, 0, // classinfo
1, 12, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
// slots: signature, parameters, type, tag, flags
12, 11, 11, 11, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_MainWindow[] = {
"MainWindow\0\0ADrender()\0"
};
const QMetaObject MainWindow::staticMetaObject = {
{ &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow,
qt_meta_data_MainWindow, 0 }
};
const QMetaObject *MainWindow::metaObject() const
{
return &staticMetaObject;
}
void *MainWindow::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_MainWindow))
return static_cast<void*>(const_cast< MainWindow*>(this));
return QMainWindow::qt_metacast(_clname);
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: ADrender(); break;
default: ;
}
_id -= 1;
}
return _id;
}
QT_END_MOC_NAMESPACE

Binary file not shown.

View File

@@ -1,73 +0,0 @@
/****************************************************************************
** Meta object code from reading C++ file 'udpsender.h'
**
** Created: Sat Sep 12 14:04:47 2009
** by: The Qt Meta Object Compiler version 61 (Qt 4.5.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "udpsender.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'udpsender.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 61
#error "This file was generated using the moc from 4.5.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
static const uint qt_meta_data_UdpSender[] = {
// content:
2, // revision
0, // classname
0, 0, // classinfo
1, 12, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
// slots: signature, parameters, type, tag, flags
11, 10, 10, 10, 0x0a,
0 // eod
};
static const char qt_meta_stringdata_UdpSender[] = {
"UdpSender\0\0slotRead()\0"
};
const QMetaObject UdpSender::staticMetaObject = {
{ &QObject::staticMetaObject, qt_meta_stringdata_UdpSender,
qt_meta_data_UdpSender, 0 }
};
const QMetaObject *UdpSender::metaObject() const
{
return &staticMetaObject;
}
void *UdpSender::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_UdpSender))
return static_cast<void*>(const_cast< UdpSender*>(this));
return QObject::qt_metacast(_clname);
}
int UdpSender::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QObject::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: slotRead(); break;
default: ;
}
_id -= 1;
}
return _id;
}
QT_END_MOC_NAMESPACE

Binary file not shown.

11970
qrc_res.cpp

File diff suppressed because it is too large Load Diff

BIN
qrc_res.o

Binary file not shown.

24
res.qrc
View File

@@ -1,24 +0,0 @@
<RCC>
<qresource prefix="/" >
<file>images/Aliens/Al_0_0.png</file>
<file>images/Aliens/Al_0_1.png</file>
<file>images/Aliens/Al_0_2.png</file>
<file>images/Aliens/Al_0_3.png</file>
<file>images/Aliens/Al_0_4.png</file>
<file>images/Aliens/Al_0_5.png</file>
<file>images/Aliens/Al_0_6.png</file>
<file>images/Aliens/Al_0_7.png</file>
<file>images/Aliens/Al_0_8.png</file>
<file>images/Aliens/Al_0_9.png</file>
<file>images/Aliens/Al_0_10.png</file>
<file>images/Aliens/Al_0_11.png</file>
<file>images/Aliens/Al_0_12.png</file>
<file>images/Aliens/Al_0_13.png</file>
<file>images/Aliens/Al_0_14.png</file>
<file>images/Aliens/Al_0_15.png</file>
<file>images/Aliens/Al_0_16.png</file>
<file>images/Aliens/Al_0_17.png</file>
<file>images/Aliens/Al_0_18.png</file>
<file>images/Aliens/Al_0_19.png</file>
</qresource>
</RCC>

View File

@@ -1,11 +1,11 @@
#include "towers.h"
towers::towers()
towers::towers(GameData *dataTowers)
{
}
void towers::AddTower(QPointF point, int ** cells)
void towers::AddTower(QPoint point, int type)
{
}

View File

@@ -6,10 +6,10 @@
class towers
{
public:
towers();
towers(GameData *dataTowers);
QVector<Tower> srcTowers;
QVector<Tower> curTowers;
void AddTower(QPointF point, int ** cells);
void AddTower(QPoint point, int type);
};
#endif // TOWERS_H

BIN
towers.o

Binary file not shown.

View File

@@ -3,12 +3,12 @@
UdpSender::UdpSender(QString IP, quint16 Port)
{
sock = new QUdpSocket();
sock = new QUdpSocket();
qDebug() << sock->state();
//cout << sock->socketDescriptor() << endl;
//qDebug() << sock->socketDescriptor();
addr = QHostAddress(IP);
port = Port;
addr = QHostAddress(IP);
port = Port;
connect(sock, SIGNAL(readyRead()),this, SLOT(slotRead()));
}
@@ -16,7 +16,7 @@ UdpSender::UdpSender(QString IP, quint16 Port)
UdpSender::~UdpSender()
{
sock->close();
delete sock;
delete sock;
}
@@ -31,15 +31,16 @@ void UdpSender::slotRead()
//cout << endl;
//qDebug() << sock->write(recstr.toUtf8());
qDebug() << sock->socketDescriptor();
emit dataResieved(recdata);
}
void UdpSender::connectSend(QString s)
{
sz = s.length();
sz = s.length();
sock->connectToHost(addr,port);
//qDebug() << sock->error();
qDebug() << sock->error();
qDebug() << sock->state();
//qDebug() << sock->socketDescriptor();
qDebug() << sock->write(s.toUtf8()) << "writen!";
qDebug() << sock->socketDescriptor();
if (sock->write(s.toUtf8())>0) qDebug() << "writen!";
}

View File

@@ -21,4 +21,6 @@ class UdpSender : public QObject
quint16 port;
quint32 sz;
QByteArray * senddata;
signals:
void dataResieved(QByteArray * data);
};

Binary file not shown.

View File

@@ -1,67 +0,0 @@
/********************************************************************************
** Form generated from reading ui file 'mainwindow.ui'
**
** Created: Sat Sep 12 14:04:38 2009
** by: Qt User Interface Compiler version 4.5.2
**
** WARNING! All changes made in this file will be lost when recompiling ui file!
********************************************************************************/
#ifndef UI_MAINWINDOW_H
#define UI_MAINWINDOW_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QHeaderView>
#include <QtGui/QMainWindow>
#include <QtGui/QWidget>
QT_BEGIN_NAMESPACE
class Ui_MainWindow
{
public:
QWidget *widget;
QWidget *paintWidget;
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
MainWindow->resize(800, 400);
QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(MainWindow->sizePolicy().hasHeightForWidth());
MainWindow->setSizePolicy(sizePolicy);
MainWindow->setMinimumSize(QSize(800, 400));
MainWindow->setBaseSize(QSize(800, 400));
widget = new QWidget(MainWindow);
widget->setObjectName(QString::fromUtf8("widget"));
paintWidget = new QWidget(widget);
paintWidget->setObjectName(QString::fromUtf8("paintWidget"));
paintWidget->setGeometry(QRect(40, 20, 361, 181));
MainWindow->setCentralWidget(widget);
retranslateUi(MainWindow);
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
void retranslateUi(QMainWindow *MainWindow)
{
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8));
Q_UNUSED(MainWindow);
} // retranslateUi
};
namespace Ui {
class MainWindow: public Ui_MainWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_MAINWINDOW_H