this version without bugs
This commit is contained in:
145
Makefile
145
Makefile
@@ -1,145 +0,0 @@
|
||||
#############################################################################
|
||||
# Makefile for building: aliendefender
|
||||
# Generated by qmake (2.01a) (Qt 4.6.1) on: ?? 7. ??? 19:16:37 2010
|
||||
# Project: aliendefender.pro
|
||||
# Template: app
|
||||
# Command: d:\qt\2010.01\qt\bin\qmake.exe -Wall -spec d:\Qt\2010.01\qt\mkspecs\win32-g++ -win32 -o Makefile aliendefender.pro
|
||||
#############################################################################
|
||||
|
||||
first: debug
|
||||
install: debug-install
|
||||
uninstall: debug-uninstall
|
||||
MAKEFILE = Makefile
|
||||
QMAKE = d:\qt\2010.01\qt\bin\qmake.exe
|
||||
DEL_FILE = del
|
||||
CHK_DIR_EXISTS= if not exist
|
||||
MKDIR = mkdir
|
||||
COPY = copy /y
|
||||
COPY_FILE = $(COPY)
|
||||
COPY_DIR = xcopy /s /q /y /i
|
||||
INSTALL_FILE = $(COPY_FILE)
|
||||
INSTALL_PROGRAM = $(COPY_FILE)
|
||||
INSTALL_DIR = $(COPY_DIR)
|
||||
DEL_FILE = del
|
||||
SYMLINK =
|
||||
DEL_DIR = rmdir
|
||||
MOVE = move
|
||||
CHK_DIR_EXISTS= if not exist
|
||||
MKDIR = mkdir
|
||||
SUBTARGETS = \
|
||||
debug \
|
||||
release
|
||||
|
||||
debug: $(MAKEFILE).Debug FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug
|
||||
debug-make_default: $(MAKEFILE).Debug FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug
|
||||
debug-make_first: $(MAKEFILE).Debug FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug first
|
||||
debug-all: $(MAKEFILE).Debug FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug all
|
||||
debug-clean: $(MAKEFILE).Debug FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug clean
|
||||
debug-distclean: $(MAKEFILE).Debug FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug distclean
|
||||
debug-install: $(MAKEFILE).Debug FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug install
|
||||
debug-uninstall: $(MAKEFILE).Debug FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Debug uninstall
|
||||
release: $(MAKEFILE).Release FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Release
|
||||
release-make_default: $(MAKEFILE).Release FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Release
|
||||
release-make_first: $(MAKEFILE).Release FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Release first
|
||||
release-all: $(MAKEFILE).Release FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Release all
|
||||
release-clean: $(MAKEFILE).Release FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Release clean
|
||||
release-distclean: $(MAKEFILE).Release FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Release distclean
|
||||
release-install: $(MAKEFILE).Release FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Release install
|
||||
release-uninstall: $(MAKEFILE).Release FORCE
|
||||
$(MAKE) -f $(MAKEFILE).Release uninstall
|
||||
|
||||
Makefile: aliendefender.pro d:/Qt/2010.01/qt/mkspecs/win32-g++/qmake.conf d:/Qt/2010.01/qt/mkspecs/qconfig.pri \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/qt_functions.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/qt_config.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/exclusive_builds.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/default_pre.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/win32/default_pre.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/debug.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/debug_and_release.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/default_post.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/win32/default_post.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/win32/rtti.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/win32/exceptions.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/win32/stl.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/shared.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/warn_on.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/qt.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/win32/opengl.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/win32/thread.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/moc.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/win32/windows.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/resources.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/uic.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/yacc.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/lex.prf \
|
||||
d:/Qt/2010.01/qt/mkspecs/features/include_source_dir.prf \
|
||||
d:/Qt/2010.01/qt/lib/qtmaind.prl
|
||||
$(QMAKE) -Wall -spec d:\Qt\2010.01\qt\mkspecs\win32-g++ -win32 -o Makefile aliendefender.pro
|
||||
d:\Qt\2010.01\qt\mkspecs\qconfig.pri:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\qt_functions.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\qt_config.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\exclusive_builds.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\default_pre.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\win32\default_pre.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\debug.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\debug_and_release.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\default_post.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\win32\default_post.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\win32\rtti.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\win32\exceptions.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\win32\stl.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\shared.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\warn_on.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\qt.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\win32\opengl.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\win32\thread.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\moc.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\win32\windows.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\resources.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\uic.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\yacc.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\lex.prf:
|
||||
d:\Qt\2010.01\qt\mkspecs\features\include_source_dir.prf:
|
||||
d:\Qt\2010.01\qt\lib\qtmaind.prl:
|
||||
qmake: qmake_all FORCE
|
||||
@$(QMAKE) -Wall -spec d:\Qt\2010.01\qt\mkspecs\win32-g++ -win32 -o Makefile aliendefender.pro
|
||||
|
||||
qmake_all: FORCE
|
||||
|
||||
make_default: debug-make_default release-make_default FORCE
|
||||
make_first: debug-make_first release-make_first FORCE
|
||||
all: debug-all release-all FORCE
|
||||
clean: debug-clean release-clean FORCE
|
||||
distclean: debug-distclean release-distclean FORCE
|
||||
-$(DEL_FILE) Makefile
|
||||
|
||||
debug-mocclean: $(MAKEFILE).Debug
|
||||
$(MAKE) -f $(MAKEFILE).Debug mocclean
|
||||
release-mocclean: $(MAKEFILE).Release
|
||||
$(MAKE) -f $(MAKEFILE).Release mocclean
|
||||
mocclean: debug-mocclean release-mocclean
|
||||
|
||||
debug-mocables: $(MAKEFILE).Debug
|
||||
$(MAKE) -f $(MAKEFILE).Debug mocables
|
||||
release-mocables: $(MAKEFILE).Release
|
||||
$(MAKE) -f $(MAKEFILE).Release mocables
|
||||
mocables: debug-mocables release-mocables
|
||||
FORCE:
|
||||
|
||||
$(MAKEFILE).Debug: Makefile
|
||||
$(MAKEFILE).Release: Makefile
|
||||
250
Makefile.Debug
250
Makefile.Debug
@@ -1,250 +0,0 @@
|
||||
#############################################################################
|
||||
# Makefile for building: aliendefender
|
||||
# Generated by qmake (2.01a) (Qt 4.6.1) on: ?? 7. ??? 19:16:37 2010
|
||||
# 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"d:\Qt\2010.01\qt\include\QtCore" -I"d:\Qt\2010.01\qt\include\QtNetwork" -I"d:\Qt\2010.01\qt\include\QtGui" -I"d:\Qt\2010.01\qt\include\QtOpenGL" -I"d:\Qt\2010.01\qt\include" -I"d:\Qt\2010.01\qt\include\ActiveQt" -I"debug" -I"." -I"d:\Qt\2010.01\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\2010.01\qt\lib" -lopengl32 -lglu32 -lgdi32 -luser32 -lmingw32 -lqtmaind -lQtOpenGLd4 -lQtGuid4 -lQtNetworkd4 -lQtCored4
|
||||
QMAKE = d:\qt\2010.01\qt\bin\qmake.exe
|
||||
IDC = d:\Qt\2010.01\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 \
|
||||
map.cpp \
|
||||
games.cpp \
|
||||
alien.cpp debug\moc_mainwindow.cpp \
|
||||
debug\moc_udpsender.cpp \
|
||||
debug\qrc_images.cpp
|
||||
OBJECTS = debug/main.o \
|
||||
debug/mainwindow.o \
|
||||
debug/adpainter.o \
|
||||
debug/aliens.o \
|
||||
debug/udpsender.o \
|
||||
debug/towers.o \
|
||||
debug/map.o \
|
||||
debug/games.o \
|
||||
debug/alien.o \
|
||||
debug/moc_mainwindow.o \
|
||||
debug/moc_udpsender.o \
|
||||
debug/qrc_images.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) object_script.aliendefender.Debug $(LIBS)
|
||||
|
||||
|
||||
qmake: FORCE
|
||||
@$(QMAKE) -Wall -spec d:\Qt\2010.01\qt\mkspecs\win32-g++ -win32 -o Makefile.Debug aliendefender.pro
|
||||
|
||||
dist:
|
||||
$(ZIP) aliendefender.zip $(SOURCES) $(DIST) aliendefender.pro d:\Qt\2010.01\qt\mkspecs\qconfig.pri d:\Qt\2010.01\qt\mkspecs\features\qt_functions.prf d:\Qt\2010.01\qt\mkspecs\features\qt_config.prf d:\Qt\2010.01\qt\mkspecs\features\exclusive_builds.prf d:\Qt\2010.01\qt\mkspecs\features\default_pre.prf d:\Qt\2010.01\qt\mkspecs\features\win32\default_pre.prf d:\Qt\2010.01\qt\mkspecs\features\debug.prf d:\Qt\2010.01\qt\mkspecs\features\debug_and_release.prf d:\Qt\2010.01\qt\mkspecs\features\default_post.prf d:\Qt\2010.01\qt\mkspecs\features\win32\default_post.prf d:\Qt\2010.01\qt\mkspecs\features\build_pass.prf d:\Qt\2010.01\qt\mkspecs\features\win32\rtti.prf d:\Qt\2010.01\qt\mkspecs\features\win32\exceptions.prf d:\Qt\2010.01\qt\mkspecs\features\win32\stl.prf d:\Qt\2010.01\qt\mkspecs\features\shared.prf d:\Qt\2010.01\qt\mkspecs\features\warn_on.prf d:\Qt\2010.01\qt\mkspecs\features\qt.prf d:\Qt\2010.01\qt\mkspecs\features\win32\opengl.prf d:\Qt\2010.01\qt\mkspecs\features\win32\thread.prf d:\Qt\2010.01\qt\mkspecs\features\moc.prf d:\Qt\2010.01\qt\mkspecs\features\win32\windows.prf d:\Qt\2010.01\qt\mkspecs\features\resources.prf d:\Qt\2010.01\qt\mkspecs\features\uic.prf d:\Qt\2010.01\qt\mkspecs\features\yacc.prf d:\Qt\2010.01\qt\mkspecs\features\lex.prf d:\Qt\2010.01\qt\mkspecs\features\include_source_dir.prf d:\Qt\2010.01\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\map.o debug\games.o debug\alien.o debug\moc_mainwindow.o debug\moc_udpsender.o debug\qrc_images.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: aliens.h \
|
||||
alien.h \
|
||||
games.h \
|
||||
basestruct.h \
|
||||
map.h \
|
||||
towers.h \
|
||||
udpsender.h \
|
||||
mainwindow.h
|
||||
D:/Qt/2010.01/qt/bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 mainwindow.h -o debug\moc_mainwindow.cpp
|
||||
|
||||
debug/moc_udpsender.cpp: udpsender.h
|
||||
D:/Qt/2010.01/qt/bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 udpsender.h -o debug\moc_udpsender.cpp
|
||||
|
||||
compiler_rcc_make_all: debug/qrc_images.cpp
|
||||
compiler_rcc_clean:
|
||||
-$(DEL_FILE) debug\qrc_images.cpp
|
||||
debug/qrc_images.cpp: images.qrc \
|
||||
images/Aliens/Al_00_12.png \
|
||||
images/Aliens/Al_00_6.png \
|
||||
images/Aliens/Al_00_2.png \
|
||||
images/Aliens/Al_00_17.png \
|
||||
images/Aliens/Al_00_13.png \
|
||||
images/Aliens/Al_00_7.png \
|
||||
images/Aliens/Al_00_3.png \
|
||||
images/Aliens/Al_00_18.png \
|
||||
images/Aliens/Al_00_10.png \
|
||||
images/Aliens/Al_00_14.png \
|
||||
images/Aliens/Al_00_8.png \
|
||||
images/Aliens/Al_00_4.png \
|
||||
images/Aliens/Al_00_0.png \
|
||||
images/Aliens/Al_00_19.png \
|
||||
images/Aliens/Al_00_11.png \
|
||||
images/Aliens/Al_00_15.png \
|
||||
images/Aliens/Al_00_9.png \
|
||||
images/Aliens/Al_00_5.png \
|
||||
images/Aliens/Al_00_1.png \
|
||||
images/Aliens/Al_00_16.png
|
||||
d:\Qt\2010.01\qt\bin\rcc.exe -name images images.qrc -o debug\qrc_images.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\2010.01\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 \
|
||||
aliens.h \
|
||||
alien.h \
|
||||
games.h \
|
||||
basestruct.h \
|
||||
map.h \
|
||||
towers.h \
|
||||
udpsender.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\main.o main.cpp
|
||||
|
||||
debug/mainwindow.o: mainwindow.cpp mainwindow.h \
|
||||
aliens.h \
|
||||
alien.h \
|
||||
games.h \
|
||||
basestruct.h \
|
||||
map.h \
|
||||
towers.h \
|
||||
udpsender.h \
|
||||
ui_mainwindow.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\mainwindow.o mainwindow.cpp
|
||||
|
||||
debug/adpainter.o: adpainter.cpp adpainter.h \
|
||||
alien.h \
|
||||
games.h \
|
||||
basestruct.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\adpainter.o adpainter.cpp
|
||||
|
||||
debug/aliens.o: aliens.cpp aliens.h \
|
||||
alien.h \
|
||||
games.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 \
|
||||
games.h \
|
||||
basestruct.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\towers.o towers.cpp
|
||||
|
||||
debug/map.o: map.cpp map.h \
|
||||
games.h \
|
||||
basestruct.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\map.o map.cpp
|
||||
|
||||
debug/games.o: games.cpp games.h \
|
||||
basestruct.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\games.o games.cpp
|
||||
|
||||
debug/alien.o: alien.cpp alien.h \
|
||||
games.h \
|
||||
basestruct.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\alien.o alien.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_images.o: debug/qrc_images.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o debug\qrc_images.o debug\qrc_images.cpp
|
||||
|
||||
####### Install
|
||||
|
||||
install: FORCE
|
||||
|
||||
uninstall: FORCE
|
||||
|
||||
FORCE:
|
||||
|
||||
250
Makefile.Release
250
Makefile.Release
@@ -1,250 +0,0 @@
|
||||
#############################################################################
|
||||
# Makefile for building: aliendefender
|
||||
# Generated by qmake (2.01a) (Qt 4.6.1) on: ?? 7. ??? 19:16:37 2010
|
||||
# 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"d:\Qt\2010.01\qt\include\QtCore" -I"d:\Qt\2010.01\qt\include\QtNetwork" -I"d:\Qt\2010.01\qt\include\QtGui" -I"d:\Qt\2010.01\qt\include\QtOpenGL" -I"d:\Qt\2010.01\qt\include" -I"d:\Qt\2010.01\qt\include\ActiveQt" -I"release" -I"." -I"d:\Qt\2010.01\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\2010.01\qt\lib" -lopengl32 -lglu32 -lgdi32 -luser32 -lmingw32 -lqtmain -lQtOpenGL4 -lQtGui4 -lQtNetwork4 -lQtCore4
|
||||
QMAKE = d:\qt\2010.01\qt\bin\qmake.exe
|
||||
IDC = d:\Qt\2010.01\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 \
|
||||
map.cpp \
|
||||
games.cpp \
|
||||
alien.cpp release\moc_mainwindow.cpp \
|
||||
release\moc_udpsender.cpp \
|
||||
release\qrc_images.cpp
|
||||
OBJECTS = release/main.o \
|
||||
release/mainwindow.o \
|
||||
release/adpainter.o \
|
||||
release/aliens.o \
|
||||
release/udpsender.o \
|
||||
release/towers.o \
|
||||
release/map.o \
|
||||
release/games.o \
|
||||
release/alien.o \
|
||||
release/moc_mainwindow.o \
|
||||
release/moc_udpsender.o \
|
||||
release/qrc_images.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) object_script.aliendefender.Release $(LIBS)
|
||||
|
||||
|
||||
qmake: FORCE
|
||||
@$(QMAKE) -Wall -spec d:\Qt\2010.01\qt\mkspecs\win32-g++ -win32 -o Makefile.Release aliendefender.pro
|
||||
|
||||
dist:
|
||||
$(ZIP) aliendefender.zip $(SOURCES) $(DIST) aliendefender.pro d:\Qt\2010.01\qt\mkspecs\qconfig.pri d:\Qt\2010.01\qt\mkspecs\features\qt_functions.prf d:\Qt\2010.01\qt\mkspecs\features\qt_config.prf d:\Qt\2010.01\qt\mkspecs\features\exclusive_builds.prf d:\Qt\2010.01\qt\mkspecs\features\default_pre.prf d:\Qt\2010.01\qt\mkspecs\features\win32\default_pre.prf d:\Qt\2010.01\qt\mkspecs\features\release.prf d:\Qt\2010.01\qt\mkspecs\features\debug_and_release.prf d:\Qt\2010.01\qt\mkspecs\features\default_post.prf d:\Qt\2010.01\qt\mkspecs\features\win32\default_post.prf d:\Qt\2010.01\qt\mkspecs\features\build_pass.prf d:\Qt\2010.01\qt\mkspecs\features\win32\rtti.prf d:\Qt\2010.01\qt\mkspecs\features\win32\exceptions.prf d:\Qt\2010.01\qt\mkspecs\features\win32\stl.prf d:\Qt\2010.01\qt\mkspecs\features\shared.prf d:\Qt\2010.01\qt\mkspecs\features\warn_on.prf d:\Qt\2010.01\qt\mkspecs\features\qt.prf d:\Qt\2010.01\qt\mkspecs\features\win32\opengl.prf d:\Qt\2010.01\qt\mkspecs\features\win32\thread.prf d:\Qt\2010.01\qt\mkspecs\features\moc.prf d:\Qt\2010.01\qt\mkspecs\features\win32\windows.prf d:\Qt\2010.01\qt\mkspecs\features\resources.prf d:\Qt\2010.01\qt\mkspecs\features\uic.prf d:\Qt\2010.01\qt\mkspecs\features\yacc.prf d:\Qt\2010.01\qt\mkspecs\features\lex.prf d:\Qt\2010.01\qt\mkspecs\features\include_source_dir.prf d:\Qt\2010.01\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\map.o release\games.o release\alien.o release\moc_mainwindow.o release\moc_udpsender.o release\qrc_images.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: aliens.h \
|
||||
alien.h \
|
||||
games.h \
|
||||
basestruct.h \
|
||||
map.h \
|
||||
towers.h \
|
||||
udpsender.h \
|
||||
mainwindow.h
|
||||
D:/Qt/2010.01/qt/bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 mainwindow.h -o release\moc_mainwindow.cpp
|
||||
|
||||
release/moc_udpsender.cpp: udpsender.h
|
||||
D:/Qt/2010.01/qt/bin\moc.exe $(DEFINES) $(INCPATH) -D__GNUC__ -DWIN32 udpsender.h -o release\moc_udpsender.cpp
|
||||
|
||||
compiler_rcc_make_all: release/qrc_images.cpp
|
||||
compiler_rcc_clean:
|
||||
-$(DEL_FILE) release\qrc_images.cpp
|
||||
release/qrc_images.cpp: images.qrc \
|
||||
images/Aliens/Al_00_12.png \
|
||||
images/Aliens/Al_00_6.png \
|
||||
images/Aliens/Al_00_2.png \
|
||||
images/Aliens/Al_00_17.png \
|
||||
images/Aliens/Al_00_13.png \
|
||||
images/Aliens/Al_00_7.png \
|
||||
images/Aliens/Al_00_3.png \
|
||||
images/Aliens/Al_00_18.png \
|
||||
images/Aliens/Al_00_10.png \
|
||||
images/Aliens/Al_00_14.png \
|
||||
images/Aliens/Al_00_8.png \
|
||||
images/Aliens/Al_00_4.png \
|
||||
images/Aliens/Al_00_0.png \
|
||||
images/Aliens/Al_00_19.png \
|
||||
images/Aliens/Al_00_11.png \
|
||||
images/Aliens/Al_00_15.png \
|
||||
images/Aliens/Al_00_9.png \
|
||||
images/Aliens/Al_00_5.png \
|
||||
images/Aliens/Al_00_1.png \
|
||||
images/Aliens/Al_00_16.png
|
||||
d:\Qt\2010.01\qt\bin\rcc.exe -name images images.qrc -o release\qrc_images.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\2010.01\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 \
|
||||
aliens.h \
|
||||
alien.h \
|
||||
games.h \
|
||||
basestruct.h \
|
||||
map.h \
|
||||
towers.h \
|
||||
udpsender.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\main.o main.cpp
|
||||
|
||||
release/mainwindow.o: mainwindow.cpp mainwindow.h \
|
||||
aliens.h \
|
||||
alien.h \
|
||||
games.h \
|
||||
basestruct.h \
|
||||
map.h \
|
||||
towers.h \
|
||||
udpsender.h \
|
||||
ui_mainwindow.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\mainwindow.o mainwindow.cpp
|
||||
|
||||
release/adpainter.o: adpainter.cpp adpainter.h \
|
||||
alien.h \
|
||||
games.h \
|
||||
basestruct.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\adpainter.o adpainter.cpp
|
||||
|
||||
release/aliens.o: aliens.cpp aliens.h \
|
||||
alien.h \
|
||||
games.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 \
|
||||
games.h \
|
||||
basestruct.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\towers.o towers.cpp
|
||||
|
||||
release/map.o: map.cpp map.h \
|
||||
games.h \
|
||||
basestruct.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\map.o map.cpp
|
||||
|
||||
release/games.o: games.cpp games.h \
|
||||
basestruct.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\games.o games.cpp
|
||||
|
||||
release/alien.o: alien.cpp alien.h \
|
||||
games.h \
|
||||
basestruct.h
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\alien.o alien.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_images.o: release/qrc_images.cpp
|
||||
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release\qrc_images.o release\qrc_images.cpp
|
||||
|
||||
####### Install
|
||||
|
||||
install: FORCE
|
||||
|
||||
uninstall: FORCE
|
||||
|
||||
FORCE:
|
||||
|
||||
169
adpainter.cpp
169
adpainter.cpp
@@ -1,169 +0,0 @@
|
||||
#include "adpainter.h"
|
||||
|
||||
|
||||
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();
|
||||
loadPixmaps();
|
||||
//AnimAlien = 0;
|
||||
//StepAlien = 0;
|
||||
}
|
||||
|
||||
|
||||
void adpainter::loadPixmaps()
|
||||
{
|
||||
QString str;
|
||||
QPixmap tmpAlPixmap;
|
||||
int i=1;
|
||||
str.setNum(i);
|
||||
while (i != 0) {
|
||||
str.setNum(i);
|
||||
tmpAlPixmap.load(":/aliens/images/Aliens/Al_00_" + str + ".png");
|
||||
if (!tmpAlPixmap.isNull()) {
|
||||
AlienPix.push_back(tmpAlPixmap);
|
||||
tmpAlPixmap = 0;
|
||||
i++;
|
||||
}
|
||||
else i = 0;
|
||||
}
|
||||
qDebug() << "pictures:" << AlienPix.size();
|
||||
}
|
||||
|
||||
|
||||
void adpainter::clear()
|
||||
{
|
||||
QPainter painter(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;
|
||||
QPainter painter(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::drawAlien(Alien * al)
|
||||
{
|
||||
//float tmpdx,tmpdy,arctg,tmpdx1,tmpdy1;
|
||||
//unsigned char dd[4];
|
||||
//int gg;
|
||||
//arctg = 0;
|
||||
//qDebug() << path.size();
|
||||
//QTransform rotated;
|
||||
al->update();
|
||||
if (al->indexPix() >= AlienPix.size()) al->resetIndexPic();
|
||||
QPainter painter(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++){
|
||||
painter.drawEllipse(al->path.at(i).x() * cellsize +4, al->path.at(i).y() * cellsize +4, cellsize - 8, cellsize - 8);
|
||||
}
|
||||
/*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(al->Pos().x()+cellsize/2, al->Pos().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(al->Angl());
|
||||
//position->pnt.setX(path.at(0).x());
|
||||
//position->pnt.setY(path.at(0).y());
|
||||
painter.drawPixmap(-cellsize, -cellsize, cellsize*2, cellsize*2, AlienPix[al->indexPix()]);
|
||||
//AnimAlien++;
|
||||
//painter.restore();
|
||||
//if (AnimAlien >= AlienPix.size()) AnimAlien = 0;
|
||||
//if (StepAlien >= path.size()) StepAlien = 0;
|
||||
//qDebug() << StepAlien;
|
||||
//}
|
||||
painter.end();
|
||||
}
|
||||
|
||||
|
||||
void adpainter::drawcell(QPoint pnt)
|
||||
{
|
||||
QPainter painter(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)
|
||||
{
|
||||
QPainter painter(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;
|
||||
}
|
||||
34
adpainter.h
34
adpainter.h
@@ -1,34 +0,0 @@
|
||||
#ifndef ADPAINTER_H
|
||||
#define ADPAINTER_H
|
||||
|
||||
#include "alien.h"
|
||||
|
||||
#include <cmath>
|
||||
|
||||
|
||||
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 drawAlien(Alien * al);
|
||||
int AnimAlien, StepAlien;
|
||||
private:
|
||||
//GameData * data;
|
||||
QPixmap * buff;
|
||||
QPixmap * background;
|
||||
QPen * pen;
|
||||
QBrush * brush;
|
||||
QVector<QPixmap> AlienPix;
|
||||
int cellsize;
|
||||
void loadPixmaps();
|
||||
};
|
||||
|
||||
|
||||
#endif // ADPAINTER_H
|
||||
@@ -33,10 +33,11 @@ bool Alien::RecreatePath()
|
||||
PathIndex = 1;
|
||||
start.setX(qRound(position.x()/(float)game->cellsize));
|
||||
start.setY(qRound(position.y()/(float)game->cellsize));
|
||||
if (game->Cells[start.x()][start.y()] < 0) return false;
|
||||
srcPath = InvWaveTrace(game->finish,WaveTrace(start,game->finish));
|
||||
for (int i=0; i<srcPath.size();i++)
|
||||
{
|
||||
game->Cells[srcPath.at(i).x()][srcPath.at(i).y()] = 1;
|
||||
game->Cells[srcPath.at(i).x()][srcPath.at(i).y()] = 5;
|
||||
tmpPath.push_back(QPointF(srcPath.at(i)));
|
||||
}
|
||||
srcPath.clear();
|
||||
|
||||
@@ -7,7 +7,6 @@ TARGET = aliendefender
|
||||
TEMPLATE = app
|
||||
SOURCES += main.cpp \
|
||||
mainwindow.cpp \
|
||||
adpainter.cpp \
|
||||
aliens.cpp \
|
||||
udpsender.cpp \
|
||||
towers.cpp \
|
||||
@@ -15,13 +14,13 @@ SOURCES += main.cpp \
|
||||
games.cpp \
|
||||
alien.cpp
|
||||
HEADERS += mainwindow.h \
|
||||
adpainter.h \
|
||||
aliens.h \
|
||||
basestruct.h \
|
||||
udpsender.h \
|
||||
towers.h \
|
||||
map.h \
|
||||
games.h \
|
||||
alien.h
|
||||
alien.h \
|
||||
uwidget.h
|
||||
FORMS += mainwindow.ui
|
||||
RESOURCES += images.qrc
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>RunConfiguration0-BaseEnvironmentBase</variable>
|
||||
<value type="int">2</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-CommandLineArguments</variable>
|
||||
<valuelist type="QVariantList" />
|
||||
@@ -32,22 +28,10 @@
|
||||
<variable>RunConfiguration0-UserSetName</variable>
|
||||
<value type="bool" >true</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-UserSetWorkingDirectory</variable>
|
||||
<value type="bool">false</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-UserWorkingDirectory</variable>
|
||||
<value type="QString"></value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration0-type</variable>
|
||||
<value type="QString" >Qt4ProjectManager.Qt4RunConfiguration</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration1-BaseEnvironmentBase</variable>
|
||||
<value type="int">2</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration1-CommandLineArguments</variable>
|
||||
<valuelist type="QVariantList" />
|
||||
@@ -76,14 +60,6 @@
|
||||
<variable>RunConfiguration1-UserSetName</variable>
|
||||
<value type="bool" >false</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration1-UserSetWorkingDirectory</variable>
|
||||
<value type="bool">false</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration1-UserWorkingDirectory</variable>
|
||||
<value type="QString"></value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>RunConfiguration1-type</variable>
|
||||
<value type="QString" >Qt4ProjectManager.Qt4RunConfiguration</value>
|
||||
@@ -122,50 +98,48 @@
|
||||
<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">INCLUDE=C:\Program Files\Microsoft Visual Studio\VC98\atl\include;C:\Program Files\Microsoft Visual Studio\VC98\mfc\include;C:\Program Files\Microsoft Visual Studio\VC98\include</value>
|
||||
<value type="QString">LIB=C:\Program Files\Microsoft Visual Studio\VC98\mfc\lib;C:\Program Files\Microsoft Visual Studio\VC98\lib</value>
|
||||
<value type="QString">LOGONSERVER=\\COMP</value>
|
||||
<value type="QString">MSDEVDIR=C:\Program Files\Microsoft Visual Studio\Common\MSDev98</value>
|
||||
<value type="QString">NUMBER_OF_PROCESSORS=2</value>
|
||||
<value type="QString">OS=Windows_NT</value>
|
||||
<value type="QString">PATH=D:\Qt\2010.01\mingw\bin;D:\Qt\2010.01\qt\bin;C:\Program Files\PC Connectivity Solution\;C:\Program Files\JavaFX\javafx-sdk1.2\bin;C:\Program Files\JavaFX\javafx-sdk1.2\emulator\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\IVI Foundation\VISA\WinNT\Bin;C:\Program Files\Borland\Delphi7\Bin;C:\Program Files\Borland\Delphi7\Projects\Bpl;C:\Program Files\Git\cmd;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\Program Files\OpenVPN\bin</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/2010.01/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">VXIPNPPATH=C:\Program Files\IVI Foundation\VISA\</value>
|
||||
<value type="QString">WINDIR=C:\WINDOWS</value>
|
||||
<value type="QString" >DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-rwgGTf2llu,guid=47f9f0046990c9c4983a622a4b6c11df</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-cqyv3T/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" >LANGUAGE=</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/1283,unix/buull-eeePC:/tmp/.ICE-unix/1283</value>
|
||||
<value type="QString" >SHELL=/bin/bash</value>
|
||||
<value type="QString" >SPEECHD_PORT=7560</value>
|
||||
<value type="QString" >SSH_AGENT_PID=1356</value>
|
||||
<value type="QString" >SSH_AUTH_SOCK=/tmp/keyring-cqyv3T/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-FKbzYa/database</value>
|
||||
<value type="QString" >XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
|
||||
<value type="QString" >XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1265373654.150132-179730100</value>
|
||||
</valuelist>
|
||||
<valuelist key="abstractProcess.arguments" type="QVariantList" >
|
||||
<value type="QString">C:/aliendefender/aliendefender.pro</value>
|
||||
<value type="QString" >/home/andrey/projects/aliendefender/aliendefender.pro</value>
|
||||
<value type="QString" >-spec</value>
|
||||
<value type="QString">win32-g++</value>
|
||||
<value type="QString" >/usr/share/qt4/mkspecs/linux-g++</value>
|
||||
<value type="QString" >-r</value>
|
||||
<value type="QString" >CONFIG+=debug_and_release</value>
|
||||
<value type="QString" >-Wall</value>
|
||||
</valuelist>
|
||||
<value key="abstractProcess.command" type="QString">d:/qt/2010.01/qt/bin/qmake.exe</value>
|
||||
<value key="abstractProcess.enabled" type="bool">true</value>
|
||||
<value key="abstractProcess.workingDirectory" type="QString">C:/aliendefender</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/projects/aliendefender</value>
|
||||
<value key="buildConfiguration" type="" ></value>
|
||||
<valuelist key="qmakeArgs" type="QVariantList" >
|
||||
<value type="QString" >-Wall</value>
|
||||
@@ -177,48 +151,45 @@
|
||||
<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">INCLUDE=C:\Program Files\Microsoft Visual Studio\VC98\atl\include;C:\Program Files\Microsoft Visual Studio\VC98\mfc\include;C:\Program Files\Microsoft Visual Studio\VC98\include</value>
|
||||
<value type="QString">LIB=C:\Program Files\Microsoft Visual Studio\VC98\mfc\lib;C:\Program Files\Microsoft Visual Studio\VC98\lib</value>
|
||||
<value type="QString">LOGONSERVER=\\COMP</value>
|
||||
<value type="QString">MSDEVDIR=C:\Program Files\Microsoft Visual Studio\Common\MSDev98</value>
|
||||
<value type="QString">NUMBER_OF_PROCESSORS=2</value>
|
||||
<value type="QString">OS=Windows_NT</value>
|
||||
<value type="QString">PATH=D:\Qt\2010.01\mingw\bin;D:\Qt\2010.01\qt\bin;C:\Program Files\PC Connectivity Solution\;C:\Program Files\JavaFX\javafx-sdk1.2\bin;C:\Program Files\JavaFX\javafx-sdk1.2\emulator\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\IVI Foundation\VISA\WinNT\Bin;C:\Program Files\Borland\Delphi7\Bin;C:\Program Files\Borland\Delphi7\Projects\Bpl;C:\Program Files\Git\cmd;C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;C:\Program Files\Microsoft Visual Studio\Common\Tools;C:\Program Files\Microsoft Visual Studio\VC98\bin;C:\Program Files\OpenVPN\bin</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/2010.01/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">VXIPNPPATH=C:\Program Files\IVI Foundation\VISA\</value>
|
||||
<value type="QString">WINDIR=C:\WINDOWS</value>
|
||||
<value type="QString" >DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-rwgGTf2llu,guid=47f9f0046990c9c4983a622a4b6c11df</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-cqyv3T/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" >LANGUAGE=</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/1283,unix/buull-eeePC:/tmp/.ICE-unix/1283</value>
|
||||
<value type="QString" >SHELL=/bin/bash</value>
|
||||
<value type="QString" >SPEECHD_PORT=7560</value>
|
||||
<value type="QString" >SSH_AGENT_PID=1356</value>
|
||||
<value type="QString" >SSH_AUTH_SOCK=/tmp/keyring-cqyv3T/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-FKbzYa/database</value>
|
||||
<value type="QString" >XDG_DATA_DIRS=/usr/share/gnome:/usr/local/share/:/usr/share/</value>
|
||||
<value type="QString" >XDG_SESSION_COOKIE=f0649decca52f2beb55c9ea74ad1d028-1265373654.150132-179730100</value>
|
||||
</valuelist>
|
||||
<value key="abstractProcess.IgnoreReturnValue" type="bool" >false</value>
|
||||
<valuelist key="abstractProcess.arguments" type="QVariantList" >
|
||||
<value type="QString" >-j3</value>
|
||||
<value type="QString" >-w</value>
|
||||
</valuelist>
|
||||
<value key="abstractProcess.command" type="QString">D:/Qt/2010.01/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">C:/aliendefender</value>
|
||||
<value key="abstractProcess.workingDirectory" type="QString" >/home/andrey/projects/aliendefender</value>
|
||||
<valuelist key="makeargs" type="QVariantList" >
|
||||
<value type="QString" >-j3</value>
|
||||
</valuelist>
|
||||
|
||||
29
aliens.cpp
29
aliens.cpp
@@ -26,6 +26,13 @@ void Aliens::clearAliens()
|
||||
|
||||
bool Aliens::retrace()
|
||||
{
|
||||
for (int i = 0; i < game->size.width(); i++)
|
||||
{
|
||||
for (int j = 0; j < game->size.height(); j++)
|
||||
{
|
||||
if (game->Cells[i][j] == 5) game->Cells[i][j]=0;
|
||||
}
|
||||
}
|
||||
if (!testAlien->RecreatePath()) return false;
|
||||
for (int i=0; i < curAliens.size(); i ++)
|
||||
if (!curAliens.at(i)->RecreatePath()) return false;
|
||||
@@ -55,10 +62,16 @@ int Aliens::loadPixmaps()
|
||||
|
||||
void Aliens::drawAliens()
|
||||
{
|
||||
for (int i=0; i < curAliens.size(); i ++)
|
||||
int n=0;
|
||||
while (n < curAliens.size())
|
||||
{
|
||||
if (!curAliens.at(i)->update()) DelAlien(i);
|
||||
else if (curAliens.at(i)->indexPix() >= AlienPix.size()) curAliens.at(i)->resetIndexPic();
|
||||
if (!curAliens.at(n)->update()) DelAlien(n);
|
||||
else
|
||||
{
|
||||
if (curAliens.at(n)->indexPix() >= AlienPix.size())
|
||||
curAliens.at(n)->resetIndexPic();
|
||||
n++;
|
||||
}
|
||||
}
|
||||
QPainter painter(game->buff);
|
||||
QPen pen(QColor(80,200,100));
|
||||
@@ -68,15 +81,17 @@ void Aliens::drawAliens()
|
||||
painter.drawPixmap(0,0,*game->background);
|
||||
for (int i=0; i < curAliens.size(); i ++)
|
||||
{
|
||||
for (int j = 0; j < curAliens.at(i)->path.size(); j++)
|
||||
/*for (int j = 0; j < curAliens.at(i)->path.size(); j++)
|
||||
painter.drawEllipse(curAliens.at(i)->path.at(j).x()*game->cellsize +4,
|
||||
curAliens.at(i)->path.at(j).y()*game->cellsize +4,
|
||||
game->cellsize - 8,
|
||||
game->cellsize - 8);
|
||||
game->cellsize - 8);*/
|
||||
painter.save();
|
||||
painter.translate(curAliens.at(i)->Pos().x()+game->cellsize/2, curAliens.at(i)->Pos().y()+game->cellsize/2);
|
||||
painter.translate(curAliens.at(i)->Pos().x()+game->cellsize/2,
|
||||
curAliens.at(i)->Pos().y()+game->cellsize/2);
|
||||
painter.rotate(curAliens.at(i)->Angl());
|
||||
painter.drawPixmap(-game->cellsize, -game->cellsize, game->cellsize*2, game->cellsize*2,
|
||||
painter.drawPixmap(-game->cellsize, -game->cellsize,
|
||||
game->cellsize*2, game->cellsize*2,
|
||||
AlienPix[curAliens.at(i)->indexPix()]);
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
@@ -13,4 +13,7 @@ games::games(QSize formsize, QPoint startpnt, QPoint finishpnt, int sizeofcell)
|
||||
Cells[i] = new int[size.height()];
|
||||
for (int j = 0; j < size.height(); j++) Cells[i][j] = 0;
|
||||
}
|
||||
Cells[start.x()][start.y()] = 10;
|
||||
Cells[finish.x()][finish.y()] = 10;
|
||||
qDebug() << start << finish;
|
||||
}
|
||||
|
||||
1
main.cpp
1
main.cpp
@@ -6,5 +6,6 @@ int main(int argc, char *argv[])
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
w.resize(666,444);
|
||||
return a.exec();
|
||||
}
|
||||
|
||||
@@ -7,53 +7,83 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
{
|
||||
qDebug() << "Load START!";
|
||||
ui->setupUi(this);
|
||||
wd = new USWidget(ui->frGame);
|
||||
//ui->frGame->addWidget(wd);
|
||||
wd->resize(ui->frGame->size());
|
||||
connect(wd,SIGNAL(paintEvent(QPaintEvent*)),this,SLOT(paint(QPaintEvent*)));
|
||||
connect(wd,SIGNAL(mouseMoveEvent(QMouseEvent*)),
|
||||
this,SLOT(mouse_move(QMouseEvent*)));
|
||||
connect(wd,SIGNAL(mousePressEvent(QMouseEvent*)),
|
||||
this,SLOT(mouse_press(QMouseEvent*)));
|
||||
//sndr = new UdpSender("127.0.0.1",10101);
|
||||
//sndr->connectSend("hellow");
|
||||
int cellsize = 16;
|
||||
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 games(this->size(),QPoint(0,this->height()/2),QPoint(this->width()-cellsize,this->height()/2), cellsize);
|
||||
qDebug() << wd->size();
|
||||
GameMain = new games(wd->size(),QPoint(0,wd->height()/2),
|
||||
QPoint(wd->width()-cellsize,wd->height()/2),
|
||||
cellsize);
|
||||
maliens = new Aliens(GameMain);
|
||||
maliens->AddAlien();
|
||||
mmap = new map(GameMain);
|
||||
mmap->clear();
|
||||
mmap->drawgrid();
|
||||
mtowers = new towers(GameMain);
|
||||
this->setGeometry(100,100,this->width(),this->height());
|
||||
//this->setGeometry(100,100,this->width(),this->height());
|
||||
timer->start(50);
|
||||
mousebt = 0;
|
||||
qDebug() << "Load DONE!";
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::ADrender()
|
||||
void MainWindow::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
//adp->drawAlien(aliens->alienAt(0));
|
||||
maliens->drawAliens();
|
||||
this->repaint();
|
||||
int cellsize = 16;
|
||||
wd->resize(ui->frGame->size());
|
||||
delete mtowers;
|
||||
delete mmap;
|
||||
delete maliens;
|
||||
delete GameMain;
|
||||
GameMain = new games(wd->size(),QPoint(0,wd->height()/2),
|
||||
QPoint(wd->width()-cellsize,wd->height()/2),
|
||||
cellsize);
|
||||
maliens = new Aliens(GameMain);
|
||||
maliens->AddAlien();
|
||||
mmap = new map(GameMain);
|
||||
mmap->clear();
|
||||
mmap->drawgrid();
|
||||
mtowers = new towers(GameMain);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::paintEvent(QPaintEvent*)
|
||||
void MainWindow::ADrender()
|
||||
{
|
||||
QString str;
|
||||
maliens->drawAliens();
|
||||
str.setNum(maliens->size());
|
||||
ui->lbCount->setText(QString::fromUtf8("Количество: ")+str+QString::fromUtf8(" шт"));
|
||||
wd->repaint();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::paint(QPaintEvent* )
|
||||
{
|
||||
QPainter painter;
|
||||
painter.begin(this);
|
||||
painter.begin(wd);
|
||||
painter.drawPixmap(0,0,*GameMain->buff);
|
||||
painter.end();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::mouseMoveEvent (QMouseEvent *event)
|
||||
void MainWindow::mouse_move(QMouseEvent *event)
|
||||
{
|
||||
if (mousebt == 1) ClearCell(event->pos());
|
||||
if (mousebt == 2) SetCell(event->pos());
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::mousePressEvent (QMouseEvent *event)
|
||||
void MainWindow::mouse_press(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::RightButton) {
|
||||
ClearCell(event->pos());
|
||||
@@ -73,13 +103,15 @@ void MainWindow::SetCell(QPoint pos)
|
||||
{
|
||||
bool trace = false;
|
||||
QPoint cp;
|
||||
QRect wdrect(0, 0, (this->width()/GameMain->cellsize)*GameMain->cellsize,
|
||||
(this->height()/GameMain->cellsize)*GameMain->cellsize);
|
||||
QRect wdrect(0, 0, (wd->width()/GameMain->cellsize)*GameMain->cellsize,
|
||||
(wd->height()/GameMain->cellsize)*GameMain->cellsize);
|
||||
if (wdrect.contains(pos)) {
|
||||
cp.setX(pos.x()/GameMain->cellsize);
|
||||
cp.setY(pos.y()/GameMain->cellsize);
|
||||
//qDebug() << cp << GameMain->Cells[cp.x()][cp.y()];
|
||||
if (GameMain->Cells[cp.x()][cp.y()] == 10) return;
|
||||
mtowers->drawcell(cp);
|
||||
if (GameMain->Cells[cp.x()][cp.y()] == 1) trace = true;
|
||||
if (GameMain->Cells[cp.x()][cp.y()] == 5) trace = true;
|
||||
GameMain->Cells[cp.x()][cp.y()] = - 1;
|
||||
if (trace)
|
||||
if (!maliens->retrace()) ClearCell(pos);
|
||||
@@ -90,11 +122,12 @@ void MainWindow::SetCell(QPoint pos)
|
||||
void MainWindow::ClearCell(QPoint pos)
|
||||
{
|
||||
QPoint cp;
|
||||
QRect wdrect(0, 0, (this->width()/GameMain->cellsize)*GameMain->cellsize,
|
||||
(this->height()/GameMain->cellsize)*GameMain->cellsize);
|
||||
QRect wdrect(0, 0, (wd->width()/GameMain->cellsize)*GameMain->cellsize,
|
||||
(wd->height()/GameMain->cellsize)*GameMain->cellsize);
|
||||
if (wdrect.contains(pos)) {
|
||||
cp.setX(pos.x()/GameMain->cellsize);
|
||||
cp.setY(pos.y()/GameMain->cellsize);
|
||||
if (GameMain->Cells[cp.x()][cp.y()] == 10) return;
|
||||
GameMain->Cells[cp.x()][cp.y()] = 0;
|
||||
mtowers->clearcell(cp);
|
||||
maliens->retrace();
|
||||
@@ -104,7 +137,7 @@ void MainWindow::ClearCell(QPoint pos)
|
||||
|
||||
void MainWindow::keyPressEvent(QKeyEvent * e)
|
||||
{
|
||||
qDebug() << e->key();
|
||||
//qDebug() << e->key();
|
||||
switch(e->key()) {
|
||||
case 65:
|
||||
maliens->AddAlien();
|
||||
@@ -123,5 +156,19 @@ MainWindow::~MainWindow()
|
||||
delete mmap;
|
||||
delete maliens;
|
||||
delete GameMain;
|
||||
//delete adp;
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_clicked()
|
||||
{
|
||||
this->close();
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_3_clicked()
|
||||
{
|
||||
if (maliens->size() > 0) maliens->DelAlien(maliens->size()-1);
|
||||
}
|
||||
|
||||
void MainWindow::on_pushButton_2_clicked()
|
||||
{
|
||||
maliens->AddAlien();
|
||||
}
|
||||
|
||||
16
mainwindow.h
16
mainwindow.h
@@ -5,11 +5,11 @@
|
||||
#include <QTimer>
|
||||
#include <QMouseEvent>
|
||||
#include <QKeyEvent>
|
||||
//#include "adpainter.h"
|
||||
#include "aliens.h"
|
||||
#include "map.h"
|
||||
#include "towers.h"
|
||||
#include "udpsender.h"
|
||||
#include "uwidget.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@@ -26,22 +26,28 @@ public:
|
||||
~MainWindow();
|
||||
public slots:
|
||||
void ADrender();
|
||||
void paint(QPaintEvent*);
|
||||
void mouse_move(QMouseEvent *e);
|
||||
void mouse_press(QMouseEvent *e);
|
||||
private:
|
||||
void paintEvent(QPaintEvent*);
|
||||
void SetCell(QPoint pos);
|
||||
void ClearCell(QPoint pos);
|
||||
void mouseMoveEvent(QMouseEvent *e);
|
||||
void mousePressEvent(QMouseEvent *e);
|
||||
void resizeEvent(QResizeEvent *);
|
||||
void keyPressEvent(QKeyEvent *e);
|
||||
Ui::MainWindow *ui;
|
||||
Aliens * maliens;
|
||||
map * mmap;
|
||||
towers * mtowers;
|
||||
USWidget * wd;
|
||||
//UdpSender * sndr;
|
||||
//adpainter * adp;
|
||||
games * GameMain;
|
||||
QTimer *timer;
|
||||
int mousebt;
|
||||
|
||||
private slots:
|
||||
void on_pushButton_2_clicked();
|
||||
void on_pushButton_3_clicked();
|
||||
void on_pushButton_clicked();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,58 @@
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="widget"/>
|
||||
<widget class="QWidget" name="widget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="frGame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_2">
|
||||
<property name="text">
|
||||
<string>Добавить</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_3">
|
||||
<property name="text">
|
||||
<string>Удалить</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbCount">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton">
|
||||
<property name="text">
|
||||
<string>Выход</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
|
||||
BIN
release/adpainter.o
Normal file
BIN
release/adpainter.o
Normal file
Binary file not shown.
57
uwidget.h
Executable file
57
uwidget.h
Executable file
@@ -0,0 +1,57 @@
|
||||
#include <QGLWidget>
|
||||
#include <QWidget>
|
||||
|
||||
class UGLWidget: public QGLWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
UGLWidget(QWidget * parent = 0): QGLWidget(parent) {setGeometry(0, 0, 0, 0);}
|
||||
signals:
|
||||
void closeEvent(QCloseEvent * e);
|
||||
void dragEnterEvent(QDragEnterEvent * e);
|
||||
void dragLeaveEvent(QDragLeaveEvent * e);
|
||||
void dragMoveEvent(QDragMoveEvent * e);
|
||||
void dropEvent(QDropEvent * e);
|
||||
void enterEvent(QEvent * e);
|
||||
void hideEvent(QHideEvent * e);
|
||||
void keyPressEvent(QKeyEvent * e);
|
||||
void keyReleaseEvent(QKeyEvent * e);
|
||||
void leaveEvent(QEvent * e);
|
||||
void mouseDoubleClickEvent(QMouseEvent * e);
|
||||
void mouseMoveEvent(QMouseEvent * e);
|
||||
void mousePressEvent(QMouseEvent * e);
|
||||
void mouseReleaseEvent(QMouseEvent * e);
|
||||
void moveEvent(QMoveEvent * e);
|
||||
void glDraw();
|
||||
void paintGL();
|
||||
void resizeEvent(QResizeEvent * e);
|
||||
void showEvent(QShowEvent * e);
|
||||
void wheelEvent(QWheelEvent * e);
|
||||
void paintEvent(QPaintEvent * e);
|
||||
};
|
||||
|
||||
|
||||
class USWidget: public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
USWidget(QWidget * parent = 0): QWidget(parent) {setGeometry(0, 0, 0, 0);}
|
||||
signals:
|
||||
void closeEvent(QCloseEvent * e);
|
||||
void dragEnterEvent(QDragEnterEvent * e);
|
||||
void dragLeaveEvent(QDragLeaveEvent * e);
|
||||
void dragMoveEvent(QDragMoveEvent * e);
|
||||
void dropEvent(QDropEvent * e);
|
||||
void enterEvent(QEvent * e);
|
||||
void hideEvent(QHideEvent * e);
|
||||
void keyPressEvent(QKeyEvent * e);
|
||||
void keyReleaseEvent(QKeyEvent * e);
|
||||
void leaveEvent(QEvent * e);
|
||||
void mouseDoubleClickEvent(QMouseEvent * e);
|
||||
void mouseMoveEvent(QMouseEvent * e);
|
||||
void mousePressEvent(QMouseEvent * e);
|
||||
void mouseReleaseEvent(QMouseEvent * e);
|
||||
void moveEvent(QMoveEvent * e);
|
||||
void resizeEvent(QResizeEvent * e);
|
||||
void showEvent(QShowEvent * e);
|
||||
void wheelEvent(QWheelEvent * e);
|
||||
void paintEvent(QPaintEvent * e);
|
||||
};
|
||||
Reference in New Issue
Block a user