Giter Site home page Giter Site logo

sandal2's Introduction

SANDAL2

tests status coverage report

SANDAL2 is a graphics engine based on SDL2 which purpose is to make object managment and graphic display easier.

To generate the Doxygen documentation, use the command:
doxygen Doxyfile

About the author

      I hope you will enjoy using this tool, and if you have any comment or advice, do not feel shy and tell me (by posting an issue here) ! I will really appreciate it.

Contributors

dabaldassi : version 1.2.3

Useful links

From this "read-me", you can either go to :

  • the read-me with more informations about the project in itself ;
  • the documentation of the projet
  • a small tutorial explaining how to use it ;
  • or the page to report an issue about a tutorial lacking things, an update that could be done or anything that comes to your mind here.

To Install/Uninstall On Linux (Debian)

Regardless the way you install SANDAL2, you'll need to include SANDAL2.h and use -lm -lSDL2 -lSDL2_ttf -lSDL2_image compilation flags. To install SDL2, you only needs to enter those commands :

sudo apt-get install libsdl2-dev
sudo apt-get install libsdl2-image-dev
sudo apt-get install libsdl2-ttf-dev

I. Using the Debian Package only

Installing :

sudo wget https://github.com/PyxisSociety/SANDAL2/raw/master/downloadable/sandal2.deb
sudo dpkg -i sandal2.deb

Then you'll need to add -lSANDAL2 as a compilation flag before all the SDL2 flags.

Uninstalling :

dpkg --purge sandal2

II. Using the github repository

If the package is not made for your computer, or you simply want to use the github directory, you can clone the github project. Once you have it, and you are in the directory of the repository, you can install the package using this command :

sudo make install

You can also directly use the source code. A Makefile is provided in downloadable.

Compilation tools

I. Make

A pseudo generic makefile is downloadable here

II. CMake

A FindSANDAL2.cmake file was created for this project. Also, find files can be found for SDL2_ttf and SDL2_image. All those files are downloadable here.

sandal2's People

Contributors

klevh avatar pyxissociety avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

sandal2's Issues

[BUG] setPlanElement

When calling setPlanElement to change the plan of the element, the element disapear.

a = createBlock(0,0,50,50,white,0,0);
setPlanElement(a,0,4);

Add sound

Use SDL2 to add sound utilities

  • Bind sound to animations (continuously and on occurrence)
  • Bind sound to a window (which can optionally be blocked if window not focused)
  • Add sound on event occurrence (on element AND on window)

Add tutorials

Add tutorials on those subjects:

  • Move the window origin
  • Having more than one window
  • scenary graph

[BUG] setPlanElement

From examples/setPlan/main.c

 /* initializing blocks */
    //for(i = 0; i < 4; ++i)
    createBlock(20 + 0 * 60, 200, 50, 50, colors[0], 0, 1);
    
    e = createBlock(20, 150, 60 * 4, 60, colors[4], 0, 0);
    if(!e){
	run = 0;
    }else{
	setKeyPressedElement(e, keyElement);
    }

    setPlanElement(e, 0, 2);

The red element should be over the white but it is not.

Also :

 /* initializing blocks */
    for(i = 0; i < 4; ++i)
      createBlock(20 + i * 60, 200, 50, 50, colors[i], 0, i);
    
    e = createBlock(20, 150, 60 * i, 60, colors[i], 0, 0);
    if(!e){
	run = 0;
    }else{
	setKeyPressedElement(e, keyElement);
    }

    setPlanElement(e, 0, 5);

works fine when calling setPlan with a plan < 3 but if the plan is > 3 it does not work #anylonger.

Add Action library to quickly interact with elements

It should be interesting to add some prebuild actions to speed up the manipulation of elements.

Change the action prototype

Actually, the action attribute of EventElement has the following prototype:

void (*action)(struct Element*);

I think it should be important to include a second parameter dt corresponding to the ellapsed time since the last call of this function:

int (*action)(struct Element*, float);

The return type int indicates the action is finished when the function return TRUE.

The action library

In some game engines, there are functions (or class) which allows to handle the element characteristics like position, scale, rotation, ... in a short instruction. I add links here to the cocos2d-x action documentation and th libGDX action documentation.

Here is an example. If I want to move my element by 200 pixels to the right during 1 seconds then scale it by 2 during .5 seconds and make a 360° rotation during .5 seconds, I should write something like:

setActionElement(actionSequence(
    actionMoveBy(100, 0, 1), /* (x, y, time) */
    actionScaleBy(1, .5),  /* (scaleXY, time) */
    actionRotateBy(360, .5), /* (angle, time) */
    NULL
));

The NULL parameter is only used to simplify parsing the variadic function actionSequence(...). Obviously, the syntax of this example can be improved but I think the idea is clear.

Here is a list of actions frequently used on other game engines:

action description
moveBy / moveTo Move an element (by a 2D vector / to a specific position)
scaleBy / scaleTo Scale an element by/to a scalar or a 2D vector
rotateBy / rotateTo Rotate an element by/to an angle
fadeIn / fadeOut Gradually change the opacity from 0 to 1 (or inversely)
sequence Execute a set of actions one after the other
parallel Execute a set of actions simultaneously

To go further, it is also possible to define the interpolation method. For example, it allows to avoid the boring linear movement of an element and make a funky elastic appearance! I put here a plot of the interpolation functions used in cocos2d-x:
ease functions of cocos2d-x

Add CMake support

The current Make process does not take into consideration the prerequisites such as:

  • SDL2
  • Doxygen
  • Coverage tools
    ...

A CMakeLists would improve the way to find the requirements, to define easier more steps and to split among several targets the UT, E2E tests, Coverages...

Moreover, that will be a nice advance for the Continuous Integration.

Add a "run" function

Add a blocking run function that contains the main loop and can be regulated to set a number of frame per seconds to be displayed
Add an "auto regulated" version of this function so that if one iteration (update / display) is longer than the time needed for the number of frames per seconds, the restriction for the next run will be less time.

Adding CI

Adding Continuous integration to prevent regressions

Update examples

Change from Makefile to CMakeLists and update readme to integrate cmakelists

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.