Browse Source

Re-write Code::Blocks template to work on Linux and Macos (#2073)

* update code::blocks example to support linux

* add macos support

* update screenshot

* update templates readme
pull/2076/head
Richard Smith 3 years ago
committed by GitHub
parent
commit
8e599908d9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 124 additions and 40 deletions
  1. +19
    -16
      projects/CodeBlocks/README.md
  2. BIN
      projects/CodeBlocks/compiler_settings.png
  3. +1
    -5
      projects/CodeBlocks/core_basic_window.c
  4. +103
    -18
      projects/CodeBlocks/core_basic_window.cbp
  5. +1
    -1
      projects/README.md

+ 19
- 16
projects/CodeBlocks/README.md View File

@ -1,16 +1,19 @@
# raylib for Code::Blocks
**by D3nX**
<br/>
Hey! Here it is a project template to use with `Code::Blocks` =)
<br/><br/>
First, you need to download the [raylib installer](https://www.raylib.com) and run it. It will install raylib with the compiler.
<br/><br/>
Then, download the template, and open the project with `Code::Blocks`.
Before running the template, make sure following set the raylib compiler for the IDE as show below:
<br>
![Compiler Settings](compiler_settings.png)
<br/>
Finally, you can run the program and enjoy raylib running on `Code::Blocks`!
<br /><br />
Hope it helped you =)
# Raylib template for Code::Blocks
1. Install Raylib. On Windows you must install the **Windows Installer (with MinGW compiler)** package. On other
platforms you can install however you like following the instructions in the wiki.
* https://github.com/raysan5/raylib/releases/download/3.7.0/raylib_installer_v370.mingw.exe
* https://github.com/raysan5/raylib/wiki/Working-on-GNU-Linux
* https://github.com/raysan5/raylib/wiki/Working-on-macOS
2. Install and run Code::Blocks.
3. **Windows only**: Select `Settings` `Compiler` `Toolchain executables`.
Change `Compiler's instrallation directory` to `C:\raylib\MingGW`. Do *not* press auto-detect. There is a screenshot
below showing how it should look. Press `OK`.
4. Select `File` `Open` and open the `core_basic_windows.cbp` file.
![Compiler Settings](compiler_settings.png)
For an example with resources, see https://github.com/electronstudio/raylib-game-template-codeblocks

BIN
projects/CodeBlocks/compiler_settings.png View File

Before After
Width: 787  |  Height: 583  |  Size: 70 KiB Width: 756  |  Height: 740  |  Size: 52 KiB

+ 1
- 5
projects/CodeBlocks/core_basic_window.c View File

@ -1,12 +1,8 @@
/*******************************************************************************************-lraylib -lglfw3 -lopengl32 -lgdi32 -lopenal32 -lwinmm
*
/*******************************************************************************************
* raylib [core] example - Basic window
*
* Welcome to raylib!
*
* To test examples, just press F6 and execute raylib_compile_execute script
* Note that compiled executable is placed in the same folder as .c file
*
* You can find all basic examples on C:\raylib\raylib\examples folder or
* raylib official webpage: www.raylib.com
*

+ 103
- 18
projects/CodeBlocks/core_basic_window.cbp View File

@ -2,51 +2,136 @@
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="core_basic_window" />
<Option title="raylib-game-template" />
<Option execution_dir="." />
<Option pch_mode="2" />
<Option compiler="gcc" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/core_basic_window" prefix_auto="1" extension_auto="1" />
<Target title="Debug (Mac)">
<Option platforms="Mac;" />
<Option output="bin/Debug/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
<Add directory="../../src" />
</Compiler>
<Linker>
<Add option="-lraylib -lopengl32 -lgdi32 -lwinmm" />
<Add library="../../src/libraylib.a" />
<Add library="raylib" />
<Add option="-framework OpenGL" />
<Add option="-framework Cocoa" />
<Add option="-framework IOKit" />
<Add option="-framework CoreAudio" />
<Add option="-framework CoreVideo" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin/Release/core_basic_window" prefix_auto="1" extension_auto="1" />
<Target title="Release (Mac)">
<Option platforms="Mac;" />
<Option output="bin/Release/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
<Add directory="../../src" />
</Compiler>
<Linker>
<Add option="-s" />
<Add option="-lraylib -lopengl32 -lgdi32 -lwinmm" />
<Add library="../../src/libraylib.a" />
<Add library="raylib" />
<Add option="-framework OpenGL" />
<Add option="-framework Cocoa" />
<Add option="-framework IOKit" />
<Add option="-framework CoreAudio" />
<Add option="-framework CoreVideo" />
</Linker>
</Target>
<Target title="Debug (Linux)">
<Option platforms="Unix;" />
<Option output="bin/Debug/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
<Linker>
<Add library="raylib" />
<Add library="GL" />
<Add library="m" />
<Add library="pthread" />
<Add library="dl" />
<Add library="rt" />
<Add library="X11" />
</Linker>
</Target>
<Target title="Release (Linux)">
<Option platforms="Unix;" />
<Option output="bin/Release/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="raylib" />
<Add library="GL" />
<Add library="m" />
<Add library="pthread" />
<Add library="dl" />
<Add library="rt" />
<Add library="X11" />
</Linker>
</Target>
<Target title="Debug (Windows)">
<Option platforms="Windows;" />
<Option output="bin/Debug/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Debug/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-g" />
</Compiler>
<Linker>
<Add library="raylib" />
<Add library="opengl32" />
<Add library="gdi32" />
<Add library="winmm" />
<Add option="-static" />
<Add library="pthread" />
</Linker>
</Target>
<Target title="Release (Windows)">
<Option platforms="Windows;" />
<Option output="bin/Release/raylib-game-template" prefix_auto="1" extension_auto="1" />
<Option working_dir="." />
<Option object_output="obj/Release/" />
<Option type="1" />
<Option compiler="gcc" />
<Compiler>
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="raylib" />
<Add library="opengl32" />
<Add library="gdi32" />
<Add library="winmm" />
<Add option="-static" />
<Add library="pthread" />
</Linker>
</Target>
</Build>
<Compiler>
<Add option="-Wall -std=c99" />
<Add option="-Wall" />
</Compiler>
<Unit filename="core_basic_window.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

+ 1
- 1
projects/README.md View File

@ -7,7 +7,7 @@ IDE | Platform(s) | Source | Example(s)
[4coder](http://4coder.net/) | Windows | ❌ | ✔️
[Builder](https://wiki.gnome.org/Apps/Builder) | Linux | ❌ | ✔️
[CMake](https://cmake.org/) | Windows, Linux, macOS | ✔️ | ✔️
[CodeBlocks](http://www.codeblocks.org/) | Windows, Linux | ❌ | ✔️
[CodeBlocks](http://www.codeblocks.org/) | Windows, Linux, macOS | ❌ | ✔️
[Geany](https://www.geany.org/) | Windows, Linux | ✔️ | ✔️
[Notepad++](https://notepad-plus-plus.org/) | Windows | ✔️ | ✔️
[SublimeText](https://www.sublimetext.com/) | Windows, Linux, macOS | ✔️ | ✔️

Loading…
Cancel
Save