Commit 535ec539 authored by Danny Baumann's avatar Danny Baumann

Added CMake build file.

parent 38822a26
prefix=@prefix@
exec_prefix=@prefix@
libdir=@libdir@
includedir=@includedir@
Name: compiz-elements
Description: Elements plugin for compiz
Version: @VERSION@
Requires:
Libs:
Cflags: @COMPIZ_CFLAGS@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="100"
height="100"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.45"
version="1.0"
sodipodi:docbase="/home/cosimo321/Desktop"
sodipodi:docname="6.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
sodipodi:modified="true">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="10000"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="33.330465"
inkscape:cy="52.528865"
inkscape:document-units="px"
inkscape:current-layer="layer1"
width="100px"
height="100px"
inkscape:window-width="822"
inkscape:window-height="596"
inkscape:window-x="386"
inkscape:window-y="165" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
sodipodi:type="star"
style="fill:#ffffa9;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
id="path2162"
sodipodi:sides="54"
sodipodi:cx="51.428574"
sodipodi:cy="48.214287"
sodipodi:r1="44.281395"
sodipodi:r2="19.00815"
sodipodi:arg1="0.72262361"
sodipodi:arg2="3.0399244"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 84.64286,77.500002 L 32.518577,50.143485 L 81.018413,81.157926 L 32.422474,47.935124 L 76.993814,84.370343 L 32.583395,45.730538 L 72.623489,87.093812 L 32.999165,43.55954 L 67.966539,89.291502 L 33.664161,41.45149 L 63.085942,90.933693 L 34.56939,39.434895 L 58.047698,91.998178 L 35.702611,37.537027 L 52.919943,92.47056 L 37.048499,35.78355 L 47.772019,92.344453 L 38.588852,34.198177 L 42.673544,91.62156 L 40.302841,32.802348 L 37.693465,90.311659 L 42.167286,31.61494 L 32.89913,88.432463 L 44.156974,30.652009 L 28.355375,86.009385 L 46.244998,29.926577 L 24.123644,83.075193 L 48.403121,29.448456 L 20.261166,79.669567 L 50.602158,29.22411 L 16.820174,75.838563 L 52.812371,29.256574 L 13.847201,71.633987 L 55.00387,29.545408 L 11.382451,67.1127 L 57.14702,30.086707 L 9.4592571,62.335845 L 59.212837,30.873151 L 8.1036257,57.36802 L 61.173386,31.894103 L 7.33389,52.276406 L 63.002153,33.135758 L 7.1604592,47.129859 L 64.674407,34.581324 L 7.5856787,41.997977 L 66.167534,36.211253 L 8.6037981,36.95016 L 67.461341,38.003502 L 10.201049,32.054671 L 68.538333,39.933834 L 12.355832,27.377714 L 69.383945,41.976145 L 15.039006,22.982535 L 69.986741,44.102817 L 18.214287,18.928572 L 70.33857,46.285089 L 21.838734,15.270648 L 70.434674,48.49345 L 25.863333,12.05823 L 70.273752,50.698036 L 30.233658,9.3347614 L 69.857982,52.869033 L 34.890608,7.1370713 L 69.192986,54.977083 L 39.771205,5.4948801 L 68.287757,56.993678 L 44.809449,4.4303956 L 67.154536,58.891547 L 49.937204,3.9580132 L 65.808648,60.645024 L 55.085128,4.0841209 L 64.268295,62.230396 L 60.183604,4.8070133 L 62.554306,63.626225 L 65.163682,6.1169147 L 60.689861,64.813634 L 69.958017,7.9961109 L 58.700173,65.776565 L 74.501773,10.419189 L 56.612149,66.501996 L 78.733503,13.353381 L 54.454026,66.980118 L 82.595981,16.759006 L 52.254989,67.204463 L 86.036973,20.590011 L 50.044776,67.172 L 89.009946,24.794586 L 47.853277,66.883165 L 91.474696,29.315873 L 45.710127,66.341866 L 93.39789,34.092728 L 43.64431,65.555423 L 94.753521,39.060554 L 41.683761,64.534471 L 95.523257,44.152167 L 39.854994,63.292816 L 95.696688,49.298714 L 38.18274,61.84725 L 95.271469,54.430596 L 36.689614,60.217321 L 94.253349,59.478413 L 35.395806,58.425072 L 92.656098,64.373902 L 34.318814,56.49474 L 90.501315,69.05086 L 33.473202,54.452428 L 87.818141,73.446039 L 32.870406,52.325757 L 84.64286,77.500002 z " />
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://web.resource.org/cc/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="100"
height="100"
id="svg2"
sodipodi:version="0.32"
inkscape:version="0.45"
version="1.0"
sodipodi:docbase="/home/cosimo321/Desktop"
sodipodi:docname="9.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
sodipodi:modified="true">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
gridtolerance="10000"
guidetolerance="10"
objecttolerance="10"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="33.330465"
inkscape:cy="52.528865"
inkscape:document-units="px"
inkscape:current-layer="layer1"
width="100px"
height="100px"
inkscape:window-width="822"
inkscape:window-height="596"
inkscape:window-x="386"
inkscape:window-y="165" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
sodipodi:type="star"
style="fill:#f9cb77;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
id="path2162"
sodipodi:sides="54"
sodipodi:cx="51.428574"
sodipodi:cy="48.214287"
sodipodi:r1="44.281395"
sodipodi:r2="5.6694212"
sodipodi:arg1="0.72262361"
sodipodi:arg2="-1.7575881"
inkscape:flatsided="false"
inkscape:rounded="0"
inkscape:randomized="0"
d="M 84.64286,77.500002 L 50.37572,42.643485 L 81.018413,81.157926 L 51.02957,42.558924 L 76.993814,84.370343 L 51.688815,42.550842 L 72.623489,87.093812 L 52.344541,42.619348 L 67.966539,89.291502 L 52.987881,42.763516 L 63.085942,90.933693 L 53.610133,42.981397 L 58.047698,91.998178 L 54.202883,43.270044 L 52.919943,92.47056 L 54.758116,43.625552 L 47.772019,92.344453 L 55.268323,44.043116 L 42.673544,91.62156 L 55.726603,44.517088 L 37.693465,90.311659 L 56.12676,45.041058 L 32.89913,88.432463 L 56.463382,45.60794 L 28.355375,86.009385 L 56.731917,46.210069 L 24.123644,83.075193 L 56.928733,46.839301 L 20.261166,79.669567 L 57.051169,47.487128 L 16.820174,75.838563 L 57.097569,48.144788 L 13.847201,71.633987 L 57.067305,48.803388 L 11.382451,67.1127 L 56.960788,49.454022 L 9.4592571,62.335845 L 56.779457,50.08789 L 8.1036257,57.36802 L 56.525764,50.696421 L 7.33389,52.276406 L 56.20314,51.271385 L 7.1604592,47.129859 L 55.815949,51.805007 L 7.5856787,41.997977 L 55.369426,52.290071 L 8.6037981,36.95016 L 54.869609,52.720018 L 10.201049,32.054671 L 54.323259,53.089031 L 12.355832,27.377714 L 53.737763,53.392122 L 15.039006,22.982535 L 53.121039,53.625192 L 18.214287,18.928572 L 52.481427,53.785089 L 21.838734,15.270648 L 51.827578,53.86965 L 25.863333,12.05823 L 51.168332,53.877732 L 30.233658,9.3347614 L 50.512606,53.809226 L 34.890608,7.1370713 L 49.869267,53.665057 L 39.771205,5.4948801 L 49.247014,53.447177 L 44.809449,4.4303956 L 48.654264,53.15853 L 49.937204,3.9580132 L 48.099031,52.803021 L 55.085128,4.0841209 L 47.588825,52.385457 L 60.183604,4.8070133 L 47.130544,51.911486 L 65.163682,6.1169147 L 46.730387,51.387516 L 69.958017,7.9961109 L 46.393765,50.820634 L 74.501773,10.419189 L 46.125231,50.218505 L 78.733503,13.353381 L 45.928414,49.589273 L 82.595981,16.759006 L 45.805978,48.941446 L 86.036973,20.590011 L 45.759578,48.283786 L 89.009946,24.794586 L 45.789842,47.625186 L 91.474696,29.315873 L 45.896359,46.974552 L 93.39789,34.092728 L 46.077691,46.340684 L 94.753521,39.060554 L 46.331383,45.732153 L 95.523257,44.152167 L 46.654007,45.157188 L 95.696688,49.298714 L 47.041198,44.623566 L 95.271469,54.430596 L 47.487721,44.138502 L 94.253349,59.478413 L 47.987538,43.708556 L 92.656098,64.373902 L 48.533888,43.339542 L 90.501315,69.05086 L 49.119384,43.036451 L 87.818141,73.446039 L 49.736108,42.803381 L 84.64286,77.500002 z " />
</g>
</svg>
/* Insert copyright */
#ifndef _COMPIZ_ELEMENTS_H
#define _COMPIZ_ELEMENTS_H
#include <compiz-core.h>
/* This is the number used to make sure that elements don't get all
created in one place. Bigger number, more distance.
Possibly fixable later. -> s->width? */
#define BIG_NUMBER 20000
#define ELEMENTS_ABIVERSION 20081215
typedef struct _ElementTypeInfo ElementTypeInfo;
typedef struct _Element Element;
typedef struct _ElementAnimation ElementAnimation;
typedef struct _ElementTexture ElementTexture;
typedef void (*ElementInitiateProc) (CompScreen *s,
Element *e);
typedef void (*ElementMoveProc) (CompScreen *s,
ElementAnimation *anim,
Element *e,
int updateDelay);
typedef void (*ElementFiniProc) (CompScreen *s,
Element *e);
/* Element Type management, extension plugins should call this to create
a new 'type' of element in the core of elements on initDisplay.
What is provided:
* CompDisplay *
* Element Name
* Function pointer to element initialization function
* Function pointer to element movement function
* Fuction pointer to fini function
*/
typedef struct _ElementsBaseFunctions
{
Bool (*newElementType) (CompDisplay *d,
char *name,
char *desc,
ElementInitiateProc initiate,
ElementMoveProc move,
ElementFiniProc fini);
void (*removeElementType) (CompScreen *s,
char *name);
int (*getRand) (int min, int max);
float (*mmRand) (int min, int max, float divisor);
int (*boxing) (CompScreen *s);
int (*depth) (CompScreen *s);
} ElementsBaseFunctions;
struct _ElementTypeInfo
{
char *name;
char *desc;
ElementInitiateProc initiate;
ElementMoveProc move;
ElementFiniProc fini;
struct _ElementTypeInfo *next;
};
struct _ElementTexture
{
CompTexture tex;
unsigned int width;
unsigned int height;
Bool loaded;
GLuint dList;
};
struct _Element
{
char *type; /* Follows the usual pattern, alphabetic
except for bubbles, which is 4. */
float x, y, z;
float dx, dy, dz;
float rSpeed;
int rDirection;
int rAngle;
float opacity;
float glowAlpha; /* Needs to be painted */
int nTexture;
void *ptr; /* Extensions latch on to this */
};
struct _ElementAnimation
{
char *type;
char *desc;
int nElement;
int size;
int speed;
int id; /* Uniquely idenitifies this animation */
Bool active;
ElementTexture *texture;
int nTextures;
Element *elements;
ElementTypeInfo *properties;
struct _ElementAnimation *next;
};
/* Resets an animation to defaults */
void initiateElement (CompScreen *s,
ElementAnimation *anim,
Element *ele);
/* Calls the movement function pointer for an element in an element animation */
void elementMove (CompScreen *s,
Element *e,
ElementAnimation *anim,
int updateDelay);
/* Used to update all element textures and settings */
void updateElementTextures (CompScreen *s,
Bool changeTextures);
/* Utility Functions */
int elementsGetRand (int min, int max);
float elementsMmRand(int min, int max, float divisor);
int elementsGetEBoxing (CompScreen *s);
int elementsGetEDepth (CompScreen *s);
/* Management of ElementAnimations */
ElementAnimation* elementsCreateAnimation (CompScreen *s,
char *name);
void elementsDeleteAnimation (CompScreen *s,
ElementAnimation *anim);
#endif
<?xml version="1.0"?>
<compiz>
<plugin name="elements" useBcop="true">
<_short>Elements</_short>
<_long>Draw elements on screen</_long>
<category>Extras</category>
<deps>
<relation type="after">
<plugin>png</plugin>
<plugin>svg</plugin>
<plugin>jpeg</plugin>
<plugin>text</plugin>
</relation>
</deps>
<display>
<option name="abi" type="int" read_only="true"/>
<option name="index" type="int" read_only="true"/>
<group>
<_short>General</_short>
<option name="next_element_key" type="key">
<_short>Next Element</_short>
<_long>Select the Next Element in the list</_long>
</option>
<option name="prev_element_key" type="key">
<_short>Previous Element</_short>
<_long>Select the Next Element in the list</_long>
</option>
<option name="toggle_selected_key" type="key">
<_short>Toggle Selected Element</_short>
<_long>Select the Next Element in the list</_long>
</option>
</group>
</display>
<screen>
<group>
<_short>General</_short>
<option name="update_delay" type="int">
<_short>Update Delay</_short>
<_long>Delay (in ms) between screen updates. Decreasing this value may make snow fall more smoothly, but will also increase CPU usage.</_long>
<default>40</default>
<min>10</min>
<max>200</max>
</option>
<option name="screen_depth" type="int">
<_short>Screen Depth</_short>
<_long>How deep into the screen snowflakes can be drawn before being removed</_long>
<default>1000</default>
<min>0</min>
<max>2000</max>
</option>
<option name="screen_boxing" type="int">
<_short>Screen Boxing</_short>
<_long>How far from the screen snowflakes can be drawn before being removed</_long>
<default>1000</default>
<min>0</min>
<max>2000</max>
</option>
<option name="over_windows" type="bool">
<_short>Draw Over Windows</_short>
<_long>Elements drawn above windows</_long>
<default>false</default>
</option>
<subgroup>
<_short>Elements List</_short>
<option type="list" name="element_type">
<_short>Element Type</_short>
<_long>Element Movement Type</_long>
<type>string</type>
<extensible/>
</option>
<option type="list" name="element_iter">
<_short>Element Iter</_short>
<_long>Settings for one particular element configuration. Separate element definitions have different iters. This is a workaround to have multiple-textures per element until we can get cascading options</_long>
<type>int</type>
<min>1</min>
<max>100</max>
</option>
<option type="list" name="element_image">
<type>string</type>
<_short>Element Image</_short>
<_long>Image file for this Element</_long>
<hints>file;image;</hints>
</option>
<option type="list" name="element_cap">
<type>int</type>
<_short>Number of elements</_short>
<_long>Total number of allowed element</_long>
<min>0</min>
<max>1000</max>
</option>
<option type="list" name="element_size">
<type>int</type>
<_short>Element size</_short>
<_long>Size of these elements</_long>
<min>0</min>
<max>100</max>
</option>
<option type="list" name="element_speed">
<type>int</type>
<_short>Element speed</_short>
<_long>Speed of these elements</_long>
<min>0</min>
<max>100</max>
</option>
<option type="list" name="element_rotate">
<type>bool</type>
<_short>Element rotation</_short>
<_long>Allow rotation of this element</_long>
</option>
</subgroup>
</group>
<group>
<short>Element Settings</short>
<subgroup>
<_short>Snow</_short>
<option name="snow_sway" type="int">
<_short>Snow sway</_short>
<_long>Side-to-side movement of Snow.</_long>
<default>3</default>
<min>0</min>
<max>10</max>
</option>
<option name="wind_direction" type="int">
<_short>Snow Direction</_short>
<_long>Select snow flake movement direction</_long>
<default>0</default>
<min>0</min>
<max>3</max>
<desc>
<value>0</value>
<_name>None</_name>
</desc>
<desc>
<value>1</value>
<_name>Up</_name>
</desc>
<desc>
<value>2</value>
<_name>Left</_name>
</desc>
<desc>
<value>3</value>
<_name>Right</_name>
</desc>
</option>
</subgroup>
<subgroup>
<_short>Autumn</_short>
<option name="autumn_sway" type="float">
<_short>Sway Of leaves</_short>
<_long>sway of leaves</_long>
<default>35.0</default>
<min>0.0</min>
<max>100.0</max>
<precision>1</precision>
</option>
<option name="autumn_y_sway" type="int">
<_short>Y Sway Gravity</_short>
<_long>Speed of falling leaves</_long>
<default>60</default>
<min>0</min>
<max>100</max>
</option>
</subgroup>
<subgroup>
<_short>Bubbles</_short>
<option name="viscosity" type="float">
<_short>Viscosity of liquid</_short>
<_long>Viscosity of liquid</_long>
<default>80.0</default>
<min>0.0</min>
<max>100.0</max>
<precision>1</precision>
</option>
</subgroup>
<subgroup>
<_short>Stars</_short>
<option name="star_offset_x" type="int">
<_short>Star X Offset</_short>
<_long>The X point on the screen where stars should start</_long>
<default>0</default>
<min>-1000</min>
<max>1000</max>
</option>
<option name="star_offset_y" type="int">
<_short>Star Y Offset</_short>
<_long>The Y point on the screen where stars should start</_long>
<default>0</default>
<min>-1000</min>
<max>1000</max>
</option>
</subgroup>
</group>
<group>
<_short>Element Title Display</_short>
<option name="title_font_color" type="color">
<_short>Font Color</_short>
<_long>Font color for the window title</_long>
<default>
<red>0xffff</red>
<green>0xffff</green>
<blue>0xffff</blue>
<alpha>0xffff</alpha>
</default>
</option>
<option name="title_font_size" type="int">
<_short>Font Size</_short>
<_long>Font size for the window title</_long>
<default>16</default>
<min>6</min>
<max>96</max>
</option>
<option name="title_bold_font" type="bool">
<_short>Bold Font</_short>
<_long>Use a bold font</_long>
<default>true</default>
</option>
<option name="title_back_color" type="color">
<_short>Background Color</_short>
<_long>Background color for the window title</_long>
<default>
<red>0x0000</red>
<green>0x0000</green>
<blue>0x0000</blue>
<alpha>0x9999</alpha>
</default>
</option>
<option name="title_display_time" type="int">
<_short>Display Time</_short>
<_long>How long to display the title (in ms)</_long>
<default>1000</default>
<min>50</min>
<max>5000</max>
</option>
<option name="title_on_toggle" type="bool">
<_short>Show Title on Toggle</_short>
<_long>Show the element type when toggling the currently selected element</_long>
<default>true</default>
</option>
</group>
</screen>
<extension base_plugin="elements" screen="true">
<base_option>element_type</base_option>
<restriction>
<value>autumn</value>
<_name>Autumn</_name>
</restriction>
<restriction>
<value>fireflies</value>
<_name>Fireflies</_name>
</restriction>
<restriction>
<value>snow</value>
<_name>Snow</_name>
</restriction>
<restriction>
<value>stars</value>
<_name>Stars</_name>
</restriction>
<restriction>
<value>bubbles</value>
<_name>Bubbles</_name>
</restriction>
</extension>
</plugin>
</compiz>
include (CompizFusion)
compiz_fusion_plugin (elements PLUGINDEPS text)
#include "elements-internal.h"
/* AUTUMN FUNCTIONS */
void
initiateAutumnElement (CompScreen *s,
Element *e)
{
int i;
float xSway, ySway;
AutumnElement *ae;
if (!e->ptr)
e->ptr = calloc (1, sizeof (AutumnElement));
if (!e->ptr)
return;
ae = (AutumnElement *) e->ptr;
xSway = elementsMmRand (elementsGetAutumnSway (s),
elementsGetAutumnSway (s), 2.0);
ySway = elementsGetAutumnYSway (s) / 20.0;
for (i = 0; i < MAX_AUTUMN_AGE; i++)
ae->autumnFloat[0][i] = -xSway +
(i * ((2 * xSway) / (MAX_AUTUMN_AGE - 1)));
for (i = 0; i < (MAX_AUTUMN_AGE / 2); i++)
ae->autumnFloat[1][i] = -ySway +
(i * ((2 * ySway) / (MAX_AUTUMN_AGE - 1)));
for (; i < MAX_AUTUMN_AGE; i++)
ae->autumnFloat[1][i] = ySway -
(i * ((2 * ySway) / (MAX_AUTUMN_AGE - 1)));
ae->autumnAge[0] = elementsGetRand (0, MAX_AUTUMN_AGE - 1);
ae->autumnAge[1] = elementsGetRand (0, (MAX_AUTUMN_AGE / 2) - 1);
ae->autumnChange = 1;
e->x = elementsMmRand (0, s->width, 1); ae->autumnChange = 1;
e->y = -elementsMmRand (100, s->height, 1);
e->dy = elementsMmRand (-2, -1, 5);
}
void
autumnMove (CompScreen *s,
ElementAnimation *anim,
Element *e,
int updateDelay)
{
float autumnSpeed = anim->speed / 30.0f;
AutumnElement *ae = (AutumnElement *) e->ptr;
if (!ae)
return;
e->x += (ae->autumnFloat[0][ae->autumnAge[0]] * (float) updateDelay) / 80;
e->y += (ae->autumnFloat[1][ae->autumnAge[1]] * (float) updateDelay) / 80 +
autumnSpeed;
e->z += (e->dz * (float) updateDelay) * autumnSpeed / 100.0;
e->rAngle += ((float) updateDelay) / (10.1f - e->rSpeed);
ae->autumnAge[0] += ae->autumnChange;
ae->autumnAge[1] += 1;
if (ae->autumnAge[1] >= MAX_AUTUMN_AGE)
{
ae->autumnAge[1] = 0;
}
if (ae->autumnAge[0] >= MAX_AUTUMN_AGE)
{
ae->autumnAge[0] = MAX_AUTUMN_AGE - 1;
ae->autumnChange = -1;
}
if (ae->autumnAge[0] <= -1)
{
ae->autumnAge[0] = 0;
ae->autumnChange = 1;
}
}
void
autumnFini (CompScreen *s,
Element *e)
{
if (e->ptr)
free (e->ptr);
e->ptr = NULL;
}
#include "elements-internal.h"
/* BUBBLES SPECIFIC FUNCTIONS */
void
initiateBubbleElement (CompScreen *s,
Element *e)
{
int i;
float temp, xSway;
BubbleElement *be;
if (!e->ptr)
e->ptr = calloc (1, sizeof (BubbleElement));
if (!e->ptr)
return;
be = (BubbleElement *) e->ptr;
temp = elementsMmRand (elementsGetViscosity (s) / 2.0,
elementsGetViscosity (s), 50.0);
xSway = 1.0 - temp * temp / 4.0;
for (i = 0; i < MAX_AUTUMN_AGE; i++)
be->bubbleFloat[0][i] = -xSway +
(i * ((2 * xSway) / (MAX_AUTUMN_AGE - 1)));
be->bubbleAge[0] = elementsGetRand (0, MAX_AUTUMN_AGE - 1);
be->bubbleAge[1] = be->bubbleAge[0];
be->bubbleChange = 1;
e->x = elementsMmRand (0, s->width, 1);
e->y = elementsMmRand (s->height + 100, s->height, 1);
e->dy = elementsMmRand (-2, -1, 5);
}
void
bubbleMove (CompScreen *s,
ElementAnimation *anim,