SasLuca / rayfork

C99 Game Library. XNA-like. Platform Independent. Allocator Aware.
The Unlicense
327 stars 19 forks source link

Example script #27

Open TooManyDots opened 4 years ago

TooManyDots commented 4 years ago

I tried using this library today and I couldn't find any working examples. I looked into the tests directory and found this

int main() {
  // Init glfw and opengl
  glfwInit();
  GLFWwindow* window = glfwCreateWindow(800, 450, "rayfork simple glfw example", NULL, NULL);
  glfwMakeContextCurrent(window);
  glfwSwapInterval(1);
  gladLoadGL();

  // Init rayfork
  rf_context rf_ctx = {0};
  rf_default_render_batch rf_mem = {0};
  rf_init(&rf_ctx, &rf_mem, 800, 450, RF_DEFAULT_OPENGL_PROCS);

  // Load a texture with the default libc allocator and io callbacks.
  rf_texture2d texture = rf_load_texture_from_file_ez("bananya.png");

  // Main game loop
  while (!glfwWindowShouldClose(window))
  {
    // Render the image and clear the background to some nice shade of white
    rf_begin();
    rf_clear(RF_RAYWHITE);
    rf_draw_rectangle(0, 0, 100, 100, RF_RED);
    rf_draw_texture(texture, 0, 0, RF_WHITE);
    rf_end();

    glfwPollEvents();
    glfwSwapBuffers(window);
  }
}

But no function named rf_init is either in rayfork.h or rayfork.c and no macro RF_DEFAULT_OPENGL_PROCS was definied. So is there an API or tutorial somewhere how to create a valid context?

SasLuca commented 4 years ago

The library is still in development and I was busy with some irl-stuff in the past month which is unfortunate.

I created a github template project for people who are interested in testing the library right now, however, it's best to wait until rayfork 1.0 (probably in the next 2 months).

You can try it out here: https://github.com/SasLuca/rayfork-sokol-template

BugBiteSquared commented 3 years ago

I am curious about what remains to be done for the 1.0 release. I greatly prefer the use of lighter-weight frameworks as opposed to full-on engines for my game projects lately, especially if I'm working in 2D land & don't need bleeding-edge rendering or procedural animation tech from something like Unreal.

I've been eyeing rayfork for a little while now due to my minor quibbles with raylib. I'd love to be able to give this a spin soon.

SasLuca commented 3 years ago

@BugBiteSquared Currently audio and documentation remain the last pieces of the puzzle before I am comfortable releasing a 1.0 version. I sadly was quite busy in this period and didn't get to work as much as I wanted on rayfork, but hopefully, I will get more time soon and after 1.0 maybe more contributors as well.

On the raylib discord server there is a #rayfork channel and you can also dm me if you have questions, either on discord or on twitter.

I am hopeful for a 1.0 release this year though.