Simple setup
This commit is contained in:
@@ -27,7 +27,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
# Define the project name
|
# Define the project name
|
||||||
project(basic-c-sdl-game)
|
project(lettergame)
|
||||||
|
|
||||||
# Set the cmake minimum version to 3.5.1
|
# Set the cmake minimum version to 3.5.1
|
||||||
cmake_minimum_required(VERSION 3.5.1)
|
cmake_minimum_required(VERSION 3.5.1)
|
||||||
@@ -52,20 +52,20 @@ find_package(SDL2 REQUIRED)
|
|||||||
target_link_libraries(${PROJECT_NAME} SDL2::Main)
|
target_link_libraries(${PROJECT_NAME} SDL2::Main)
|
||||||
|
|
||||||
# Add SDL2_image library
|
# Add SDL2_image library
|
||||||
#find_package(SDL2_image REQUIRED)
|
find_package(SDL2_image REQUIRED)
|
||||||
#target_link_libraries(${PROJECT_NAME} SDL2::Image)
|
target_link_libraries(${PROJECT_NAME} SDL2::Image)
|
||||||
|
|
||||||
# Add SDL2_ttf library
|
# Add SDL2_ttf library
|
||||||
#find_package(SDL2_ttf REQUIRED)
|
find_package(SDL2_ttf REQUIRED)
|
||||||
#target_link_libraries(${PROJECT_NAME} SDL2::TTF)
|
target_link_libraries(${PROJECT_NAME} SDL2::TTF)
|
||||||
|
|
||||||
# Add SDL2_net library
|
# Add SDL2_net library
|
||||||
#find_package(SDL2_net REQUIRED)
|
find_package(SDL2_net REQUIRED)
|
||||||
#target_link_libraries(${PROJECT_NAME} SDL2::Net)
|
target_link_libraries(${PROJECT_NAME} SDL2::Net)
|
||||||
|
|
||||||
# Add SDL2_mixer library
|
# Add SDL2_mixer library
|
||||||
#find_package(SDL2_mixer REQUIRED)
|
find_package(SDL2_mixer REQUIRED)
|
||||||
#target_link_libraries(${PROJECT_NAME} SDL2::Mixer)
|
target_link_libraries(${PROJECT_NAME} SDL2::Mixer)
|
||||||
|
|
||||||
# Add SDL2_gfx library
|
# Add SDL2_gfx library
|
||||||
find_package(SDL2_gfx REQUIRED)
|
find_package(SDL2_gfx REQUIRED)
|
||||||
|
|||||||
14
IDE_USAGE.md
14
IDE_USAGE.md
@@ -44,7 +44,7 @@ sudo apt install codeblocks
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Create a folder for the Code::Blocks project
|
# Create a folder for the Code::Blocks project
|
||||||
cd basic-c-sdl-game
|
cd lettergame
|
||||||
mkdir -p build/codeblocks
|
mkdir -p build/codeblocks
|
||||||
cd build/codeblocks
|
cd build/codeblocks
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ cmake ../.. -G "CodeBlocks - Unix Makefiles"
|
|||||||
```
|
```
|
||||||
|
|
||||||
*Open the project:*<br>
|
*Open the project:*<br>
|
||||||
Run Code::Blocks, and open the project in `basic-c-sdl-game/build/codeblocks`.<br>
|
Run Code::Blocks, and open the project in `lettergame/build/codeblocks`.<br>
|
||||||
Finally, build and run the project.
|
Finally, build and run the project.
|
||||||
|
|
||||||
|
|
||||||
@@ -72,15 +72,15 @@ Offline package: https://www.eclipse.org/downloads/packages
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Create a folder for the Eclipse project outside this project
|
# Create a folder for the Eclipse project outside this project
|
||||||
cd basic-c-sdl-game
|
cd lettergame
|
||||||
mkdir ../eclipse-basic-c-sdl-game
|
mkdir ../eclipse-lettergame
|
||||||
cd ../eclipse-basic-c-sdl-game
|
cd ../eclipse-lettergame
|
||||||
|
|
||||||
# Generate an Eclipse project
|
# Generate an Eclipse project
|
||||||
cmake ../basic-c-sdl-game -G "Eclipse CDT4 - Unix Makefiles"
|
cmake ../lettergame -G "Eclipse CDT4 - Unix Makefiles"
|
||||||
```
|
```
|
||||||
*Open the project:*<br>
|
*Open the project:*<br>
|
||||||
Run Eclipse, and open the project in `eclipse-basic-c-sdl-game`.<br>
|
Run Eclipse, and open the project in `eclipse-lettergame`.<br>
|
||||||
Create a new run configuration: Go to `Run` > `Run configurations` >
|
Create a new run configuration: Go to `Run` > `Run configurations` >
|
||||||
`C\C++ Application` and specify the C/C++ Application using `Search Project...`<br>
|
`C\C++ Application` and specify the C/C++ Application using `Search Project...`<br>
|
||||||
Finally, build and run the project.
|
Finally, build and run the project.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Basic C SDL2 game
|
# lettergamecore
|
||||||
|
|
||||||
This project is a basic C [SDL2][SDL] game that uses [CMake][] as a build system.<br>
|
This project is a basic C [SDL2][SDL] game that uses [CMake][] as a build system.<br>
|
||||||
It shows how we can develop a basic grid-based game.
|
It shows how we can develop a basic grid-based game.
|
||||||
@@ -39,8 +39,8 @@ sudo apt install libsdl2-image-dev libsdl2-ttf-dev libsdl2-net-dev libsdl2-mixer
|
|||||||
|
|
||||||
```sh
|
```sh
|
||||||
# Clone this repo
|
# Clone this repo
|
||||||
git clone https://gitlab.com/aminosbh/basic-c-sdl-game.git
|
git clone https://gitlab.com/aminosbh/lettergame.git
|
||||||
cd basic-c-sdl-game
|
cd lettergame
|
||||||
|
|
||||||
# Create a build folder
|
# Create a build folder
|
||||||
mkdir build
|
mkdir build
|
||||||
@@ -51,7 +51,7 @@ cmake ..
|
|||||||
make
|
make
|
||||||
|
|
||||||
# Run
|
# Run
|
||||||
./basic-c-sdl-game
|
./lettergame
|
||||||
```
|
```
|
||||||
|
|
||||||
***Note:*** To use SDL2_image, SDL2_ttf, SDL2_net or SDL2_mixer, you should
|
***Note:*** To use SDL2_image, SDL2_ttf, SDL2_net or SDL2_mixer, you should
|
||||||
|
|||||||
@@ -87,9 +87,9 @@ echo
|
|||||||
echo -e "\e[31mDo you confirm your modifications ? [y/N]\e[0m"
|
echo -e "\e[31mDo you confirm your modifications ? [y/N]\e[0m"
|
||||||
read RENAME_PROJECT
|
read RENAME_PROJECT
|
||||||
if [ -n "$RENAME_PROJECT" ] && [ "$(echo "$RENAME_PROJECT" | tr a-z A-Z)" = "Y" ]; then
|
if [ -n "$RENAME_PROJECT" ] && [ "$(echo "$RENAME_PROJECT" | tr a-z A-Z)" = "Y" ]; then
|
||||||
sed -i "s/Basic C SDL2 game/${PROJECT_NAME}/g" README.md rename_project.sh
|
sed -i "s/lettergamecore/${PROJECT_NAME}/g" README.md rename_project.sh
|
||||||
sed -i "s/basic-c-sdl-game/${PROJECT_EXECUTABLE_NAME}/g" README.md IDE_USAGE.md CMakeLists.txt rename_project.sh
|
sed -i "s/lettergame/${PROJECT_EXECUTABLE_NAME}/g" README.md IDE_USAGE.md CMakeLists.txt rename_project.sh
|
||||||
sed -i "s;https://gitlab.com/aminosbh/basic-c-sdl-game.git;${PROJECT_GIT_REPO};g" README.md rename_project.sh
|
sed -i "s;https://gitlab.com/aminosbh/lettergame.git;${PROJECT_GIT_REPO};g" README.md rename_project.sh
|
||||||
echo -e "\e[32mThe project was successfully renamed\e[0m"
|
echo -e "\e[32mThe project was successfully renamed\e[0m"
|
||||||
else
|
else
|
||||||
echo -e "\e[33mOperation aborted\e[0m"
|
echo -e "\e[33mOperation aborted\e[0m"
|
||||||
|
|||||||
Reference in New Issue
Block a user