Code Monkey home page Code Monkey logo

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

Update examples

Change from Makefile to CMakeLists and update readme to integrate cmakelists

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.

[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.

[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);

Adding CI

Adding Continuous integration to prevent regressions

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 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 tutorials

Add tutorials on those subjects:

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

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.

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.