Giter Site home page Giter Site logo

formalengine's Introduction

Language grade: C/C++

Logo

The basics

This engine is not yet finished. There are no normal maps, there is no sound, there is no controller support. The list just goes on... The engine currently supports these features:

  • Create objects and manage them in scenes
  • Load meshes from .obj files
  • Load textures from either .bmp or .DDS files
  • Manage the position, scale and rotation on those objects
  • Draw those objects (duh)
  • Does basic shading with one static unmovable light
  • Draw basic 2D GUI text
  • Not cause memory leaks (hopefully)

Building

To build this you just use:

git clone https://github.com/CloudMracek/YAE/ --recursive
cd YAE
mkdir build
cd build
cmake ..
make

Or you can use cmake-gui on Windows

Usage

You can find two folders in the source code:

  • engine
  • game

Don't touch the engine one. (unless you actually want to change them and you're mentally prepared to read my code)

The "game" folder is dedicated specially for you <3 (It's where all your code goes)

Example

Here is a short and dirty example of all the things the engine can do at the moment:

#include "gamemain.h"

GLuint vertexBuffer;
Mesh* mesh1;
GameObject* object;
Texture* texture;
Font* font;
Text* text;

float i = 0;
int fpsSlower = 0;

void gameSetup() {
  
  // Create a mesh and load "cube.obj" into it
  mesh1 = new Mesh("models/cube.obj"); 

  // Create a texture and load "cube.bmp" into it (supports .DDS as well)
  texture = new Texture("textures/cube.bmp");
  
  // Assign the texture to the mesh
  mesh1->setTexture(texture);

  // Create a game object
  object =  new GameObject(glm::vec3(0.0f, 0.0f, 0.0f));
  
  // Asign the mesh to the game object
  object->setMesh(mesh1);

  // Create a scene
  Scene scene1 = Scene("Test scene");
  
  // Add our game object to the scene
  scene1.addObject(object);
  
  // Load a font from file
  font = new Font("assets/fonts/LiberationSerif-Regular.ttf", 48);
  // Create a GUI text on the screen
  text = new Text("Cus", font, glm::vec2(1.0f, 48.0f), glm::vec3(1.0f), 0.5f);

  // Load our scene
  loadScene(scene1);
}

// Cleanup our mess (pointers)
void gameCleanup() {
  delete object;
  delete mesh1;
  delete texture;
  delete text;
  delete font;
}

// Called every frame
void gameTick() {

  // Write the current FPS on our screen (FPS slower is there to make it slower so it's readable)
  if (fpsSlower == 10) {
    text->setText(std::to_string((int)(1 / deltaTime)) + " FPS");
    fpsSlower = 0;
  }
  
  // Set position / rotation / scale (as you wish)
  object->setPosition(glm::vec3(0.0f, sin(i), 0.0f));
  object->setRotation(glm::vec3(i, i, 0.0f));
  i = i + 0.01f;
}

TODO

(In this order of priority)

  • GUI - Basic 2D text done
  • Normal mapping
  • Allow light customization
  • Controller input (PS5 adaptive triggers, haptics)
  • Sound

License

Everything (including the rubik's cube model and texture - Thanks Memmer) is licensed under the GPL-3.0 license. See LICENSE for more info.

Thanks

Special thanks goes to Kurzgesagt - the channel which ignited my love for science after our school system dumped a bucket of water on it.

Thanks to Memmer for supplying the rubik's cube model and kindly agreeing to share it under GPL-3.0

formalengine's People

Contributors

cloudmracek 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.