Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded Snake Game #4

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9e73ac2
added menu,difficult and settings
StasDzundza Mar 24, 2019
3f4b747
added leaderboard(almost work).Should solve read from .bin file
StasDzundza Mar 25, 2019
65e7a68
added leaderboard(works)
StasDzundza Mar 25, 2019
9961148
added 2 types of food(make faster and make lower)
StasDzundza Mar 26, 2019
338d74b
added seed for random and improved food generation
StasDzundza Mar 26, 2019
326acd9
added stopwatch
StasDzundza Mar 26, 2019
a74914e
added new type of food and new system of scoring
StasDzundza Mar 26, 2019
5e9afe0
added creating wall
StasDzundza Mar 27, 2019
39e41bf
added comments for all code and improved game
StasDzundza Mar 27, 2019
d8365c7
...
StasDzundza Mar 27, 2019
797dca6
added google test project(empty)
StasDzundza Mar 28, 2019
5ffee49
add tests for class snake and leaderboard
StasDzundza Mar 28, 2019
ddf259b
added tests for food class and settings class
StasDzundza Mar 29, 2019
47125f9
add some tests for GameController class
StasDzundza Mar 29, 2019
b5396ed
writed test for GameController and added all tests for snake project
StasDzundza Mar 29, 2019
7177c07
included gtests to main project
StasDzundza Mar 29, 2019
2f513ea
added use case diagram
StasDzundza Mar 31, 2019
5fd5820
added class diagram
StasDzundza Mar 31, 2019
3aadfc4
added object diagram
StasDzundza Mar 31, 2019
b1dde64
added activity diagram
StasDzundza Mar 31, 2019
0bd81b0
added state machine diagram
StasDzundza Mar 31, 2019
784392b
added sequence diagram
StasDzundza Apr 1, 2019
87800d9
added Communication diagram
StasDzundza Apr 1, 2019
1e65370
added timing diagram
StasDzundza Apr 1, 2019
cbcf7a0
added interaction overview diagram
StasDzundza Apr 1, 2019
50ca768
added interaction overview diagram
StasDzundza Apr 1, 2019
ea432a4
added deployment diagram
StasDzundza Apr 1, 2019
6f9e31b
added component diagram
StasDzundza Apr 1, 2019
c2141e7
added package diagram
StasDzundza Apr 1, 2019
007088d
added profile diagram
StasDzundza Apr 1, 2019
a8e3082
added use case and class diagram
StasDzundza Apr 2, 2019
7a92455
fixed bug (crash game on play again click)
StasDzundza Apr 2, 2019
42b6bf6
fixed crash game after snake eat food
StasDzundza Apr 2, 2019
87d8d0a
added object diagram
StasDzundza Apr 2, 2019
9189bfa
added activity diagram
StasDzundza Apr 2, 2019
0980348
added state machine diagram
StasDzundza Apr 2, 2019
c84d62e
added sequence diagram
StasDzundza Apr 3, 2019
d9cf3ee
added communication diagram
StasDzundza Apr 3, 2019
e7e192c
added component diagram
StasDzundza Apr 3, 2019
b9b5843
added composite structure diagram
StasDzundza Apr 3, 2019
12d6e24
added deployment diagram
StasDzundza Apr 3, 2019
4b5f968
added interaction overview diagram
StasDzundza Apr 3, 2019
936ac8b
added package diagram
StasDzundza Apr 3, 2019
06d26b8
added profile diagram
StasDzundza Apr 3, 2019
164bfde
added timing diagram
StasDzundza Apr 3, 2019
08a590f
changed use case diagram
StasDzundza Apr 3, 2019
e29d5bb
changed timing diagram
StasDzundza Apr 3, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Makefile*
# QtCtreator CMake
CMakeLists.txt.user*

*.vpp*
.*vpp.*


# folders

debug/
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added New UML Diagrams/Images/Activity/Move.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added New UML Diagrams/Images/Activity/Saving score.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added New UML Diagrams/Images/Component/Component.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added New UML Diagrams/Images/Object/Object.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added New UML Diagrams/Images/Package/Package.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added New UML Diagrams/Images/Profile/Profile.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added New UML Diagrams/Images/Sequence/GameProcess.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added New UML Diagrams/Images/Sequence/stopwatch.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added New UML Diagrams/Images/State Machine/Move.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added New UML Diagrams/Images/Timing/Timing.jpg
Binary file added New UML Diagrams/Images/UseCase/New UseCase.jpg
Binary file added Old UML Diagrams/Images/Activity/Move.jpg
Binary file added Old UML Diagrams/Images/Package/Package.jpg
Binary file added Old UML Diagrams/Images/Profile/Profile.jpg
Binary file added Old UML Diagrams/Images/State Machine/Move.jpg
Binary file added Old UML Diagrams/Images/Timing/Game Process.jpg
Binary file added Old UML Diagrams/Images/UseCase/New UseCase.jpg
73 changes: 73 additions & 0 deletions Tests/TestsForSnakeProject/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------

*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash

# qtcreator generated files
*.pro.user*

# xemacs temporary files
*.flc

# Vim temporary files
.*.swp

# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*

# MinGW generated files
*.Debug
*.Release

# Python byte code
*.pyc

# Binaries
# --------
*.dll
*.exe

42 changes: 42 additions & 0 deletions Tests/TestsForSnakeProject/TestsForSnakeProject.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += console c++14

INCLUDEPATH += "../../"
INCLUDEPATH += "googletest"
INCLUDEPATH += "googletest/include"
INCLUDEPATH += "googlemock"
INCLUDEPATH += "googlemock/include"

SOURCES += \
main.cpp \
../../food.cpp \
../../gamecontroller.cpp \
../../gamewindow.cpp \
../../leaderboard.cpp \
../../mainwindow.cpp \
../../settings.cpp \
../../snake.cpp \
../../stopwatch.cpp \
../../wall.cpp \
googletest/src/gtest-all.cc \
googlemock/src/gmock-all.cc

FORMS += \
../../leaderboard.ui \
../../mainwindow.ui \
../../settings.ui

HEADERS += \
../../constants.h \
../../food.h \
../../gamecontroller.h \
../../gamewindow.h \
../../leaderboard.h \
../../mainwindow.h \
../../settings.h \
../../snake.h \
../../stopwatch.h \
../../wall.h
225 changes: 225 additions & 0 deletions Tests/TestsForSnakeProject/googlemock/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
########################################################################
# CMake build script for Google Mock.
#
# To run the tests for Google Mock itself on Linux, use 'make test' or
# ctest. You can select which tests to run using 'ctest -R regex'.
# For more options, run 'ctest --help'.

option(gmock_build_tests "Build all of Google Mock's own tests." OFF)

# A directory to find Google Test sources.
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/gtest/CMakeLists.txt")
set(gtest_dir gtest)
else()
set(gtest_dir ../googletest)
endif()

# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
include("${gtest_dir}/cmake/hermetic_build.cmake" OPTIONAL)

if (COMMAND pre_project_set_up_hermetic_build)
# Google Test also calls hermetic setup functions from add_subdirectory,
# although its changes will not affect things at the current scope.
pre_project_set_up_hermetic_build()
endif()

########################################################################
#
# Project-wide settings

# Name of the project.
#
# CMake files in this project can refer to the root source directory
# as ${gmock_SOURCE_DIR} and to the root binary directory as
# ${gmock_BINARY_DIR}.
# Language "C" is required for find_package(Threads).
if (CMAKE_VERSION VERSION_LESS 3.0)
project(gmock CXX C)
else()
cmake_policy(SET CMP0048 NEW)
project(gmock VERSION ${GOOGLETEST_VERSION} LANGUAGES CXX C)
endif()
cmake_minimum_required(VERSION 2.6.4)

if (COMMAND set_up_hermetic_build)
set_up_hermetic_build()
endif()

# Instructs CMake to process Google Test's CMakeLists.txt and add its
# targets to the current scope. We are placing Google Test's binary
# directory in a subdirectory of our own as VC compilation may break
# if they are the same (the default).
add_subdirectory("${gtest_dir}" "${gmock_BINARY_DIR}/gtest")


# These commands only run if this is the main project
if(CMAKE_PROJECT_NAME STREQUAL "gmock" OR CMAKE_PROJECT_NAME STREQUAL "googletest-distribution")
# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
# make it prominent in the GUI.
option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
else()
mark_as_advanced(gmock_build_tests)
endif()

# Although Google Test's CMakeLists.txt calls this function, the
# changes there don't affect the current scope. Therefore we have to
# call it again here.
config_compiler_and_linker() # from ${gtest_dir}/cmake/internal_utils.cmake

# Adds Google Mock's and Google Test's header directories to the search path.
set(gmock_build_include_dirs
"${gmock_SOURCE_DIR}/include"
"${gmock_SOURCE_DIR}"
"${gtest_SOURCE_DIR}/include"
# This directory is needed to build directly from Google Test sources.
"${gtest_SOURCE_DIR}")
include_directories(${gmock_build_include_dirs})

########################################################################
#
# Defines the gmock & gmock_main libraries. User tests should link
# with one of them.

# Google Mock libraries. We build them using more strict warnings than what
# are used for other targets, to ensure that Google Mock can be compiled by
# a user aggressive about warnings.
if (MSVC)
cxx_library(gmock
"${cxx_strict}"
"${gtest_dir}/src/gtest-all.cc"
src/gmock-all.cc)

cxx_library(gmock_main
"${cxx_strict}"
"${gtest_dir}/src/gtest-all.cc"
src/gmock-all.cc
src/gmock_main.cc)
else()
cxx_library(gmock "${cxx_strict}" src/gmock-all.cc)
target_link_libraries(gmock PUBLIC gtest)
cxx_library(gmock_main "${cxx_strict}" src/gmock_main.cc)
target_link_libraries(gmock_main PUBLIC gmock)
endif()
# If the CMake version supports it, attach header directory information
# to the targets for when we are part of a parent build (ie being pulled
# in via add_subdirectory() rather than being a standalone build).
if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
target_include_directories(gmock SYSTEM INTERFACE
"$<BUILD_INTERFACE:${gmock_build_include_dirs}>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
target_include_directories(gmock_main SYSTEM INTERFACE
"$<BUILD_INTERFACE:${gmock_build_include_dirs}>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/${CMAKE_INSTALL_INCLUDEDIR}>")
endif()

########################################################################
#
# Install rules
install_project(gmock gmock_main)

########################################################################
#
# Google Mock's own tests.
#
# You can skip this section if you aren't interested in testing
# Google Mock itself.
#
# The tests are not built by default. To build them, set the
# gmock_build_tests option to ON. You can do it by running ccmake
# or specifying the -Dgmock_build_tests=ON flag when running cmake.

if (gmock_build_tests)
# This must be set in the root directory for the tests to be run by
# 'make test' or ctest.
enable_testing()

if (WIN32)
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/RunTest.ps1"
CONTENT
"$project_bin = \"${CMAKE_BINARY_DIR}/bin/$<CONFIG>\"
$env:Path = \"$project_bin;$env:Path\"
& $args")
elseif (MINGW)
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/RunTest.ps1"
CONTENT
"$project_bin = (cygpath --windows ${CMAKE_BINARY_DIR}/bin)
$env:Path = \"$project_bin;$env:Path\"
& $args")
endif()

############################################################
# C++ tests built with standard compiler flags.

cxx_test(gmock-actions_test gmock_main)
cxx_test(gmock-cardinalities_test gmock_main)
cxx_test(gmock_ex_test gmock_main)
cxx_test(gmock-function-mocker_test gmock_main)
cxx_test(gmock-generated-actions_test gmock_main)
cxx_test(gmock-generated-function-mockers_test gmock_main)
cxx_test(gmock-generated-matchers_test gmock_main)
cxx_test(gmock-internal-utils_test gmock_main)
cxx_test(gmock-matchers_test gmock_main)
if (MINGW)
target_compile_options(gmock-matchers_test PRIVATE "-Wa,-mbig-obj")
endif()
cxx_test(gmock-more-actions_test gmock_main)
cxx_test(gmock-nice-strict_test gmock_main)
cxx_test(gmock-port_test gmock_main)
cxx_test(gmock-spec-builders_test gmock_main)
cxx_test(gmock_link_test gmock_main test/gmock_link2_test.cc)
cxx_test(gmock_test gmock_main)

if (DEFINED GTEST_HAS_PTHREAD)
cxx_test(gmock_stress_test gmock)
endif()

# gmock_all_test is commented to save time building and running tests.
# Uncomment if necessary.
# cxx_test(gmock_all_test gmock_main)

############################################################
# C++ tests built with non-standard compiler flags.

if (MSVC)
cxx_library(gmock_main_no_exception "${cxx_no_exception}"
"${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)

cxx_library(gmock_main_no_rtti "${cxx_no_rtti}"
"${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)

else()
cxx_library(gmock_main_no_exception "${cxx_no_exception}" src/gmock_main.cc)
target_link_libraries(gmock_main_no_exception PUBLIC gmock)

cxx_library(gmock_main_no_rtti "${cxx_no_rtti}" src/gmock_main.cc)
target_link_libraries(gmock_main_no_rtti PUBLIC gmock)
endif()
cxx_test_with_flags(gmock-more-actions_no_exception_test "${cxx_no_exception}"
gmock_main_no_exception test/gmock-more-actions_test.cc)

cxx_test_with_flags(gmock_no_rtti_test "${cxx_no_rtti}"
gmock_main_no_rtti test/gmock-spec-builders_test.cc)

cxx_shared_library(shared_gmock_main "${cxx_default}"
"${gtest_dir}/src/gtest-all.cc" src/gmock-all.cc src/gmock_main.cc)

# Tests that a binary can be built with Google Mock as a shared library. On
# some system configurations, it may not possible to run the binary without
# knowing more details about the system configurations. We do not try to run
# this binary. To get a more robust shared library coverage, configure with
# -DBUILD_SHARED_LIBS=ON.
cxx_executable_with_flags(shared_gmock_test_ "${cxx_default}"
shared_gmock_main test/gmock-spec-builders_test.cc)
set_target_properties(shared_gmock_test_
PROPERTIES
COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")

############################################################
# Python tests.

cxx_executable(gmock_leak_test_ test gmock_main)
py_test(gmock_leak_test)

cxx_executable(gmock_output_test_ test gmock)
py_test(gmock_output_test)
endif()
40 changes: 40 additions & 0 deletions Tests/TestsForSnakeProject/googlemock/CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This file contains a list of people who've made non-trivial
# contribution to the Google C++ Mocking Framework project. People
# who commit code to the project are encouraged to add their names
# here. Please keep the list sorted by first names.

Benoit Sigoure <[email protected]>
Bogdan Piloca <[email protected]>
Chandler Carruth <[email protected]>
Dave MacLachlan <[email protected]>
David Anderson <[email protected]>
Dean Sturtevant
Gene Volovich <[email protected]>
Hal Burch <[email protected]>
Jeffrey Yasskin <[email protected]>
Jim Keller <[email protected]>
Joe Walnes <[email protected]>
Jon Wray <[email protected]>
Keir Mierle <[email protected]>
Keith Ray <[email protected]>
Kostya Serebryany <[email protected]>
Lev Makhlis
Manuel Klimek <[email protected]>
Mario Tanev <[email protected]>
Mark Paskin
Markus Heule <[email protected]>
Matthew Simmons <[email protected]>
Mike Bland <[email protected]>
Neal Norwitz <[email protected]>
Nermin Ozkiranartli <[email protected]>
Owen Carlsen <[email protected]>
Paneendra Ba <[email protected]>
Paul Menage <[email protected]>
Piotr Kaminski <[email protected]>
Russ Rufer <[email protected]>
Sverre Sundsdal <[email protected]>
Takeshi Yoshino <[email protected]>
Vadim Berman <[email protected]>
Vlad Losev <[email protected]>
Wolfgang Klier <[email protected]>
Zhanyong Wan <[email protected]>
Loading