Giter Club home page Giter Club logo

cbengine's Introduction

cbEngine

A small, experimental 64x64 pixel based game engine made using C++ and OpenGL.

Info

cbEngine was inspired when I thought about creating a custom engine for LowRezJam, I wanted it to be very simple and low level, in this case - literally just providing a graphics window and drawing a custom pixel array to the screen, along with a few other functions to improve usability.

cbEngine is not architectured very well - it was made over the course of a few days as I learnt OpenGL and more about C++. I intended to turn it into a C++ static library but have not gotten round to it - doing that would improve the workflow significantly.

To learn about OpenGL I used LearnOpenGL, a really useful tool for understanding the library. It also has instructions on how to install the required libraries - although I used MinGW for this project so some steps are slightly different.

Getting Started

To get the engine working correctly, there are some additional libraries that need to be installed.

Requirements:

Put the main glad.c file in the /src folder.

Place the library files in a folder called /lib - they should be called libglad.a, libglfw3.a and libglfw3dll.a.

Then place the header files in folders in the include directory. Place the GLAD header in /include/glad/, then the GLFW one in GLFW include/GLFW/, then KHR in /include/KHR/.

Place the glfw3.dll file in the main folder, where the output .exe file will be located.

From there, to build the sample code simply run build.bat or the makefile on default.

Sample Code

#include "engine.h"

//Called before the first update
void Start()
{
    std::cout << "Start" << std::endl;

    SetVsync(false);

    SetPixel(1, 1, 255, 255, 255);
    SetPixel(64, 64, 255, 255, 255);
      

    Pixel  pixel  =  GetPixel(1,  1);
    std::cout  <<  pixel.r  <<  std::endl; //255
    
}

//Called every frame
void Update(float deltaTime)
{
    std::cout << 1 / deltaTime << std::endl;

    if (IsKeyPressed(KEY_SPACE))
    {
        std::cout << "Pressed" << std::endl;
    }
}

//Called once the window has closed
void Finish()
{
    std::cout << "Finish" << std::endl;
}

//Init the engine here
int main()
{
    InitWindow(Start, Update, Finish);
   
    return 0;
}

cbengine's People

Contributors

ceebox avatar otidev avatar

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.