Network Chess game for two players

Signed-off-by: Denis Kozadaev <denis@dilos.org>
qnetchess
Denis Kozadaev 5 years ago
parent 62af0157e0
commit b93fd6da0b

@ -0,0 +1,2 @@
2005.03.26
Fixed the mate checker. (big thanks to knyaz@RusNet)

@ -0,0 +1,60 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
project( qnetchess )
set( TQT_MAJOR_VERSION 14 )
set( TQT_MINOR_VERSION 0 )
set( TQT_MICRO_VERSION 0 )
set( TQT_VERSION "${TQT_MAJOR_VERSION}.${TQT_MINOR_VERSION}.${TQT_MICRO_VERSION}" )
##### cmake setup ###############################
cmake_minimum_required( VERSION 2.8 )
include( CheckCXXSourceCompiles )
include( GNUInstallDirs OPTIONAL )
##### include our cmake modules #################
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )
include( FindPkgConfig )
##### install paths setup #######################
tde_setup_install_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
tde_setup_install_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" )
##### optional stuff ############################
option( WITH_ALL_OPTIONS "Enable all optional support" OFF )
##### user requested modules ####################
option( BUILD_ALL "Build all" OFF )
##### configure checks ##########################
include( ConfigureChecks.cmake )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
##### q15 sources ######################
add_subdirectory( src )

@ -0,0 +1,47 @@
#################################################
#
# (C) 2011 Timothy Pearson
# kb9vqf (AT) pearsoncomputing.net
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
# required stuff
#tde_setup_architecture_flags( )
#include(TestBigEndian)
#test_big_endian(WORDS_BIGENDIAN)
#tde_setup_largefiles( )
find_package( TQt )
#find_package( TDE )
##### check for gcc visibility support #########
#if( WITH_GCC_VISIBILITY )
# tde_setup_gcc_visibility( )
#endif( )
#if( BUILD_TRANSLATIONS AND NOT DEFINED MSGFMT_EXECUTABLE )
# find_program( MSGFMT_EXECUTABLE msgfmt )
# if( NOT MSGFMT_EXECUTABLE )
# tde_message_fatal( "msgfmt program is required, but was not found on your system" )
# endif( )
#endif( )
#check_type_size( "int" SIZEOF_INT BUILTIN_TYPES_ONLY )
#check_type_size( "long" SIZEOF_LONG BUILTIN_TYPES_ONLY )
#check_include_file( stdint.h HAVE_STDINT_H )
#check_include_file( systems.h HAVE_SYSTEMS_H )
#check_include_file( linux/inotify.h HAVE_INOTIFY )
#check_function_exists( statvfs HAVE_STATVFS )

@ -0,0 +1 @@
Makefile.FreeBSD

@ -0,0 +1,14 @@
# $Id: Makefile.FreeBSD,v 0.1 2004/08/21 12:11:49 denis Exp $
PROG= QNetChess
NO_MAN= noman
SRCS= main.cpp mainwindow.cpp gamesocket.cpp gameboard.cpp
MOCS= mainwindow.h gamesocket.h gameboard.h
LOCALE_FILE= ${PROG}_ru
DFLAGS= -DLOCALE_FILE=\"${LOCALE_FILE}\"
CFLAGS+= -W -Wall -Werror ${DFLAGS}
LDADD+= -L${X11BASE}/lib
.include "qt.FreeBSD.mk"
.include <bsd.prog.mk>

@ -0,0 +1,51 @@
# $Id: Makefile.gnu,v 0.1 2005/01/15 10:22:49 denis Exp $
TARGET= QNetChess
OBJS= main.o mainwindow.o gamesocket.o gameboard.o mainwindow.mo gamesocket.mo\
gameboard.mo
LOCALE_FILE= $(TARGET)_ru
DFLAGS= -DLOCALE_FILE=\"$(LOCALE_FILE)\"
X11BASE= /usr/X11R6
RM= rm -f
CC= gcc
CXX= g++
MOC= $(QTDIR)/bin/moc
QT_INC= -I$(QTDIR)/include
QT_LIB= -L$(QTDIR)/lib -lqt
CFLAGS+= -O2 -W -Wall -Werror $(DFLAGS) -I$(X11BASE)/include $(QT_INC)
LDFLAGS+= -L$(X11BASE)/lib $(QT_LIB)
.SUFFIXES: .h .cxx .mo .o .cpp
.h.cxx:
$(MOC) $< -o $@
.cpp.o:
$(CXX) $(CFLAGS) -c $< -o $@
.cxx.mo:
$(CXX) $(CFLAGS) -c $< -o $@
all: $(OBJS)
$(CXX) $(LDFLAGS) -o $(TARGET) $(OBJS)
clean:
$(RM) $(OBJS) *.cxx
distclean: clean
$(RM) $(TARGET)
main.o: main.cpp
mainwindow.o: mainwindow.cpp
mainwindow.cpp: mainwindow.h
mainwindow.mo: mainwindow.cxx
gamesocket.o: gamesocket.cpp
gamesocket.cpp: gamesocket.h
gamesocket.mo: gamesocket.cxx
gameboard.o: gameboard.cpp
gameboard.cpp: gameboard.h
gameboard.mo: gameboard.cxx

@ -0,0 +1,64 @@
# $Id: Makefile.win32,v 1.0 2005/01/16 13:45:54 denis Exp $
PROG= QNetChess
CC= cl
CXX= cl
LOCALE_FILE= $(PROG)_ru
CXXFLAGS= -GX -nologo -W3 -MD -O1 -DQT_DLL -DQT_THREAD_SUPPORT -DNO_DEBUG\
-DLOCALE_FILE=\""$(LOCALE_FILE)"\"
INCPATH= -I"$(QTDIR)\include"
LINK= link
LDFLAGS= /NOLOGO /SUBSYSTEM:windows /OPT:REF
LIBS= $(QTDIR)\lib\qt-mteval321.lib $(QTDIR)\lib\qtmain.lib \
opengl32.lib glu32.lib kernel32.lib user32.lib gdi32.lib \
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
uuid.lib imm32.lib winmm.lib wsock32.lib
MOC= $(QTDIR)\bin\moc
OBJS= main.obj mainwindow.obj gameboard.obj gamesocket.obj\
mainwindow.moc gameboard.moc gamesocket.moc
TARGET= $(PROG).exe
.SUFFIXES: .h .cxx .cpp .obj .moc
.cpp.obj:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $<
.cxx.moc:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -Fo$@ $<
.h.cxx:
$(MOC) -o $@ $<
all: $(OBJS)
$(LINK) $(LDFLAGS) /OUT:$(TARGET) @<<
$(OBJS) $(LIBS)
<<
clean:
-del main.obj
-del mainwindow.obj
-del gameboard.obj
-del gamesocket.obj
-del mainwindow.moc
-del gameboard.moc
-del gamesocket.moc
-del mainwindow.cxx
-del gameboard.cxx
-del gamesocket.cxx
distclean: clean
-del $(TARGET)
main.obj: main.cpp
mainwindow.obj: mainwindow.cpp
gameboard.obj: gameboard.cpp
gamesocket.obj: gamesocket.cpp
mainwindow.moc: mainwindow.cxx
gameboard.moc: gameboard.cxx
gamesocket.moc: gamesocket.cxx
mainwindow.cxx: mainwindow.h
gameboard.cxx: gameboard.h
gamesocket.cxx: gamesocket.h

Binary file not shown.

@ -0,0 +1,274 @@
<!DOCTYPE TS><TS>
<context>
<name>Drawer</name>
<message>
<source>Error moving</source>
<translation>Не правильный ход</translation>
</message>
<message>
<source>Yes</source>
<translation>Да</translation>
</message>
<message>
<source>No</source>
<translation>Нет</translation>
</message>
<message>
<source>You cannot move this figure because the king is in check</source>
<translation>Вы не можете двигать эту фигуру потому, что вашему королю объявлен шах</translation>
</message>
<message>
<source>To castle</source>
<translation>Рокировка</translation>
</message>
<message>
<source>Do you want to castle?</source>
<translation>Вы хотите сделать рокировку?</translation>
</message>
</context>
<context>
<name>FigureDialog</name>
<message>
<source>What figure should I set?</source>
<translation>Какую фигуру следует поставить?</translation>
</message>
</context>
<context>
<name>GameBoard</name>
<message>
<source>White</source>
<translation>Белыми</translation>
</message>
<message>
<source>Black</source>
<translation>Чёрными</translation>
</message>
<message>
<source>game with</source>
<translation>игра с</translation>
</message>
<message>
<source>Game chat</source>
<translation>Игровой чат</translation>
</message>
<message>
<source>History</source>
<translation>История</translation>
</message>
<message>
<source>Looking up the host</source>
<translation>Поиск хоста</translation>
</message>
<message>
<source>Accepted a new connection</source>
<translation>Принято новое соединение</translation>
</message>
<message>
<source>The host found</source>
<translation>Хост найден</translation>
</message>
<message>
<source>Socket Error...</source>
<translation>Ошибка сокета...</translation>
</message>
<message>
<source>You have a socket error number</source>
<translation>Возникла ошибка сокета номер</translation>
</message>
<message>
<source>game from</source>
<translation>игра с</translation>
</message>
<message>
<source>Accepted the</source>
<translation>Принята</translation>
</message>
<message>
<source>Your move...</source>
<translation>Ваш ход...</translation>
</message>
<message>
<source>Waiting a move...</source>
<translation>Ожидание хода...</translation>
</message>
<message>
<source>End the game</source>
<translation>Конец игры</translation>
</message>
<message>
<source>Want you to end the game?
You will lose it</source>
<translation>Желаете закончить игру?
Вы проиграете</translation>
</message>
<message>
<source>Yes, end</source>
<translation>Да, закончить</translation>
</message>
<message>
<source>No, continue</source>
<translation>Нет, продолжить</translation>
</message>
<message>
<source>B</source>
<translation>С</translation>
</message>
<message>
<source>K</source>
<translation>К</translation>
</message>
<message>
<source>C</source>
<translation>Л</translation>
</message>
<message>
<source>Q</source>
<translation>Ф</translation>
</message>
<message>
<source>Error!</source>
<translation>Ошибка!</translation>
</message>
<message>
<source>The host</source>
<translation>Хост</translation>
</message>
<message>
<source>not found.</source>
<translation>не найден.</translation>
</message>
<message>
<source>Save image</source>
<translation>Сохранить картинку</translation>
</message>
<message>
<source>Do you want to save the image?</source>
<translation>Вы желаете сохранить картинку?</translation>
</message>
<message>
<source>Yes, save</source>
<translation>Да, сохранить</translation>
</message>
<message>
<source>No, don&apos;t save</source>
<translation>Нет, не сохранять</translation>
</message>
<message>
<source>You scored the game</source>
<translation>Вы выиграли игру</translation>
</message>
<message>
<source>You have a mate.
You lost the game.</source>
<translation>Вам поставили мат.
Вы проиграли эту игру.</translation>
</message>
<message>
<source>You have a stalemate</source>
<translation>У вас пат</translation>
</message>
<message>
<source>Game over</source>
<translation>Конец игры</translation>
</message>
<message>
<source>Connected to the host</source>
<translation>Соединились с хостом</translation>
</message>
<message>
<source>Lookup Error</source>
<translation>Ошибка DNS</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<source>New</source>
<translation>Новая</translation>
</message>
<message>
<source>Save image</source>
<translation>Сохранить картинку</translation>
</message>
<message>
<source>Quit</source>
<translation>Выход</translation>
</message>
<message>
<source>About the game</source>
<translation>Об Игре</translation>
</message>
<message>
<source>Game</source>
<translation>Игра</translation>
</message>
<message>
<source>Help</source>
<translation>Помощь</translation>
</message>
<message>
<source>Ready</source>
<translation>Готов</translation>
</message>
<message>
<source>About</source>
<translation>Об Игре</translation>
</message>
<message>
<source>is a network game chess for two players.
It has a client and a server in the same program.
You can modify and redistribute the source code
because it is under GPL.
Russia, Tambov, 2005 (denis@silversoft.net)</source>
<translation>это сетевая игра в шахматы на два игрока.
Она содержит клиента и сервер в одной программе.
Вы можете модифицировать и распространять исходный код
потому, что он идёт под лицензией GPL.
Россия, Тамбов, 2005 год (denis@silversoft.net)</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<source>Socket Error</source>
<translation>Ошиба сокета</translation>
</message>
<message>
<source>Cannot create a server socket!</source>
<translation>Не могу создать серверный сокет!</translation>
</message>
</context>
<context>
<name>SelectGame</name>
<message>
<source>New game with...</source>
<translation>Новая игра с...</translation>
</message>
<message>
<source>To play with </source>
<translation>Играем с</translation>
</message>
<message>
<source>Choose your game</source>
<translation>Выбирете игру</translation>
</message>
<message>
<source>White game</source>
<translation>Игра белыми</translation>
</message>
<message>
<source>Black game</source>
<translation>Игра чёрными</translation>
</message>
<message>
<source>Play!</source>
<translation>Играть!</translation>
</message>
<message>
<source>Cancel</source>
<translation>Отмена</translation>
</message>
</context>
</TS>

@ -0,0 +1,22 @@
Network Chess Game
~~~~~~~~~~~~~~~~~~
This software is distributed under GNU GPL.
Use it at own risk. NO WARRANTY.
To compile the game you need Qt library version 3.2 or newer.
Also you need to set QTDIR environvent variable.
Read Qt manual for more info.
Then just type make -f Makefile.gnu and wait for a few time.
If you use FreeBSD you may type Makefile.FreeBSD.
The game uses TCP port 1345, you may change it at gamesocket.h
Maybe I'll write HTTP-proxy support... maybe!
Denis, Tambov
(aka denk@RusNet)
2005/29/01

@ -0,0 +1,29 @@
Так, пиплы...
Используете игру на свой страх и риск, ну, как обычно, короче ;-)
Для сборки нужна библиотека Qt-3,
сойдёт та, что есть в портах FreeBSD, не знаю как оно собираться с ней
будет, у меня всё ручками стоит в /usr/local/qt, и прописана переменная
QTDIR на этот каталог, как указано в фирменной документации библиотеки.
Вобщем, если проблемы со сборкой, то правьте qt.FreeBSD.mk.
Ах да, чуть не забыл...
Программа открывает дырку в машину на порте 1345 :)
Можете поправить это в файле gamesocket.h
В планах написать поддержку HTTP-proxy по многочисленным просьбам,
посмотрим...
Да, любителям configure ;-)
Здесь мало чего надо конфигурить, так что считаю сиё лишним.
Хватит правильно прописать переменную QTDIR, как именно - читайте доки на Qt.
В трёх словах - х.. вам, а не configure ;-)
Писалось во фрюхе и под фрюху, остальные отдыхают ;-)
За сим всё, спешу откланиться,
Денис, Тамбов
(aka denk@RusNet)
P.S.
Дюлей навешаю, если сопрёте мои картинки ;-)
Я их честно украл! ;-)

@ -0,0 +1,17 @@
#!/bin/bash
top_srcdir=${1}
top_builddir=${2}
kde_libs_htmldir=${3}
export TQTDOCDIR=${4}
if [[ ! -d "${top_srcdir}/doc/common/" ]]; then
export DOXDATA=${kde_libs_htmldir}/en/common
fi
abs_top_srcdir=$(cd ${top_srcdir} && pwd)
rm -rf ${top_builddir}/${kde_libs_htmldir}/en
mkdir -p ${top_builddir}/${kde_libs_htmldir}/en
cd ${top_builddir}/${kde_libs_htmldir}/en
${abs_top_srcdir}/admin/doxygen.sh --modulename --installdir=${top_builddir}/${kde_libs_htmldir}/en ${abs_top_srcdir}

@ -0,0 +1,12 @@
#!/bin/bash
top_srcdir=${1}
top_builddir=${2}
kde_libs_htmldir=${3}
installdir=${DESTDIR}
abs_top_srcdir=$(cd ${top_srcdir} && pwd)
cd ${top_builddir}
mkdir -p ${installdir}/${kde_libs_htmldir}/en
cp -Rp ${top_builddir}/${kde_libs_htmldir}/en ${installdir}/${kde_libs_htmldir}/

@ -0,0 +1,104 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
if( NOT TDE_FOUND )
message( STATUS "checking for 'TDE'")
pkg_search_module( TDE tqt )
if( NOT TDE_FOUND )
tde_message_fatal( "Unable to find tdelibs!\n Try adding the directory in which the tdelibs.pc file is located\nto the PKG_CONFIG_PATH variable." )
endif( )
# if the path is not already defined by user,
# find tde-config executable
if( NOT DEFINED KDECONFIG_EXECUTABLE )
find_program( KDECONFIG_EXECUTABLE
NAMES tde-config
HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR} )
if( NOT KDECONFIG_EXECUTABLE )
tde_message_fatal( "tde-config are NOT found." )
endif( NOT KDECONFIG_EXECUTABLE )
endif( NOT DEFINED KDECONFIG_EXECUTABLE )
set( ENV{LD_LIBRARY_PATH} "${TDE_LIBDIR}:$ENV{LD_LIBRARY_PATH}" )
# check for installed trinity version
tde_execute_process(
COMMAND ${KDECONFIG_EXECUTABLE} --version
OUTPUT_VARIABLE _version
RESULT_VARIABLE _result
OUTPUT_STRIP_TRAILING_WHITESPACE
MESSAGE "Unable to run tde-config!\n TDELIBS are correctly installed?\n Path to tde-config are corect?" )
# parse tde-config output, to extract TDE version
string( REGEX MATCH "TDE: R([0-9\\.]+).*" __dummy "${_version}" )
set( TDE_VERSION "${CMAKE_MATCH_1}" )
# ask tde-config for few paths
macro( __internal_get_path __type __var )
tde_execute_process(
COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install ${__type}
OUTPUT_VARIABLE ${__var}
CACHE INTERNAL "TDE ${__type} path" FORCE
OUTPUT_STRIP_TRAILING_WHITESPACE )
endmacro( __internal_get_path )
__internal_get_path( include TDE_INCLUDE_DIR )
__internal_get_path( lib TDE_LIB_DIR )
__internal_get_path( exe TDE_BIN_DIR )
__internal_get_path( data TDE_DATA_DIR )
__internal_get_path( config TDE_CONFIG_DIR )
__internal_get_path( html TDE_HTML_DIR )
__internal_get_path( cmake TDE_CMAKE_DIR )
__internal_get_path( tqtplugins TDE_TQTPLUGINS_DIR )
# find kde tools
macro( __internal_find_program __prog __var )
find_program( ${__var}
NAMES ${__prog}
HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( NOT ${__var} )
tde_message_fatal( "${__prog} is NOT found.\n TDELIBS are correctly installed?" )
endif( NOT ${__var} )
set( ${__var} ${${__var}} CACHE INTERNAL "${__prog} executable" FORCE )
endmacro( __internal_find_program )
__internal_find_program( dcopidl KDE3_DCOPIDL_EXECUTABLE )
__internal_find_program( dcopidlng KDE3_DCOPIDLNG_EXECUTABLE )
__internal_find_program( dcopidl2cpp KDE3_DCOPIDL2CPP_EXECUTABLE )
__internal_find_program( meinproc KDE3_MEINPROC_EXECUTABLE )
__internal_find_program( tdeconfig_compiler KDE3_KCFGC_EXECUTABLE )
__internal_find_program( maketdewidgets KDE3_MAKETDEWIDGETS_EXECUTABLE )
# Don't use __internal_find_program due to it's not mandatory
find_program( TDELFEDITOR_EXECUTABLE NAMES tdelfeditor
HINTS "${TDE_PREFIX}/bin" ${BIN_INSTALL_DIR} OUTPUT_STRIP_TRAILING_WHITESPACE )
# dcopidlng is a bash script which using tde-config;
# if PATH to tde-config is not set, dcopidlng will fail;
# for this reason we set KDECONFIG environment variable before running dcopidlng
set( KDE3_DCOPIDLNG_EXECUTABLE env KDECONFIG=${KDECONFIG_EXECUTABLE} ${KDE3_DCOPIDLNG_EXECUTABLE}
CACHE INTERNAL "dcopidlng executable" FORCE )
# look for SCM data if present
if( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmmodule" )
file( STRINGS "${CMAKE_SOURCE_DIR}/.tdescmmodule" TDE_SCM_MODULE_NAME )
endif( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmmodule" )
if( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmrevision" )
file( STRINGS "${CMAKE_SOURCE_DIR}/.tdescmrevision" TDE_SCM_MODULE_REVISION )
endif( EXISTS "${CMAKE_SOURCE_DIR}/.tdescmrevision" )
message( STATUS " found 'TDE', version ${TDE_VERSION}" )
endif( NOT TDE_FOUND )
include( "${TDE_CMAKE_DIR}/tdelibs.cmake" )

@ -0,0 +1,107 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
macro( tqt_message )
message( STATUS "${ARGN}" )
endmacro( )
pkg_search_module( TQT tqt )
if( NOT TQT_FOUND )
tde_message_fatal( "Unable to find tqt!\n Try adding the directory in which the tqt.pc file is located\nto the PKG_CONFIG_PATH variable." )
endif( )
mark_as_advanced(
TMOC_EXECUTABLE
MOC_EXECUTABLE
UIC_EXECUTABLE
)
# tmoc_executable
tde_execute_process(
COMMAND pkg-config tqt --variable=tmoc_executable
OUTPUT_VARIABLE TMOC_EXECUTABLE
CACHE FILEPATH "TQt tmoc executable path"
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( NOT EXISTS ${TMOC_EXECUTABLE} )
tde_message_fatal( "tmoc is not found!\n tqt is correctly installed?" )
endif( )
tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" )
# moc_executable
tde_execute_process(
COMMAND pkg-config tqt --variable=moc_executable
OUTPUT_VARIABLE MOC_EXECUTABLE
CACHE FILEPATH "TQt moc executable path"
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( NOT EXISTS ${MOC_EXECUTABLE} )
tde_message_fatal( "Path to moc is not set.\n tqt is correctly installed?" )
endif( )
tqt_message( " moc path: ${MOC_EXECUTABLE}" )
# uic_executable
tde_execute_process(
COMMAND pkg-config tqt --variable=uic_executable
OUTPUT_VARIABLE UIC_EXECUTABLE
CACHE FILEPATH "TQt uic executable path"
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( NOT EXISTS ${UIC_EXECUTABLE} )
tde_message_fatal( "uic not found!\n tqt is correctly installed?" )
endif( )
tqt_message( " uic path: ${UIC_EXECUTABLE}" )
# tqt-replace script
set( TQT_REPLACE_SCRIPT "${TQT_PREFIX}/bin/tqt-replace" )
if( NOT EXISTS ${TQT_REPLACE_SCRIPT} )
tde_message_fatal( "tqt-replace not found!\n Check tqt installation." )
endif( )
tqt_message( " tqt-replace path: ${TQT_REPLACE_SCRIPT}" )
# check if tqt is usable
tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} )
foreach( _dirs ${TQT_LIBRARY_DIRS} )
list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" )
endforeach()
list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQT_LIBRARIES} )
check_cxx_source_compiles("
#include <tqapplication.h>
int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } "
HAVE_USABLE_TQT )
if( NOT HAVE_USABLE_TQT )
tde_message_fatal( "Unable to build a simple tqt test." )
endif( )
tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
# TQT_CXX_FLAGS
foreach( _flag ${TQT_CFLAGS} ${TQT_CFLAGS_OTHER} )
set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS} ${_flag}" )
endforeach()
# Set compiler flags according to build type
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "-DNDEBUG" )
set( CMAKE_C_FLAGS_RELWITHDEBINFO "-DNDEBUG" )

@ -0,0 +1,45 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
macro( tqtqui_message )
message( STATUS "${ARGN}" )
endmacro( )
pkg_search_module( TQTQUI tqtqui )
if( NOT TQTQUI_FOUND )
tde_message_fatal( "Unable to find tqtqui!\n Try adding the directory in which the tqtqui.pc file is located\nto the PKG_CONFIG_PATH variable." )
endif( )
# check if tqtqui is usable
tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
set( CMAKE_REQUIRED_INCLUDES ${TQTQUI_INCLUDE_DIRS} )
foreach( _dirs ${TQTQUI_LIBRARY_DIRS} )
list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" )
endforeach()
list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQTQUI_LIBRARIES} )
check_cxx_source_compiles("
#include <tqapplication.h>
int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } "
HAVE_USABLE_TQTQUI )
if( NOT HAVE_USABLE_TQTQUI )
tde_message_fatal( "Unable to build a simple tqtqui test." )
endif( )
tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
# TQTQUI_CXX_FLAGS
foreach( _flag ${TQTQUI_CFLAGS_OTHER} )
set( TQTQUI_CXX_FLAGS "${TQTQUI_CXX_FLAGS} ${_flag}" )
endforeach()

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,68 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
#################################################
#####
##### tde_internal_setup_path
macro( _tde_internal_setup_path _path _default _comment )
if( DEFINED ${_path} )
set( ${_path} "${${_path}}" CACHE PATH "${_comment}" )
else( DEFINED ${_path} )
set( ${_path} "${_default}" )
endif( DEFINED ${_path} )
endmacro( _tde_internal_setup_path )
#################################################
#####
##### tde_setup_paths
macro( tde_setup_paths )
# install paths
_tde_internal_setup_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries" )
_tde_internal_setup_path( SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/" )
_tde_internal_setup_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)" )
_tde_internal_setup_path( SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)" )
_tde_internal_setup_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})" )
_tde_internal_setup_path( LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/trinity/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/trinity/libexec)" )
_tde_internal_setup_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" "The install dir for pkg-config metadata files" )
_tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix" )
_tde_internal_setup_path( CMAKE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/cmake" "The install dir for cmake import modules" )
_tde_internal_setup_path( PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/trinity" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/trinity)" )
_tde_internal_setup_path( CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir" )
_tde_internal_setup_path( DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data" )
_tde_internal_setup_path( HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/tde/HTML" "The HTML install dir for documentation" )
_tde_internal_setup_path( ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)" )
_tde_internal_setup_path( KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for tdeconfig files" )
_tde_internal_setup_path( LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations" )
_tde_internal_setup_path( APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" "The install dir for the application desktop files" )
_tde_internal_setup_path( MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files" )
_tde_internal_setup_path( SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/services" "The install dir for service (desktop, protocol, ...) files" )
_tde_internal_setup_path( SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/servicetypes" "The install dir for servicestypes desktop files" )
_tde_internal_setup_path( SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files" )
_tde_internal_setup_path( TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)" )
_tde_internal_setup_path( WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers" )
_tde_internal_setup_path( KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/tdeconf_update" "The tdeconf_update install dir" )
_tde_internal_setup_path( AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files" )
_tde_internal_setup_path( SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)" )
_tde_internal_setup_path( MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" "The man install dir (default ${SHARE_INSTALL_PREFIX}/man/)" )
_tde_internal_setup_path( INFO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/info" "The info install dir (default ${SHARE_INSTALL_PREFIX}/info)" )
_tde_internal_setup_path( XDG_MENU_INSTALL_DIR "${SYSCONF_INSTALL_DIR}/xdg/menus" "The XDG menus dir" )
_tde_internal_setup_path( XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications/tde" "The XDG apps dir" )
_tde_internal_setup_path( XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory" )
_tde_internal_setup_path( XDG_MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mime/packages" "The install dir for the xdg mimetypes" )
endmacro( tde_setup_paths )

@ -0,0 +1,67 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
set( CMAKE_MODULE_PATH "${MASTER_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )
get_filename_component( _ui_basename ${UI_FILE} NAME_WE )
# FIXME this will working only on out-of-source mode
set( local_ui_file ${_ui_basename}.ui )
configure_file( ${UI_FILE} ${local_ui_file} COPYONLY )
tde_execute_process( COMMAND ${TQT_REPLACE_SCRIPT} ${local_ui_file} )
# ui.h extension file, if exists
if( EXISTS "${UI_FILE}.h" )
configure_file( ${UI_FILE}.h ${local_ui_file}.h COPYONLY )
tde_execute_process( COMMAND ${TQT_REPLACE_SCRIPT} ${local_ui_file}.h )
endif( )
if( TDE_TQTPLUGINS_DIR )
set( L -L ${TDE_TQTPLUGINS_DIR} )
endif( )
tde_execute_process( COMMAND ${UIC_EXECUTABLE}
-nounload -tr tr2i18n
${L}
${local_ui_file}
OUTPUT_VARIABLE _ui_h_content )
if( _ui_h_content )
string( REGEX REPLACE "#ifndef " "#ifndef UI_" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "#define " "#define UI_" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "public TQWizard" "public KWizard" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "public QWizard" "public KWizard" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "#include <ntqwizard.h>" "#include <kwizard.h>" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "#include <qwizard.h>" "#include <kwizard.h>" _ui_h_content "${_ui_h_content}" )
file( WRITE ${_ui_basename}.h "${_ui_h_content}" )
endif( )
tde_execute_process( COMMAND ${UIC_EXECUTABLE}
-nounload -tr tr2i18n
${L}
-impl ${_ui_basename}.h
${local_ui_file}
OUTPUT_VARIABLE _ui_cpp_content )
if( _ui_cpp_content )
string( REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
string( REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
string( REGEX REPLACE ": TQWizard\\(" ": KWizard(" _ui_cpp_content "${_ui_cpp_content}" )
string( REGEX REPLACE ": QWizard\\(" ": KWizard(" _ui_cpp_content "${_ui_cpp_content}" )
file( WRITE ${_ui_basename}.cpp "#include <kdialog.h>\n#include <tdelocale.h>\n\n${_ui_cpp_content}" )
tde_execute_process( COMMAND ${MOC_EXECUTABLE}
${_ui_basename}.h
OUTPUT_VARIABLE _ui_h_moc_content )
file( APPEND ${_ui_basename}.cpp "${_ui_h_moc_content}" )
endif( )

@ -0,0 +1,5 @@
#ifdef _AIX
namespace {
void *not_empty_file;
}
#endif

@ -0,0 +1,7 @@
add_library( @_target@ @_type@ IMPORTED )
set_target_properties( @_target@ PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES "@_shared_libs@"
IMPORTED_LOCATION "@_location@"
IMPORTED_SONAME "@_soname@" )

@ -0,0 +1,35 @@
# @_laname@ - a libtool library file
# Generated by CMake - GNU libtool
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='@_library_name_2@'
# Names of this library.
library_names='@_library_name_1@ @_library_name_2@ @_library_name_3@'
# The name of the static archive.
old_library=''
# Libraries that this one depends upon.
dependency_libs=''
# Version information for @_name@.
current=@_version_current@
age=@_version_age@
revision=@_version_revision@
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=@_shouldnotlink@
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='@_libdir@'

@ -0,0 +1,2 @@
extern "C" int kdemain(int argc, char* argv[]);
int main(int argc, char* argv[]) { return kdemain(argc,argv); }

@ -0,0 +1,3 @@
#include <kdemacros.h>
extern "C" int kdemain(int argc, char* argv[]);
extern "C" KDE_EXPORT int tdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }

@ -0,0 +1,29 @@
# $Id: qt.FreeBSD.mk,v 1.0 2004/11/05 10:22:11 denis Exp $
QTDIR= ${X11BASE}
MOC= ${QTDIR}/bin/moc
LUPDATE= ${QTDIR}/bin/lupdate
LRELEASE= ${QTDIR}/bin/lrelease
PTHREAD_CFLAGS?= -pthread
PTHREAD_LIBS?= -pthread
QTCFLAGS= ${QTDIR}/include -DQT_NO_COMPAT ${PTHREAD_CFLAGS}
QTLFLAGS= -L${QTDIR}/lib -lqt-mt ${PTHREAD_LIBS}
CFLAGS+= -I${QTCFLAGS}
CXXFLAGS= ${CFLAGS}
LDADD+= ${QTLFLAGS}
SRCMOC= ${MOCS:M*.h:R:S/$/.cxx/g}
OBJMOC= ${MOCS:M*.h:R:S/$/.mo/g}
OBJS+= ${OBJMOC}
CLEANFILES+= ${SRCMOC}
.SUFFIXES: .h .cxx .mo
.h.cxx:
${MOC} ${.IMPSRC} -o ${.TARGET}
.cxx.mo:
${CXX} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET}

@ -0,0 +1,44 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
# (C) 2011-2012 Timothy Pearson
# kb9vqf (AT) pearsoncomputing (DOT) net
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
include_directories(
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
)
link_directories(
${TQT_LIBRARY_DIR}
)
##### q15 #################################
install( PROGRAMS
${CMAKE_CURRENT_BINARY_DIR}/qnetchess
DESTINATION ${BIN_INSTALL_DIR} )
set( target qnetchess )
set( ${target}_SRCS
gameboard.cpp gamesocket.cpp main.cpp mainwindow.cpp
)
tde_add_executable( ${target} AUTOMOC
SOURCES ${${target}_SRCS}
LINK tqt-mt
DESTINATION ${BIN_INSTALL_DIR}
)

File diff suppressed because it is too large Load Diff

@ -0,0 +1,245 @@
/*
* $Id: gameboard.h,v 0.1 2005/01/08 13:00:57 denis Exp $
*
* Author: Denis Kozadaev (denis@tambov.ru)
* Description:
*
* See also: style(9)
*
* Hacked by:
*/
#ifndef __GAME_BOARD_H__
#define __GAME_BOARD_H__
#include <ntqwidget.h>
#include <ntqpainter.h>
#include <ntqpixmap.h>
#include <ntqpointarray.h>
#include <ntqdialog.h>
#include <ntqsocket.h>
#include <ntqgroupbox.h>
#include <ntqlineedit.h>
#include <ntqlistbox.h>
#include <ntqtimer.h>
#include <stdlib.h>
#define MAX(a, b) (((a) > (b))?(a):(b))
#define SEP ' '
#define EOL '\n'
#define LONG_XCHG "@-@"
#define SHORT_XCHG "o-o"
#define SOCK_WAIT 900
#define GAMEOVER_TXT "****"
class GameBoard;
class Drawer;
class Figure;
class GameBoard:public TQWidget
{
Q_OBJECT
public:
enum GameType {
NOGAME = 0x0,
BLACK = 0x1,
WHITE = 0x2
};
enum FigureType {
NONE = 0x00,
WHITE_PAWN = 0x01,
WHITE_CASTLE = 0x02,
WHITE_BISHOP = 0x03,
WHITE_KING = 0x04,
WHITE_QUEEN = 0x05,
WHITE_KNIGHT = 0x06,
BLACK_PAWN = 0x11,
BLACK_CASTLE = 0x12,
BLACK_BISHOP = 0x13,
BLACK_KING = 0x14,
BLACK_QUEEN = 0x15,
BLACK_KNIGHT = 0x16,
DUMMY = 0xFF
};
GameBoard(GameType, const TQString &, TQWidget *parent = NULL,
const char *name = NULL);
GameBoard(int, TQWidget *parent = NULL, const char *name = NULL);
~GameBoard();
void saveImage();
GameType type()const{return (gt);}
TQString status()const{return (my_stat);}
private:
Drawer *drw;
GameType gt;
FigureType *map;
TQString hst, my_stat;
TQSocket *sock;
TQGroupBox *box, *hist;
TQListBox *lst, *hw, *hb;
TQLineEdit *edt;
TQTimer *tmr;
int sock_tout;
void initMap();
void parseString(const TQString&);
void updateChat(const TQString&);
void updateHistory(const TQString&, bool);
void updateHistory(int, bool);
protected:
void resizeEvent(TQResizeEvent *);
void closeEvent(TQCloseEvent *);
void focusInEvent(TQFocusEvent *);
private slots:
void showHostFound();
void sockConnected();
void sockRead();
void sockClosed();
void sendMove(const TQString&);
void sendText();
void sendFigure(const TQString&, GameBoard::FigureType);
void sockTest();
void sockError(int);
void gameover(int);
signals:
void showStatus(const TQString&);
};
//-----------------------------------------------------------------------------
class Drawer:public TQWidget
{
Q_OBJECT
public:
Drawer(GameBoard::FigureType *, GameBoard::GameType *,
TQWidget *parent = NULL, const char *name = NULL);
~Drawer();
void makeMove(const TQString&);
void newFigure(const TQString&, int);
private:
int top_margin, left_margin, hl;
int x_brd, y_brd, cs;
int tfx, tfy;
TQPixmap fig[12];
GameBoard::FigureType *map;
GameBoard::GameType *gt;
bool km, lcm, rcm, kk;
void drawBoard(TQPainter *, int, int);
void drawMap(TQPainter *, int, int);
void win2map(int&, int&);
void map2win(int, int, int&, int&);
void takeFigure(int, int);
void makeMove(GameBoard::GameType, int, int, int, int, bool, bool);
bool xchg(GameBoard::FigureType, GameBoard::FigureType,
int, int, int, int);
bool checkWhiteCastle(int, int, int, int, bool);
bool checkBlackCastle(int, int, int, int, bool);
bool canTake(int, int);
bool hasTakenFigure();
bool makeXchg();
protected:
void paintEvent(TQPaintEvent *);
void mousePressEvent(TQMouseEvent *);
signals:
void touchFigure(int, int);
void moved(const TQString&);
void newFigure(const TQString&, GameBoard::FigureType);
void gameover(int);
};
//-----------------------------------------------------------------------------
class FigureDialog:public TQDialog
{
Q_OBJECT
public:
FigureDialog(const TQPixmap *, const GameBoard::GameType,
TQWidget *parent = NULL, const char *name = NULL);
~FigureDialog();
GameBoard::FigureType figure()const{return (fr);}
private:
GameBoard::GameType gt;
const TQPixmap *fig;
TQString str;
int step, fh;
GameBoard::FigureType fr;
protected:
void paintEvent(TQPaintEvent *);
void mousePressEvent(TQMouseEvent *);
};
//-----------------------------------------------------------------------------
class Figure
{
public:
static bool hasMyFigure(GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static int hasEnemyFigure(GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static bool hasFigure(GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static int map2map(GameBoard::GameType, int, int, bool);
static int validMove(GameBoard::GameType, GameBoard::FigureType *,
int, int, int, int, bool);
static void moveList(TQPointArray&, GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static void moveListWhitePawn(TQPointArray&, GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static void moveListBlackPawn(TQPointArray&, GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static void moveListCastle(TQPointArray&, GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static void moveListBishop(TQPointArray&, GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static void moveListKing(TQPointArray&, GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static void moveListQueen(TQPointArray&, GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static void moveListKnight(TQPointArray&, GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static bool hasPoint(const TQPointArray&, int, int);
static bool hasKingsMeeting(GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static bool validPoint(GameBoard::GameType,
GameBoard::FigureType *, int, int, bool);
static TQString map2str(int, int);
static void str2map(const TQString&, int *, int *);
static int checkKing(GameBoard::GameType, GameBoard::FigureType *,
bool, TQPointArray&, bool);
};
//-----------------------------------------------------------------------------
class GameProtocol
{
public:
static void send(TQSocket *, const TQString&);
static void setGameType(TQSocket *, GameBoard::GameType);
static void acceptGame(TQSocket *);
static void sendMove(TQSocket *, const TQString&);
static void sendQuit(TQSocket *);
static void sendText(TQSocket *, const TQString&);
static void sendFigure(TQSocket *, const TQString&, int);
static void sendGameover(TQSocket *, const TQString&);
};
#endif /* __GAME_BOARD_H__ */

@ -0,0 +1,33 @@
/*
* $Id: gamesocket.cpp,v 0.1 2005/01/08 12:31:24 denis Exp $
*
* Author: Denis Kozadaev (denis@tambov.ru)
* Description:
*
* See also: style(9)
*
* Hacked by:
*/
#include <ntqsocket.h>
#include "gamesocket.h"
GameSocket::GameSocket(TQObject *parent, const char *name)
:TQServerSocket(GAME_PORT, GAME_BACKLOG, parent, name)
{
}
GameSocket::~GameSocket()
{
}
void
GameSocket::newConnection(int sock)
{
emit acceptConnection(sock);
}
#include "gamesocket.moc"

@ -0,0 +1,37 @@
/*
* $Id: gamesocket.h,v 0.1 2005/01/08 12:31:24 denis Exp $
*
* Author: Denis Kozadaev (denis@tambov.ru)
* Description:
*
* See also: style(9)
*
* Hacked by:
*/
#ifndef __GAME_SOCKET_H__
#define __GAME_SOCKET_H__
#include <ntqserversocket.h>
#include <stdlib.h>
#define GAME_PORT 1345
#define GAME_BACKLOG 5
class GameSocket:public TQServerSocket
{
Q_OBJECT
public:
GameSocket(TQObject *parent = NULL, const char *name = NULL);
~GameSocket();
private:
protected:
void newConnection(int);
signals:
void acceptConnection(int);
};
#endif /* __GAME_SOCKET_H__ */

@ -0,0 +1,54 @@
/*
* $Id: main.cpp,v 0.1 2005/01/08 12:19:58 denis Exp $
*
* Author: Denis Kozadaev (denis@tambov.ru)
* Description:
*
* See also: style(9)
*
* Hacked by:
*/
#include <ntqapplication.h>
#include <ntqmessagebox.h>
#include <ntqtextcodec.h>
#include <ntqtranslator.h>
#include "mainwindow.h"
const int
XSize = 800,
YSize = 600;
int
main(int argc, const char *argv[])
{
TQApplication *app;
MainWindow *mw;
// TQTranslator *qt;
int result = 0;
app = new TQApplication(argc, (char **)argv);
/* FIXME: how does TQTranslator() work in TQt?
qt = new TQTranslator();
if (qt->load(LOCALE_FILE))
app->installTranslator(qt);*/
mw = new MainWindow();
if (mw->sockOk()) {
app->setMainWidget(mw);
mw->show();
mw->resize(XSize, YSize);
mw->setMinimumSize(mw->size());
result = app->exec();
} else
TQMessageBox::critical(NULL, TQObject::tr("Socket Error"),
TQObject::tr("Cannot create a server socket!"));
delete mw;
// delete qt;
delete app;
return (result);
}

@ -0,0 +1,294 @@
/*
* $Id: mainwindow.cpp,v 0.1 2005/01/08 12:20:13 denis Exp $
*
* Author: Denis Kozadaev (denis@tambov.ru)
* Description:
*
* See also: style(9)
*
* Hacked by:
*/
#include <ntqapplication.h>
#include <ntqmenubar.h>
#include <ntqstatusbar.h>
#include <ntqpixmap.h>
#include <ntqvalidator.h>
#include <ntqmessagebox.h>
#include "mainwindow.h"
#include "gameboard.h"
#include "xpm/chess.xpm"
#include "xpm/quit.xpm"
#include "xpm/new_game.xpm"
extern TQColor cw, cb;
MainWindow::MainWindow(TQWidget *parent, const char *name)
:TQMainWindow(parent, name)
{
TQPixmap xpm(chess_xpm);
cw = TQColor(0x8F, 0xDF, 0xF0);
cb = TQColor(0x70, 0x9F, 0xDF);
setIcon(xpm);
wrk = new TQWorkspace(this);
sock = new GameSocket(this);
game = new TQPopupMenu(this);
game->insertItem(TQPixmap((const char **)new_game), tr("New"),
this, SLOT(newGame()), CTRL + Key_N);
id = game->insertItem(xpm, tr("Save image"), this,
SLOT(saveImage()), CTRL + Key_S);
game->setItemEnabled(id, FALSE);
game->insertSeparator();
game->insertItem(TQPixmap((const char **)quit_xpm), tr("Quit"), tqApp,
SLOT(quit()), CTRL + Key_Q);
help = new TQPopupMenu(this);
help->insertItem(xpm, tr("About the game"), this, SLOT(about()));
menuBar()->insertItem(tr("Game"), game);
menuBar()->insertSeparator();
menuBar()->insertItem(tr("Help"), help);
setCentralWidget(wrk);
ready_txt = tr("Ready");
showStatus(ready_txt);
TQObject::connect(sock, SIGNAL(acceptConnection(int)),
this, SLOT(newGame(int)));
TQObject::connect(wrk, SIGNAL(windowActivated(TQWidget *)),
this, SLOT(activated(TQWidget *)));
}
MainWindow::~MainWindow()
{
delete help;
delete game;
delete sock;
delete wrk;
}
void
MainWindow::showStatus(const TQString &txt)
{
statusBar()->message(txt);
}
void
MainWindow::newGame()
{
SelectGame *dlg;
GameBoard *brd;
TQString hst;
dlg = new SelectGame(this);
dlg->setHosts(hosts);
if (dlg->exec()) {
hosts = dlg->hosts();
hst = dlg->host();
brd = new GameBoard(dlg->gameType(), hst, wrk);
showStatus(brd->status());
TQObject::connect(brd, SIGNAL(showStatus(const TQString&)),
this, SLOT(showStatus(const TQString&)));
brd->show();
}
delete dlg;
}
void
MainWindow::newGame(int sock)
{
GameBoard *brd;
brd = new GameBoard(sock, wrk);
showStatus(brd->status());
TQObject::connect(brd, SIGNAL(showStatus(const TQString&)),
this, SLOT(showStatus(const TQString&)));
brd->show();
game->setItemEnabled(id, TRUE);
}
void
MainWindow::about()
{
TQMessageBox::about(this, tr("About") + " QNetChess", "QNetChess " + tr(
"is a network game chess for two players.\n"
"It has a client and a server in the same program.\n"
"You can modify and redistribute the source code\n"
"because it is under GPL.\n\n"
"Russia, Tambov, 2005, 2020 (denis@tambov.ru)"
));
}
void
MainWindow::activated(TQWidget *w)
{
GameBoard *brd = (GameBoard *)w;
game->setItemEnabled(id, brd != NULL);
if (brd != NULL)
showStatus(brd->status());
else
showStatus(ready_txt);
}
void
MainWindow::saveImage()
{
GameBoard *brd = (GameBoard *)wrk->activeWindow();
if (brd != NULL)
brd->saveImage();
}
//-----------------------------------------------------------------------------
SelectGame::SelectGame(TQWidget *parent, const char *name)
:TQDialog(parent, name)
{
setCaption(tr("New game with..."));
l1 = new TQLabel(tr("To play with "), this);
hst = new TQComboBox(TRUE, this);
hst->setValidator(new TQRegExpValidator(
TQRegExp("([a-zA-Z0-9]*\\.)*[a-zA-Z]"), hst));
btn = new TQButtonGroup(tr("Choose your game"), this);
wg = new TQRadioButton(tr("White game"), btn);
bg = new TQRadioButton(tr("Black game"), btn);
box = new TQGroupBox(this);
Ok = new TQPushButton(tr("Play!"), box);
Cancel = new TQPushButton(tr("Cancel"), box);
resize(400, TQFontMetrics(font()).lineSpacing() * 7);
setMinimumSize(size());
setMaximumSize(size());
TQObject::connect(Ok, SIGNAL(clicked()), this, SLOT(accept()));
TQObject::connect(Cancel, SIGNAL(clicked()), this, SLOT(reject()));
TQObject::connect(wg, SIGNAL(clicked()), this, SLOT(checkParams()));
TQObject::connect(bg, SIGNAL(clicked()), this, SLOT(checkParams()));
TQObject::connect(hst, SIGNAL(textChanged(const TQString&)),
this, SLOT(checkParams(const TQString&)));
checkParams();
}
SelectGame::~SelectGame()
{
delete Cancel;
delete Ok;
delete box;
delete bg;
delete wg;
delete btn;
delete hst;
delete l1;
}
void
SelectGame::resizeEvent(TQResizeEvent *e)
{
TQFontMetrics fm(font());
int w = e->size().width(),
h = e->size().height(),
fh = fm.lineSpacing() + 2,
bl;
TQDialog::resizeEvent(e);
l1->setGeometry(0, 0, fm.width(l1->text()) + 20, fh);
hst->move(l1->x() + l1->width(), l1->y());
hst->resize(w - hst->x(), l1->height());
btn->move(l1->x(), l1->y() + l1->height());
btn->resize(w, l1->height() * 3 + 2);
wg->setGeometry(2, fh, btn->width() - 4, fh);
bg->setGeometry(wg->x(), wg->y() + wg->height(),
wg->width(), wg->height());
box->move(btn->x(), btn->y() + btn->height());
box->resize(w, h - box->y());
bl = box->width() / 5;
Ok->move(bl, 4);
Ok->resize(bl, box->height() - Ok->y() * 2);
Cancel->setGeometry(Ok->x() + Ok->width() + bl, Ok->y(),
Ok->width(), Ok->height());
}
void
SelectGame::checkParams()
{
bool res;
res = !hst->currentText().isEmpty() &&
(bg->isChecked() || wg->isChecked());
Ok->setEnabled(res);
}
void
SelectGame::checkParams(const TQString&)
{
checkParams();
}
TQString
SelectGame::host()
{
TQString h(hst->currentText());
return h.left(h.findRev(':'));
}
TQStringList
SelectGame::hosts()
{
TQStringList lst;
int i, cnt;
cnt = hst->count();
lst += host();
for (i = 0; i < cnt; i++)
lst += hst->text(i);
return (lst);
}
void
SelectGame::setHosts(const TQStringList &h)
{
hst->insertStringList(h);
}
GameBoard::GameType
SelectGame::gameType()
{
GameBoard::GameType gt;
if (wg->isChecked())
gt = GameBoard::WHITE;
else if (bg->isChecked())
gt = GameBoard::BLACK;
else
gt = GameBoard::NOGAME;
return (gt);
}
#include "mainwindow.moc"

@ -0,0 +1,87 @@
/*
* $Id: mainwindow.h,v 0.1 2005/01/08 12:20:13 denis Exp $
*
* Author: Denis Kozadaev (denis@tambov.ru)
* Description:
*
* See also: style(9)
*
* Hacked by:
*/
#ifndef __MAIN_WINDOW_H__
#define __MAIN_WINDOW_H__
#include <ntqmainwindow.h>
#include <ntqpopupmenu.h>
#include <ntqworkspace.h>
#include <ntqdialog.h>
#include <ntqlabel.h>
#include <ntqcombobox.h>
#include <ntqbuttongroup.h>
#include <ntqradiobutton.h>
#include <ntqgroupbox.h>
#include <ntqpushbutton.h>
#include <stdlib.h>
#include "gamesocket.h"
#include "gameboard.h"
class MainWindow:public TQMainWindow
{
Q_OBJECT
public:
MainWindow(TQWidget *parent = NULL, const char *name = NULL);
~MainWindow();
bool sockOk()const{return (sock->ok());}
private:
int id;
TQString ready_txt;
TQPopupMenu *game, *help;
TQWorkspace *wrk;
GameSocket *sock;
TQStringList hosts;
private slots:
void showStatus(const TQString&);
void newGame();
void newGame(int);
void about();
void activated(TQWidget *);
void saveImage();
};
//-----------------------------------------------------------------------------
class SelectGame:public TQDialog
{
Q_OBJECT
public:
SelectGame(TQWidget *parent = NULL, const char *name = NULL);
~SelectGame();
void setHosts(const TQStringList &);
TQString host();
TQStringList hosts();
GameBoard::GameType gameType();
private:
TQLabel *l1;
TQComboBox *hst;
TQButtonGroup *btn;
TQRadioButton *wg, *bg;
TQGroupBox *box;
TQPushButton *Ok, *Cancel;
protected:
void resizeEvent(TQResizeEvent *);
private slots:
void checkParams();
void checkParams(const TQString&);
};
#endif /* __MAIN_WINDOW_H__ */

@ -0,0 +1,46 @@
/* XPM */
static const char *black_bishop[]={
"40 40 3 1",
". c None",
"# c #000000",
"a c #ffffff",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"...................##...................",
"..................####..................",
".................######.................",
"..................####..................",
"..................####..................",
".................######.................",
"...............##########...............",
"..............############..............",
".............##############.............",
"............#######aa#######............",
"...........########aa########...........",
"...........########aa########...........",
"..........######aaaaaaaa######..........",
"..........######aaaaaaaa######..........",
"..........#########aa#########..........",
"...........########aa########...........",
"...........########aa########...........",
"............################............",
".............##############.............",
"..............############..............",
"...............aaaaaaaaaa...............",
"..............############..............",
".............##############.............",
"..............############..............",
"...............a########a...............",
"...............#aaaaaaaa#...............",
"..........####################..........",
".........######################.........",
"........###########..###########........",
"........##########....##########........",
".........########......########.........",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,46 @@
/* XPM */
static const char *black_castle[]={
"40 40 3 1",
". c None",
"# c #000000",
"a c #ffffff",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"..........#####...####...#####..........",
"..........#####...####...#####..........",
"..........#####...####...#####..........",
"..........####################..........",
"..........####################..........",
"...........##################...........",
"............##aaaaaaaaaaaa##............",
".............##############.............",
"..............############..............",
"..............##aaaaaaaa##..............",
"..............############..............",
"..............############..............",
"..............############..............",
"..............############..............",
"..............############..............",
"..............############..............",
"..............############..............",
"..............############..............",
"..............############..............",
"..............############..............",
"..............##aaaaaaaa##..............",
"..............############..............",
".............##aaaaaaaaaa##.............",
"............################............",
"...........##################...........",
"..........##aaaaaaaaaaaaaaaa##..........",
"..........####################..........",
".........######################.........",
".........######################.........",
".........######################.........",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,46 @@
/* XPM */
static const char *black_king[]={
"40 40 3 1",
". c None",
"# c #000000",
"a c #ffffff",
"........................................",
"........................................",
"........................................",
"........................................",
"...................##...................",
"...................##...................",
".................######.................",
".................######.................",
"...................##...................",
"...................##...................",
"........####.......##.......####........",
"......########....#aa#....########......",
".....##########..#a##a#..##########.....",
".....####aaaa####a####a####aaaa####.....",
"....####a####a###a####a###a####a####....",
"....###a######a###a##a###a######a###....",
"....###a#######a###aa###a#######a###....",
"....###a########a##aa##a########a###....",
".....##a#########a####a#########a##.....",
".....###a########a####a########a###.....",
".....###a#########a##a#########a###.....",
"......##a#########a##a#########a##......",
"......###a########a##a########a###......",
".......##a########a##a########a##.......",
".......###a#######a##a#######a###.......",
"........###a######a##a######a###........",
".........###a#####a##a#####a###.........",
"..........###aaaaaaaaaaaaaa###..........",
"..........aaa##############aaa..........",
"..........####################..........",
".........######aaaaaaaaaa######.........",
"........####aaa##########aaa####........",
"........aaaa################aaaa........",
"........########################........",
"........########################........",
"........########################........",
".........######################.........",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,46 @@
/* XPM */
static const char *black_knight[]={
"40 40 3 1",
". c None",
"# c #000000",
"a c #ffffff",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"................#...#...................",
"...............###.###..................",
"...............###.###..................",
"..............####a###..................",
".............###aa#####.................",
"............###a#########...............",
"...........###############..............",
"..........############a####.............",
".........####aaa#######a####............",
".........###aaa#########a####...........",
"........#################a####..........",
"........##################a###..........",
".......###################a####.........",
".......####################a###.........",
"......######################a###........",
".....################.#####a####........",
"....##aa###########...######a###........",
"....##############...########a###.......",
"....#####a#######...########a####.......",
"....####aa#####....##########a###.......",
".....#aaa####.....############a###......",
".......a####....#############a####......",
"......#####....###############a###......",
".......##.....###############a####......",
".............#################a###......",
"............#################a####......",
"...........###################a###......",
"...........#######################......",
"...........#######################......",
"...........#######################......",
"...........######################.......",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,45 @@
/* XPM */
static const char *black_pawn[]={
"40 40 2 1",
". c None",
"# c #000000",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"..................####..................",
".................######.................",
"................########................",
"...............##########...............",
"...............##########...............",
"...............##########...............",
"................########................",
"................########................",
"...............##########...............",
"..............############..............",
".............##############.............",
".............##############.............",
".............##############.............",
"..............############..............",
"...............##########...............",
"..............############..............",
".............##############.............",
"............################............",
"............################............",
"...........##################...........",
"...........##################...........",
"..........####################..........",
"..........####################..........",
"..........####################..........",
"..........####################..........",
"..........####################..........",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,46 @@
/* XPM */
static const char *black_queen[]={
"40 40 3 1",
". c None",
"# c #000000",
"a c #ffffff",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"...................##...................",
"...........##.....####.....##...........",
"..........####....####....####..........",
"..........####.....##.....####..........",
"...........##......##......##...........",
"...##......##......##......##......##...",
"..####.....##.....####.....##.....####..",
"..####.....###....####....###.....####..",
"...##......###....####....###......##...",
"....#......###....####....###......#....",
"....##.....####...####...####.....##....",
"....###....####...####...####....###....",
"....####...####...####...####...####....",
".....###...####..######..####...###.....",
".....####..#####.######.#####..####.....",
"......####.#####.######.#####.####......",
"......##########.######.##########......",
"......############################......",
".......##########################.......",
".......########aaaaaaaaaa########.......",
"........##aaaaa##########aaaaa##........",
"........#a####################a#........",
".........######################.........",
".........######aaaaaaaaaa######.........",
".........#aaaaa##########aaaaa#.........",
".........######################.........",
"........#######aaaaaaaaaa#######........",
"........#aaaaaa##########aaaaaa#........",
"........########################........",
"........########################........",
".........######################.........",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,46 @@
/* XPM */
static const char *chess_xpm[]={
"40 40 3 1",
"# c #000000",
"a c #ffffff",
". c none",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"..........#####...####...#####..........",
"..........#aaa#...#aa#...#aaa#..........",
"..........#aaa#...#aa#...#aaa#..........",
"..........#aaaa###aaaa###aaaa#..........",
"..........#aaaaaaaaaaaaaaaaaa#..........",
"...........#aaaaaaaaaaaaaaaa#...........",
"............#a############a#............",
".............#aaaaaaaaaaaa#.............",
"..............#aaaaaaaaaa#..............",
"..............#.########.#..............",
"..............#.########.#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
".............#a##########a#.............",
"............#aaaaaaaaaaaaaa#............",
"...........#aaaaaaaaaaaaaaaa#...........",
"..........#a################a#..........",
"..........#aaaaaaaaaaaaaaaaaa#..........",
".........#aaaaaaaaaaaaaaaaaaaa#.........",
".........#aaaaaaaaaaaaaaaaaaaa#.........",
".........######################.........",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,65 @@
/* XPM */
static const char *new_game[] = {
/* width height num_colors chars_per_pixel */
" 50 50 8 1",
/* colors */
". c #040204",
"# c #8cdef4",
"a c #749edc",
"b c #84a6f4",
"c c #0c0a0c",
"d c #6c96fa",
"e c #040604",
"f c #0c0e0c",
/* pixels */
"..................................................",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"c######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"c######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"e######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"c######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"c######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"c######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"e######bbbbba######abbbaa#######bbbaab######bbbbaa",
"e######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"c######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"c######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"c######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"c######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"c######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
".######aaaaaa######aaaaaa#######aaaaaa######aaaaaa",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
".aaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######",
"eaaaaaa######aaaaaa######aaaaaaa######aaaaaa######"
};

@ -0,0 +1,68 @@
/* XPM */
static const char *quit_xpm[]={
"22 22 43 1",
"e c #a4140a",
"# c #a41c0b",
"m c #a92415",
"x c #ac2a1c",
"d c #ac2f21",
"b c #b23628",
"c c #b33b2e",
"a c #b44234",
"o c #bc421c",
"p c #bc5732",
"C c #bc5e04",
"q c #c0603a",
"h c #c07e5c",
"s c #c46f4a",
"g c #c47852",
"J c #cc7350",
"i c #cc825c",
"j c #cc8a63",
"k c #cc8f66",
"r c #d4976b",
"l c #d49e77",
"O c #d8cecc",
"F c #d99979",
"K c #dca47c",
"N c #dca684",
"f c #ddab91",
"n c #e2b59a",
"t c #e4d2c4",
"M c #e7e5ea",
"G c #ebf3f9",
"I c #ececf2",
"v c #ecfafc",
"w c #efcbb7",
"D c #f1c5b4",
"z c #f4eef4",
"B c #f4f6fc",
"y c #f8d5c8",
"L c #f9e4d8",
"H c #fcece2",
"E c #fcf2e4",
"A c #fcfed0",
"u c #fcfefc",
". c None",
"...#aabcccdbdddddde...",
".bbfggghgghijjikkjlmm.",
".bbfggghgghijjikkjlmm.",
"ennoppppqqkrsssssghlle",
"chhpppstuuuuvvwiihhrrx",
"chhpppstuuuuvvwiihhrrx",
"bggpssuuyylnzzABBjhrrm",
"dhhCttufsswDggnuuwjkkm",
"chhguuysggEEgghEEujrrm",
"chhguuysggEEgghEEujrrm",
"dhhkuursssEEhhiDDvlrr#",
"bhhFuuFgggGEiiiwwufll#",
"djjhBBtgggHEhhkIIAlll#",
"djjhBBtgggHEhhkIIAlll#",
"diiJEEuKhhLtjjDuuMlll#",
"djjskkBuyynfLLBuullNN#",
"djjskkBuyynfLLBuullNN#",
"djjgggiLuuuuuuLlllfNN#",
"eKKhhhijkkfnrrlNNfOgge",
".mmKkkrkrrllllKKKfgee.",
".mmKkkrkrrllllKKKfgee.",
"...exxmm##m######ee..."};

@ -0,0 +1,46 @@
/* XPM */
static const char *white_bishop[]={
"40 40 3 1",
". c None",
"# c #000000",
"a c #ffffff",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"...................##...................",
"..................#aa#..................",
".................#aaaa#.................",
"..................#aa#..................",
"..................####..................",
".................#aaaa#.................",
"...............##aaaaaa##...............",
"..............#aaaaaaaaaa#..............",
".............#aaaaaaaaaaaa#.............",
"............#aaaaaa##aaaaaa#............",
"...........#aaaaaaa##aaaaaaa#...........",
"...........#aaaaaaa##aaaaaaa#...........",
"..........#aaaaa########aaaaa#..........",
"..........#aaaaa########aaaaa#..........",
"..........#aaaaaaaa##aaaaaaaa#..........",
"...........#aaaaaaa##aaaaaaa#...........",
"...........#aaaaaaa##aaaaaaa#...........",
"............#aaaaaaaaaaaaaa#............",
".............#aaaaaaaaaaaa#.............",
"..............#aaaaaaaaaa#..............",
"...............##########...............",
"..............#aaaaaaaaaa#..............",
".............#aaaaaaaaaaaa#.............",
"..............#aaaaaaaaaa#..............",
"...............#aaaaaaaa#...............",
"...............##########...............",
"..........#####aaaaaaaaaa#####..........",
".........#aaaaaaaaa##aaaaaaaaa#.........",
"........#aaaaaaaaa#..#aaaaaaaaa#........",
"........#aaaaaaaa#....#aaaaaaaa#........",
".........########......########.........",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,46 @@
/* XPM */
static const char *white_castle[]={
"40 40 3 1",
". c None",
"# c #000000",
"a c #ffffff",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"..........#####...####...#####..........",
"..........#aaa#...#aa#...#aaa#..........",
"..........#aaa#...#aa#...#aaa#..........",
"..........#aaaa###aaaa###aaaa#..........",
"..........#aaaaaaaaaaaaaaaaaa#..........",
"...........#aaaaaaaaaaaaaaaa#...........",
"............#a############a#............",
".............#aaaaaaaaaaaa#.............",
"..............#aaaaaaaaaa#..............",
"..............#a########a#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#aaaaaaaaaa#..............",
"..............#a########a#..............",
"..............#aaaaaaaaaa#..............",
".............#a##########a#.............",
"............#aaaaaaaaaaaaaa#............",
"...........#aaaaaaaaaaaaaaaa#...........",
"..........#a################a#..........",
"..........#aaaaaaaaaaaaaaaaaa#..........",
".........#aaaaaaaaaaaaaaaaaaaa#.........",
".........#aaaaaaaaaaaaaaaaaaaa#.........",
".........######################.........",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,46 @@
/* XPM */
static const char *white_king[]={
"40 40 3 1",
". c None",
"# c #000000",
"a c #ffffff",
"........................................",
"........................................",
"........................................",
"........................................",
"...................##...................",
"...................##...................",
".................##aa##.................",
".................##aa##.................",
"...................##...................",
"...................##...................",
"........####.......##.......####........",
"......##aaaa##....####....##aaaa##......",
".....#aaaaaaaa#..##aa##..#aaaaaaaa#.....",
".....#aaa####aa###aaaa###aa####aaa#.....",
"....#aaa#aaaa#aa##aaaa##aa#aaaa#aaa#....",
"....#aa#aaaaaa#aa##aa##aa#aaaaaa#aa#....",
"....#aa#aaaaaaa#aa####aa#aaaaaaa#aa#....",
"....#aa#aaaaaaaa#aa##aa#aaaaaaaa#aa#....",
".....#a#aaaaaaaaa#aaaa#aaaaaaaaa#a#.....",
".....#aa#aaaaaaaa#aaaa#aaaaaaaa#aa#.....",
".....#aa#aaaaaaaaa#aa#aaaaaaaaa#aa#.....",
"......#a#aaaaaaaaa#aa#aaaaaaaaa#a#......",
"......#aa#aaaaaaaa#aa#aaaaaaaa#aa#......",
".......#a#aaaaaaaa#aa#aaaaaaaa#a#.......",
".......#aa#aaaaaaa#aa#aaaaaaa#aa#.......",
"........#aa#aaaaaa#aa#aaaaaa#aa#........",
".........#aa#aaaaa#aa#aaaaa#aa#.........",
"..........#aa##############aa#..........",
"..........###aaaaaaaaaaaaaa###..........",
"..........#aaaaaaaaaaaaaaaaaa#..........",
".........#aaaaa##########aaaaa#.........",
"........#aaa###aaaaaaaaaa###aaa#........",
"........####aaaaaaaaaaaaaaaa####........",
"........#aaaaaaaaaaaaaaaaaaaaaa#........",
"........#aaaaaaaaaaaaaaaaaaaaaa#........",
"........##aaaaaaaaaaaaaaaaaaaa##........",
".........######################.........",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,46 @@
/* XPM */
static const char *white_knight[]={
"40 40 3 1",
". c None",
"# c #000000",
"a c #ffffff",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"................#...#...................",
"...............#a#.#a#..................",
"...............#a#.#a#..................",
"..............#aaa#aa#..................",
".............#aa##aaa##.................",
"............#aa#aaaaaaa##...............",
"...........#aaaaaaaaaaaaa#..............",
"..........#aaaaaaaaaaa#aaa#.............",
".........#aaa###aaaaaaa#aaa#............",
".........#aa###aaaaaaaaa#aaa#...........",
"........#aaaaaaaaaaaaaaaa#aaa#..........",
"........#aaaaaaaaaaaaaaaaa#aa#..........",
".......#aaaaaaaaaaaaaaaaaa#aaa#.........",
".......#aaaaaaaaaaaaaa#aaaa#aa#.........",
"......#aaaaaaaaaaaaaa##aaaaa#aa#........",
".....#aaaaaaaaaaaaa##.#aaaa#aaa#........",
"....#a##aaaaaaaaaa#...#aaaaa#aa#........",
"....#aaaaaaaaaaaa#...#aaaaaaa#aa#.......",
"....#aaaa#aaaaa##...#aaaaaaa#aaa#.......",
"....#aaa##aaa##....#aaaaaaaaa#aa#.......",
".....####aaa#.....#aaaaaaaaaaa#aa#......",
".......#aaa#....##aaaaaaaaaaa#aaa#......",
"......#aa##....#aaaaaaaaaaaaaa#aa#......",
".......##.....#aaaaaaaaaaaaaa#aaa#......",
".............#aaaaaaaaaaaaaaaa#aa#......",
"............#aaaaaaaaaaaaaaaa#aaa#......",
"...........#aaaaaaaaaaaaaaaaaa#aa#......",
"...........#aaaaaaaaaaaaaaaaaaaaa#......",
"...........#aaaaaaaaaaaaaaaaaaaaa#......",
"...........#aaaaaaaaaaaaaaaaaaaaa#......",
"...........######################.......",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,46 @@
/* XPM */
static const char *white_pawn[]={
"40 40 3 1",
". c None",
"# c #000000",
"a c #ffffff",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"..................####..................",
".................#aaaa#.................",
"................#aaaaaa#................",
"...............#aaaaaaaa#...............",
"...............#aaaaaaaa#...............",
"...............#aaaaaaaa#...............",
"................#aaaaaa#................",
"................##aaaa##................",
"...............#aaaaaaaa#...............",
"..............#aaaaaaaaaa#..............",
".............#aaaaaaaaaaaa#.............",
".............#aaaaaaaaaaaa#.............",
".............#aaaaaaaaaaaa#.............",
"..............#aaaaaaaaaa#..............",
"...............#aaaaaaaa#...............",
"..............#aaaaaaaaaa#..............",
".............#aaaaaaaaaaaa#.............",
"............#aaaaaaaaaaaaaa#............",
"............#aaaaaaaaaaaaaa#............",
"...........#aaaaaaaaaaaaaaaa#...........",
"...........#aaaaaaaaaaaaaaaa#...........",
"..........#aaaaaaaaaaaaaaaaaa#..........",
"..........#aaaaaaaaaaaaaaaaaa#..........",
"..........#aaaaaaaaaaaaaaaaaa#..........",
"..........#aaaaaaaaaaaaaaaaaa#..........",
"..........####################..........",
"........................................",
"........................................",
"........................................"};

@ -0,0 +1,46 @@
/* XPM */
static const char *white_queen[]={
"40 40 3 1",
". c None",
"# c #000000",
"a c #ffffff",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"........................................",
"...................##...................",
"...........##.....#aa#.....##...........",
"..........#aa#....#aa#....#aa#..........",
"..........#aa#.....##.....#aa#..........",
"...........##......##......##...........",
"...##......##......##......##......##...",
"..#aa#.....##.....#aa#.....##.....#aa#..",
"..#aa#.....#a#....#aa#....#a#.....#aa#..",
"...##......#a#....#aa#....#a#......##...",
"....#......#a#....#aa#....#a#......#....",
"....##.....#aa#...#aa#...#aa#.....##....",
"....#a#....#aa#...#aa#...#aa#....#a#....",
"....#aa#...#aa#...#aa#...#aa#...#aa#....",
".....#a#...#aa#..#aaaa#..#aa#...#a#.....",
".....#aa#..#aaa#.#aaaa#.#aaa#..#aa#.....",
"......#aa#.#aaa#.#aaaa#.#aaa#.#aa#......",
"......#aaa##aaa#.#aaaa#.#aaa##aaa#......",
"......#aaaa#aaaa#aaaaaa#aaaa#aaaa#......",
".......#aaaaaaaaaaaaaaaaaaaaaaaa#.......",
".......#aaaaaaa##########aaaaaaa#.......",
"........#a#####aaaaaaaaaa#####a#........",
"........##aaaaaaaaaaaaaaaaaaaa##........",
".........#aaaaaaaaaaaaaaaaaaaa#.........",
".........#aaaaa##########aaaaa#.........",
".........######aaaaaaaaaa######.........",
".........#aaaaaaaaaaaaaaaaaaaa#.........",
"........#aaaaaa##########aaaaaa#........",
"........#######aaaaaaaaaa#######........",
"........#aaaaaaaaaaaaaaaaaaaaaa#........",
"........#aaaaaaaaaaaaaaaaaaaaaa#........",
".........######################.........",
"........................................",
"........................................",
"........................................"};
Loading…
Cancel
Save