Code Monkey home page Code Monkey logo

game-premake's Introduction

Raylib Setup using Premake5

This is a premake sript to build games with raylib. Premake works by creating a build system for different platforms to use. This setup is designed to work with the following platforms/compilers

Common Instructions

These steps setup the basic source code needed and are applied to all platforms.

Create a folder for your game

Create a folder for you game. It can be anywhere on your computer.

image

Download the Raylib Sources

Download the raylib source code, from https://github.com/raysan5/raylib You can get the zip file or clone the repository in git, both will work the same. Do not use the folder from the windows installer, it does not have the correct structure.

image

Copy Raylib into your game folder

Extract the zip file, or copy the cloned raylib repository into a folder named raylib in your game folder. source code.

image This folder should contain all the raylib source code files

Setup your game's source code

Make a folder for your actual game’s source code. In this case we will be starting with the “advanced game” template from the raylib sources, since it is a great place to start any project from. Be sure to copy at least one C or CPP file that has a main function into this folder. If you are unsure what to do , simply copy the code from one of the examples.

image

Download Premake5

Download premake version 5.0 from https://premake.github.io/

image

https://premake.github.io/download.html#v5

Put the premake5 executable into your game folder.

image

Copy the premake5.lua file

Download the premake5.lua file from this repository https://github.com/raylib-extras/game-premake

image Copy it into your game folder.

Setup premake5.lua file

Open the premake5.lua file in notepad++ or some other text editor. Find the two instances of “YourGame” and replace them with the name of your game project.

image image

Save the file and close it.

Visual Studio 2019 instructions

These are the instructions for Visual Studio 2019, do these after you do the common steps above.

Download Visual Studio 2019

Get Visual Studio from https://visualstudio.microsoft.com/downloads/ The community edition is free and is perfectly suited for game development with raylib.

image

Install Visual Studio

Run the installer to put Visual Studio 2019 on your computer. See https://docs.microsoft.com/en-us/cpp/build/vscpp-step-0-installation?view=msvc-160 for more info. Be sure to install the Desktop development with C++ and Universal Windows Platform development workflows.

image

Run premake-2019.bat

Double click the premake-2019.bat file, or run it from a console. This will generate all the visual studio project files for the game. You will end up with a .sln file for your game in the root folder.

image

The same premake system can be used on linux, just use the command premake5 gmake instead of premake5 vs2019

Open your .sln file

Double click the sln file to open your game project in Visual Studio. It will include both your game files and the raylib library, all ready to build.

image

MinGW-w64

These are the instructions for Mingw-w64, do these after you do the common steps above.

Get a modern version of MinGW-w64

devkit is a great way to get it. https://github.com/skeeto/w64devkit

Run premake-mingw.bat

Double click the premake-mingw.bat file, or run it from a console. This will generate all the makefiles for the game. You will end up with a MAKEFILE file for your game in the root folder.

Build with Mingw-w64

Open a mingw terminal and run make in your game folder. This will build your game into the bin folder.

Linux GCC

These are the instructions for gcc on linux, do these after you do the common steps above.

Run premake

run the command premake5 gmake2. This will generate all the makefiles for the game. You will end up with a MAKEFILE file for your game in the root folder.

Build with gcc

Run make in a terminal to build your game. This will build your game into the bin folder.

Develop your game.

You can now build, debug, and run your game using your chosen compiler tool chain

image

#Optional

premake-2019 - OpenGL 4.3.bat

This builds raylib with support for OpenGL 4.3 (requires raylib 4.0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.