Skip to content

canoi12/tinycoffee

Repository files navigation

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:

  • draw outlined shapes
  • draw triangles and circles
  • user created spritebatch
  • load config from json
  • wrap for lua (work in progress, focusing on this one)
  • wrap for wren (work in progress, stopped by now)
  • json parser
  • autopack textures on the fly
  • joystick support (initial stage)
  • pollish the main engine modules (graphics, filesystem, audio, math, input)
  • make specific game types like camera, sprite, tileset..
  • fuse game executable with zip (like love2d)
  • make simple editors (sprite, tileset, scene..)
  • user custom shaders (like love2d and gms, with default variables for attributes and uniforms)
  • support for more audio types
  • struct with options to init engine (need to add more options)
  • load audio static (decode in memory)
  • drawing textures
  • drawing canvas
  • custom glsl shaders (but the shaders need to implement some attribute variables and uniforms)
  • keyboard and mouse input
  • plugins system (in progress)
    • resource manager
      • audio
      • image
      • font
      • shader
      • sprite
      • tilemap / scene
      • tileset
    • editor
      • tileset
      • tilemap / scene
    • lua
    • wren

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

  • Linux
    • xorg-dev
    • libgl1-mesa-dev
    • gcc
    • gcc-mingw-w64-x86-64 (to build for Windows)
    • make
    • cmake
  • Windows
    • cmake
    • mingw

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