GithubHelp home page GithubHelp logo

educ8s / cpp-retro-snake-game-with-raylib Goto Github PK

View Code? Open in Web Editor NEW
24.0 4.0 2.0 723 KB

C++ Retro Snake Game with raylib with a video tutorial explaining each line.

C++ 100.00%
cpp raylib raylib-cpp raylib-examples raylib-game snake-game cpp-game cpp-games

cpp-retro-snake-game-with-raylib's Introduction

C++ Snake game using raylib

This GitHub repository contains the full source code for a Snake game created using the raylib game development library. The game is programmed in the C++ programming language and uses various raylib functions for graphics, input handling, and audio. The game is designed to be played on desktop computers running Windows, macOS, or Linux operating systems. The code is well-structured, easy to read, and heavily commented, making it an excellent resource for aspiring game developers who want to learn more about game programming using raylib

If you're interested in learning how to create your own snake game with raylib, then you'll want to check out the Video Tutorial on YouTube that accompanies this Github repository. The tutorial takes you through each line of code, explaining the logic behind it and demonstrating how it affects the game. You'll learn how to set up the game window, create the snake and food classes, add collision detection, and implement sound effects. By the end of the tutorial, you'll have a fully functional snake game that you can play and modify to your heart's content. So, grab a cup of coffee and get ready to dive into the world of game development with raylib!

Video Tutorial

๐ŸŽฅ Video Tutorial on YouTube



| ๐Ÿ“บ My YouTube Channel | ๐ŸŒ My Website |

cpp-retro-snake-game-with-raylib's People

Contributors

educ8s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

naohiro2g

cpp-retro-snake-game-with-raylib's Issues

Segmentation Fault

The game was working fine. But while escaping to close, I found the below log and exiting with segmentation fault.

Starting the game...
INFO: Initializing raylib 5.0
INFO: Platform backend: DESKTOP (GLFW)
INFO: Supported raylib modules:
INFO:     > rcore:..... loaded (mandatory)
INFO:     > rlgl:...... loaded (mandatory)
INFO:     > rshapes:... loaded (optional)
INFO:     > rtextures:. loaded (optional)
INFO:     > rtext:..... loaded (optional)
INFO:     > rmodels:... loaded (optional)
INFO:     > raudio:.... loaded (optional)
INFO: DISPLAY: Device initialized successfully
INFO:     > Display size: 1920 x 954
INFO:     > Screen size:  900 x 900
INFO:     > Render size:  900 x 900
INFO:     > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: Supported extensions count: 220
INFO: GL: OpenGL device information:
INFO:     > Vendor:   Mesa
INFO:     > Renderer: llvmpipe (LLVM 15.0.7, 128 bits)
INFO:     > Version:  4.5 (Core Profile) Mesa 23.0.4-0ubuntu1~22.04.1
INFO:     > GLSL:     4.50
INFO: GL: VAO extension detected, VAO functions loaded successfully
INFO: GL: NPOT textures extension detected, full NPOT textures supported
INFO: GL: DXT compressed textures supported
INFO: GL: ETC2/EAC compressed textures supported
INFO: PLATFORM: DESKTOP (GLFW): Initialized successfully
INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Vertex shader compiled successfully
INFO: SHADER: [ID 2] Fragment shader compiled successfully
INFO: SHADER: [ID 3] Program shader loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
INFO: RLGL: Default OpenGL state initialized successfully
INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: TIMER: Target time per frame: 16.667 milliseconds
INFO: FILEIO: [Graphics/food.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (28x28 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 3] Texture loaded successfully (28x28 | R8G8B8A8 | 1 mipmaps)
INFO: AUDIO: Device initialized successfully
INFO:     > Backend:       miniaudio / PulseAudio
INFO:     > Format:        32-bit IEEE Floating Point -> 16-bit Signed Integer
INFO:     > Channels:      2 -> 2
INFO:     > Sample rate:   48000 -> 48000
INFO:     > Periods size:  3600
INFO: FILEIO: [Sounds/eat.mp3] File loaded successfully
INFO: WAVE: Data loaded successfully (48000 Hz, 32 bit, 2 channels)
INFO: FILEIO: [Sounds/wall.mp3] File loaded successfully
INFO: WAVE: Data loaded successfully (48000 Hz, 32 bit, 2 channels)
INFO: TEXTURE: [ID 2] Unloaded texture data from VRAM (GPU)
INFO: SHADER: [ID 3] Default shader unloaded successfully
INFO: TEXTURE: [ID 1] Default texture unloaded successfully
INFO: Window closed successfully
INFO: AUDIO: Device closed successfully
Segmentation fault (core dumped)

`main.c` has to be changed to `main.cpp` in the `Makefile`

With the current state of Makefile we will get the following error:

make[1]: *** No rule to make target 'main.c', needed by 'game'.

make: *** [Makefile:387: all] Error 2

After the required changes locally the error has been resolved successfully.

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.