Giter VIP home page Giter VIP logo

rayport's Introduction

Awesome C99, Header-Only, rayfork wrapper for raylib!


rayport wraps raylib API depending on what rayfork supports from raylib to keep compatibiltiy, Also RLGL and raymath wrapped!

You need to include raylib.h and rayfork to use rayport!

Why rayport?

  • Port raylib games easily to mobile and consoles via rayfork!
  • Easy way to save porting time, You just need to rewrite window and input code (Depending on window and input library will used with rayfork).
  • More independency to raylib code via rayfork (As rayfork can use any window and input library).
  • rayport is written in C99, Making it portable and easy to use anywhere you name it!
  • Can make bindings easier if you rely on rayfork but with using raylib!

Example

Here is a simple example for rayport with rayfork uses rayfork-sokol-template (Include rayport.h with including rayfork and raylib previously!)

#include "platform.h"
#include "raylib.h"
#include "rayport.h"

platform_window_details window = {
    .width  = 800,
    .height = 450,
    .title  = "rayfork"
};

rf_context ctx;
rf_render_batch batch;
Texture2D texture;

extern void game_init(rf_gfx_backend_data* gfx_data)
{
    // Initialize rayfork
    rf_init_context(&ctx);
    rf_init_gfx(window.width, window.height, gfx_data);

    // Initialize the rendering batch
    batch = rf_create_default_render_batch(RF_DEFAULT_ALLOCATOR);
    rf_set_active_render_batch(&batch);

    // Load texture
    texture = LoadTexture("bananya.png");
}

extern void game_update(const platform_input_state* input)
{
    // Render the image and clear the background to some nice shade of white
    BeginDrawing();
    ClearBackground(RAYWHITE);
    DrawRectangle(0, 0, 100, 100, RED);
    DrawTexture(texture, 0, 0, WHITE);
    EndDrawing();
}

Original code can be found here.

NOTES

  1. Note that rayfork still miss some features unlike raylib, So some functions aren't wrapped yet!
  2. Since 12/September/2020, You should include raylib easings header in order to use easings.
  3. Although rayfork still miss some stuff, I successed lately in wrapping more stuff (And will still do)!
  4. Don't use custom rlgl.h as RLGL since it's wrapped from rayport.h, That's to keep compatibility!
  5. If you want to use custom raylib.h (Your own one), Make sure you add changes from the custom raylib.h i made.
  6. If you don't care about step 5, I made a custom raylib.h ready for use with rayport.h, You just need to include it with rayfork.

For list of available wrapped functions (As enums and colors wrapped), See here.

Also, See changelog for changes!

Special Thanks

  1. Ramon Santamaria (raysan5), Who made raylib.
  2. Luca Sas (SasLuca), Who made rayfork.

rayport's People

Contributors

rabios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

southdy

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.