Skip to content

educ8s/raylib-Buttons-Tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raylib Buttons Tutorial

This repository contains the code for a video tutorial on creating and using buttons in a Raylib project in C++.

Video Tutorial

Preview

🎥 Video Tutorial on YouTube

Overview

In this tutorial, we build a basic Raylib application that demonstrates how to create and use buttons. The tutorial covers setting up the Raylib window, creating button objects, detecting button presses, and handling button events.

Features

  • Raylib Window Setup: Initialize a Raylib window with a specified width and height.
  • Buttons: Create and display interactive buttons that respond to user inputs.
  • Event Handling: Detect button presses and perform actions based on those events.
  • Visual Feedback: Visual representation of buttons and their states.

Code Structure

  • main.cpp: The main script that initializes the Raylib window, handles events, checks for button presses, and renders the game objects.
  • button.hpp: Header file containing the Button class definition.
  • button.cpp: Source file containing the implementation of the Button class methods.

How to Run

  1. Clone this repository:

    git clone https://github.com/educ8s/raylib-buttons-tutorial.git
    cd raylib-buttons-tutorial
  2. Ensure you have C++ and Raylib installed. You can follow the installation instructions on the Raylib official website.

  3. Place your button images and background image in the Graphics directory.

  4. Compile the code:

    g++ main.cpp button.cpp -o main -lraylib
  5. Run the compiled program:

    ./main

Usage

  • Run the program and a window titled "Raylib Buttons Tutorial" will appear.
  • The start button and exit button will be displayed.
  • Clicking the start button will print "Start Button pressed" to the console.
  • Clicking the exit button will close the Raylib window and exit the program.

Dependencies

  • C++
  • Raylib

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.

About

raylib Buttons Tutorial

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages