Skip to content

This is a game engine/graphics library, a project for the school, it only supports basic shapes, colors, and some blending modes

Notifications You must be signed in to change notification settings

AnGlonchas/GLFWrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic Setup

#include "glfwrapper.h"

int main() {
    createWindow(640, 640, "Easy Example");

    // Loop until the user closes the window
    while (isWindowOpen()) {
        updateBackgroundColor(BLACK);

        drawRectangle(0.0f, 0.0f, 1.0f, 1.0f, RED);

        updateWindow();
    }

    closeWindow();
    return 0;
}

Download project

To install the project you need to preferably install git,
at the desired directory, then

git clone https://github.com/AnGlonchas/GLFWrapper

Or download the zip directly into the desired directory

Project Structure

/ProjectName
├── lib/
    ├── libglfw3.a
├── include/
    ├── GL/gl.h
    ├── GLFW/glfw3.h
├── main.c

Windows

Install compiler

Download here
In the cmd type setx path "%path%;c:/path/to/gcc.exe
Reopen cmd and type gcc --version
You should see something like

gcc.exe (x86_64-posix-seh-rev0, Built by MinGW-Builds project) 14.2.0
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compile Project

gcc main.c -Wall -o a.exe -I./include/ -L./lib/ -lglfw3 -lopengl32 -lgdi32

Run

In the main.c directory, open a cmd, then type run

MacOS

How to use in MacOS

If you are using a Mac, you have to use the same files that we have given u, but changing de "libglfw3.a" in the "lib" folder instaling the GLFW Mac's version here and changing the "libglfw3.a" to the current project instead of the others files in "lib", this way, you must play the game if you follow the next steps in "Terminal":

Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install glfw

brew install glfw

Go to the "GLFWrapper" folder using "cd file_x" and use this command:

gcc pong.c -o programa \
  -I/opt/homebrew/include \
  -L/opt/homebrew/lib \
  -lglfw \
  -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo \
  -DGL_SILENCE_DEPRECATION

After that, just type the next executable and you would be able to play it:

./programa

Linux

Install glfw

On terminal type:

sudo apt install xorg-dev
sudo apt install libglfw3 libglfw3-dev

Once you have downloaded the files, proceed to compile and run the program with the following commands.

gcc pong.c -Wall -o a.out -I./include/ -L./lib/ -lglfw3 -lopengl32 -lgdi32

Now you can run the program

./a.out

About

This is a game engine/graphics library, a project for the school, it only supports basic shapes, colors, and some blending modes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •