Coder Social home page Coder Social logo

mglib's Introduction

MGLib

A Miniature Graphics Library for Learning and Prototyping

Getting Started

Windows

Still working on this

Macos

cd /path/to/mg/lib && make

In your code

#include <mg.h>

int main(int argc, char **argv)
{
    mg_initialize("My App Name");
    // Use MG Lib here..
    return (0);
}

Compilation examples

C

gcc my_main.c -Ipath/to/mglib/ -Lpath/to/mglib/ -lmg -framework AppKit -framework OpenGL -o my_executable_name

C++

clang++ my_main.cpp -Ipath/to/mglib/ -Lpath/to/mglib/ -lmg -framework AppKit -framework OpenGL -o my_executable_name

Description

MGLib at its core, is a platform layer. MGLib interfaces with the underlying platform and exposes useful functions for drawing. MGLib doesn't really take a unique approach to hooking into the platform. The API is intentionally similar to some of the most popular open source graphics libraries in use today to make porting simpler.

'Robustness' and 'performance' and to a certain extent 'maintainability' were not considered to be first-order priorities in designing this library. Its purpose is simply to lower the bar of entry for novice programmers into graphics and platform interface code. As such, the value given first consideration here is readability, both on the user side, which requires a dead-simple API, and the library side, which requires a straight-forward implementation. Code in the library implementation is intended to be as informative as possible about what is going on. This means that the way in which much of the library is implemented would not be ideal for serious projects, but hopefully the simple design inspires some programmers who are new to graphics to dig into the source files.

On the other hand, a library which is dead-simple to use but can't run a graphics program smoothly is also not useful for learning. Personally, what piqued my interest about graphics programming in the first place was the challenge of drawing complex scenes with lots of vertices and textures at a high frame rate. Learning to use a library that is not at least capable of drawing a 2D game at 60fps would be a bummer, and would, in my opinion, not be worth the time to learn it. Thus, on some level, performance of the library is taken into account.

Future Plans

  • Documentation
  • Font rendering
  • Keyboard input
  • Thread Safety
  • OpenGL implementation on Windows
  • DirectX 11 on Windows
  • Gamepad input
  • Ability to use custom shaders
  • Optimization of performance
  • Shippable version?

Author

Nickolas Mayfield

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgements

mglib's People

Contributors

nmayfiel avatar

Watchers

James Cloos avatar  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.