tinycoffee

tinycoffee-banner

Tiny Coffee

Join the chat at https://gitter.im/tinycoffee/tinycoffee Build Status

Tiny Coffee is a framework to develop simple games 2d games using opengl 3.

**For now it is far to be complete, it is better for you to use other game engine or framework if you working on a commercial project.

The main idea is to have all the dependencies static compiled in the executable, so there is no need of external dynamic libs other than platform specifics.

I’m using in this project:

TODO:

usage

if you want to use your own game loop using Tico static lib, use:

// main.c
#include "tico.h"

int main(int argc, char ** argv) {
  // tc_Config config = tic_config_init("title", 640, 380, argc, argv);
  tc_Config config = tico_config_init("title", 640, 380, argc, argv);
  tc_bool success = tico_init(&config);

  tc_Image image = tico_image_load(filename);

  while (!tico_window_should_close()) { // main loop
    tico_update(); // update inputs, timers, ...

    tico_graphics_clear(color3(75, 90, 90)); // clear screen with color

    tico_begin_draw(); // begin batch render

    tico_image_draw(tex, 0, 0, WHITE); // draw texture
    tico_image_draw_scale(tex, 64, 0, 4, 4, WHITE); // draw scaled texture

    tico_end_draw(); // finish batch render
  }

  tico_terminate();

  return 0;
}

main.lua structure:


function tico.load()
  canvas = tico.graphics.newCanvas(160, 95)
  image = tico.graphics.newImage("image.png")

  rect = tico.graphics.newRectangle(0, 0, 32, 32)
end

function tico.update(dt)
end

function tico.draw()
  canvas:attach()
  tico.graphics.fillRectangle(32, 32, 32, 32)
  image:draw(rect, 64, 64)
  canvas:detach()
  canvas:draw(0, 0)
end

build

Dependencies

for now i’m developing on linux, so is easier to compile on it.

Linux

mkdir build
cd build
cmake ..
make

use cmake .. -DWIN32 to compile for Windows using mingw gcc

Windows

don’t tested yet, but you need to use cmake and probably install mingw

distribution

pack all your game assets (images, sound, font, scripts) in a zip called data.pack. If you are using Lua or Wren, maitain the main.lua file in the zip root

screenshots

tico-0 1 5 tico-shader-palette