Mercurial > hg > demos > bussi
changeset 17:87743e265d97
unix2dos
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 23 May 2015 03:19:49 +0300 |
parents | 80634079f275 (diff) f95d546f43da (current diff) |
children | 8398461ccd0f |
files | file_id.diz |
diffstat | 8 files changed, 235 insertions(+), 84 deletions(-) [+] |
line wrap: on
line diff
--- a/assets/graffat.svg Fri May 22 03:24:21 2015 +0300 +++ b/assets/graffat.svg Sat May 23 03:19:49 2015 +0300 @@ -232,6 +232,39 @@ result="composite2" id="feComposite6345" /> </filter> + <linearGradient + inkscape:collect="always" + xlink:href="#linearGradient6291" + id="linearGradient4275" + x1="417.82367" + y1="-196.95067" + x2="423.16422" + y2="-196.95067" + gradientUnits="userSpaceOnUse" + gradientTransform="translate(-6.7857143,0)" /> + <linearGradient + gradientTransform="translate(195.22033,-0.54932779)" + inkscape:collect="always" + xlink:href="#linearGradient6291" + id="linearGradient4275-5" + x1="417.82367" + y1="-196.95067" + x2="423.16422" + y2="-196.95067" + gradientUnits="userSpaceOnUse" /> + <filter + inkscape:collect="always" + style="color-interpolation-filters:sRGB" + id="filter4280" + x="-0.034327192" + width="1.0686544" + y="-0.038133329" + height="1.0762667"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="5.7650503" + id="feGaussianBlur4282" /> + </filter> </defs> <sodipodi:namedview id="base" @@ -240,15 +273,15 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="0.7" - inkscape:cx="232.16163" - inkscape:cy="278.77908" + inkscape:zoom="0.98994949" + inkscape:cx="-103.17358" + inkscape:cy="245.53492" inkscape:document-units="px" inkscape:current-layer="layer5" showgrid="false" units="px" - inkscape:window-width="1278" - inkscape:window-height="992" + inkscape:window-width="1398" + inkscape:window-height="1018" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" @@ -318,8 +351,8 @@ </g> <g id="g6237" - transform="matrix(0.57468849,0,0,0.67705684,-65.691873,66.295383)" - inkscape:export-filename="/usr/src/prj/demos/bussi/data/puu_pv_1.png" + transform="matrix(0.77016992,0,0,1.0222793,-65.045575,-48.894832)" + inkscape:export-filename="/home/ccr/bussi/data/puu_pv_1.png" inkscape:export-xdpi="90" inkscape:export-ydpi="90"> <g @@ -372,10 +405,10 @@ </g> </g> <g - style="display:inline" + style="display:inline;opacity:0.722;filter:url(#filter4280)" id="g6237-2" - transform="matrix(-0.36912126,0,0,0.50086084,-308.46763,410.34937)" - inkscape:export-filename="/usr/src/prj/demos/bussi/data/puu_pv_2.png" + transform="matrix(-0.34052556,0,0,0.46205932,-296.45148,423.83312)" + inkscape:export-filename="/home/ccr/bussi/data/puu_pv_2.png" inkscape:export-xdpi="90.133705" inkscape:export-ydpi="90.133705"> <g @@ -439,46 +472,68 @@ x="408.21429" y="-122.85714" /></text> <g - id="g4283" - inkscape:export-filename="/usr/src/prj/demos/bussi/data/viitta.png" + id="g4301" + inkscape:export-filename="/home/ccr/bussi/data/viitta.png" inkscape:export-xdpi="90" - inkscape:export-ydpi="90"> + inkscape:export-ydpi="90" + transform="matrix(0.39901059,0,0,0.39901059,241.68359,-169.32282)"> + <rect + y="-281.19077" + x="411.03796" + height="168.48019" + width="5.3405647" + id="rect3467" + style="fill:url(#linearGradient4275);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.71019775px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> + <rect + y="-281.74011" + x="613.04401" + height="168.48019" + width="5.3405647" + id="rect3467-1" + style="display:inline;fill:url(#linearGradient4275-5);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.71019775px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> <g - id="g4270"> - <rect - style="opacity:1;fill:#4696ca;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:6.80000019;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:20;stroke-opacity:1" - id="rect4250" - width="224.28572" - height="61.42857" - x="387.14285" - y="-167.14285" - rx="0" - ry="0" /> - <path - style="display:inline;opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:3.12277818;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:20;stroke-opacity:1" - d="m 393.57214,-164.73146 189.20432,0 24.73218,29.37432 -24.37503,27.23147 -189.56147,0 c -2.2259,0 -4.01788,-1.79198 -4.01788,-4.01788 l 0,-48.57003 c 0,-2.2259 1.79198,-4.01788 4.01788,-4.01788 z" - id="rect4250-2" - inkscape:connector-curvature="0" - sodipodi:nodetypes="scccssss" /> - <path - style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.29999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:20;stroke-opacity:1" - d="m 576.90455,-108.21429 0,-56.42857 5.77959,0.33252 24.39744,28.23891 -23.66406,27.33575 z" - id="path4268" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cccccc" /> + transform="translate(15,-108.70269)" + inkscape:export-ydpi="90" + inkscape:export-xdpi="90" + inkscape:export-filename="/usr/src/prj/demos/bussi/data/viitta.png" + id="g4283"> + <g + id="g4270"> + <rect + ry="0" + rx="0" + y="-167.14285" + x="387.14285" + height="61.42857" + width="224.28572" + id="rect4250" + style="opacity:1;fill:#4696ca;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:6.80000019;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:20;stroke-opacity:1" /> + <path + sodipodi:nodetypes="scccssss" + inkscape:connector-curvature="0" + id="rect4250-2" + d="m 393.57214,-164.73146 189.20432,0 24.73218,29.37432 -24.37503,27.23147 -189.56147,0 c -2.2259,0 -4.01788,-1.79198 -4.01788,-4.01788 l 0,-48.57003 c 0,-2.2259 1.79198,-4.01788 4.01788,-4.01788 z" + style="display:inline;opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#ffffff;stroke-width:3.12277818;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:20;stroke-opacity:1" /> + <path + sodipodi:nodetypes="cccccc" + inkscape:connector-curvature="0" + id="path4268" + d="m 576.90455,-108.21429 0,-56.42857 5.77959,0.33252 24.39744,28.23891 -23.66406,27.33575 z" + style="opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:3.29999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:20;stroke-opacity:1" /> + </g> + <text + xml:space="preserve" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32.9078064px;line-height:89.99999762%;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + x="512.54913" + y="-116.90852" + id="text4279" + sodipodi:linespacing="89.999998%" + transform="scale(0.93976837,1.064092)"><tspan + sodipodi:role="line" + id="tspan4281" + x="512.54913" + y="-116.90852">JOROINEN</tspan></text> </g> - <text - transform="scale(0.93976837,1.064092)" - sodipodi:linespacing="89.999998%" - id="text4279" - y="-116.90852" - x="512.54913" - style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:32.9078064px;line-height:89.99999762%;font-family:Arial;-inkscape-font-specification:Arial;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - xml:space="preserve"><tspan - y="-116.90852" - x="512.54913" - id="tspan4281" - sodipodi:role="line">JOROINEN</tspan></text> </g> </g> <g
--- a/config.mak Fri May 22 03:24:21 2015 +0300 +++ b/config.mak Sat May 23 03:19:49 2015 +0300 @@ -2,6 +2,8 @@ DEMO_BIN=demo DEMO_OBJS=demo.o dmsimple.o +EXTRA_CFLAGS=-O3 + TOOL_BINPATH=bin/ TESTS_BINPATH=$(TOOL_BINPATH)
--- a/data/skrolli.txt Fri May 22 03:24:21 2015 +0300 +++ b/data/skrolli.txt Sat May 23 03:19:49 2015 +0300 @@ -1,7 +1,6 @@ -... Well, hello there .. this is a small and silly prod for the Simulaatio 6 -demo competition. ccr of TNSP on da keys now, sending greetings to all the -people here at Simulaatio! And super mega extra greetings to following -elitez: viznut, nrg, bass cadet, ... +... Well, hello there .. ccr on da keys now, sending greetings to all the +people here at Simulaatio! And super mega greetings to following: +byterapers, phn, visy, fgcl, viznut, nrg, bass cadet, ... \ No newline at end of file
--- a/demo.c Fri May 22 03:24:21 2015 +0300 +++ b/demo.c Sat May 23 03:19:49 2015 +0300 @@ -43,16 +43,30 @@ typedef struct { int layer; + int freq; + int max; + float ypos; + float speed; char *filename; SDL_Surface *img; + int count; } DMItemDef; -DMItemDef items[] = +typedef struct { - { 1, "viitta.png", NULL }, - { 1, "puu_pv_1.png", NULL }, - { 0, "puu_pv_2.png", NULL }, + BOOL enabled; + float xtime, xpos, ypos; + DMItemDef *ref; +} DMFooItemDef; + + +static DMItemDef items[] = +{ + { 0, 3, 1, 0.53, 0.2, "viitta.png", NULL, 0 }, + { 0, 1, 3, -0.2, 0.05, "pilvi.png", NULL, 0 }, + { 0, 1, 3, 0.28 , 0.1 , "puu_pv_2.png", NULL, 0 }, + { 1, 9, 2, 0.25 , 0.8 , "puu_pv_1.png", NULL, 0 }, }; static const int nitems = sizeof(items) / sizeof(items[0]); @@ -230,6 +244,38 @@ } +static DMItemDef * dmGetItem(int t) +{ + int i; + for (i = 0; i < nitems; i++) + { + DMItemDef *def = &items[i]; + if (t % def->freq == 0 && def->count <= def->max) + return def; + } + return NULL; +} + + +static void dmRenderItems(DMEngineData *engine, DMScaledBlitFunc ablit, DMFooItemDef *mitems, const int nmitems, const int layer) +{ + int i; + for (i = 0; i < nmitems; i++) + { + DMFooItemDef *item = &mitems[i]; + + if (item->enabled && item->ref->layer == layer) + { + ablit(item->ref->img, + dmCX(engine, item->xpos), + dmCY(engine, item->ypos), + dmQX(engine, item->ref->img, 1), + dmQY(engine, item->ref->img, 1), + engine->screen); + } + } +} + static int demoRender(DMEngineData *engine) { @@ -312,13 +358,58 @@ cblit(tausta, x2, 0, dmQX(engine, tausta, 1), dmQY(engine, tausta, 1), engine->screen); } - float qm = sin(t * 0.1 + fftPow * 5) * 15, qm2 = qm*2; + float qm = sin(t * 0.1 + fftPow * 5) * 0.05, qm2 = qm * 10; dmScaledBlitSurface32to32TransparentGA(aurinko, - dmCX(engine, 0.8 - dmLerpSCurveClamp(&fadeLerp3, engineGetTime(engine, 0) * 0.01) * 0.3 ) - qm, - dmCY(engine, 0.05) - qm, - aurinko->w + qm2, aurinko->h + qm2, + dmCX(engine, 0.8 - dmLerpSCurveClamp(&fadeLerp3, engineGetTime(engine, 0) * 0.01) * 0.3 - qm), + dmCY(engine, 0.05 - qm), + dmQX(engine, aurinko, 1 + qm2), + dmQY(engine, aurinko, 1 + qm2), engine->screen, fadeVal); + // Puut ym. liikennejutut + #define DM_MAX_MITEMS 16 + static DMFooItemDef mitems[DM_MAX_MITEMS]; + if (t > 6) + { + float dt = (t - 6); + static BOOL nollattu = FALSE; + int i; + + if (!nollattu) + { + memset(mitems, 0, sizeof(mitems)); + nollattu = TRUE; + } + + for (i = 0; i < DM_MAX_MITEMS; i++) + { + DMFooItemDef *item = &mitems[i]; + if (!item->enabled && (item->ref = dmGetItem((int) t * 10 + 1)) != NULL) + { + item->enabled = TRUE; + item->ref->count++; + item->xtime = dt; + item->ypos = item->ref->ypos + sin(dt) * 0.001f; + } + } + for (i = 0; i < DM_MAX_MITEMS; i++) + { + DMFooItemDef *item = &mitems[i]; + if (item->enabled) + { + float xpos = (dt - item->xtime) * item->ref->speed; + if (xpos > 1.5) + { + item->enabled = FALSE; + item->ref->count--; + } + else + item->xpos = 1 - xpos; + } + } + } + + dmRenderItems(engine, ablit, mitems, DM_MAX_MITEMS, 0); // Bussi ajaa sisään if (t > 14) @@ -327,7 +418,7 @@ dt = engineGetTime(engine, 14), ajelu = dmLerpSCurveClamp(&fadeLerp3, dt), xc = dmCX(engine, -1 + ajelu), - yc = dmCY(engine, 0.35 + sin(t * 10) * 0.005), + yc = dmCY(engine, 0.38 + sin(t * 10) * 0.005), yc2 = yc + dmQY(engine, bussi, 0.7) + dmCY(engine, sin(t * 20) * 0.001); ablit(rengas, xc + dmQX(engine, bussi, 0.07), yc2, dmQX(engine, rengas, 1), dmQY(engine, rengas, 1), engine->screen); @@ -335,11 +426,7 @@ ablit(bussi, xc, yc, dmQX(engine, bussi, 1), dmQY(engine, bussi, 1), engine->screen); } - - // Puut ym. liikennejutut - if (t > 10) - { - } + dmRenderItems(engine, ablit, mitems, DM_MAX_MITEMS, 1); } // @@ -430,26 +517,10 @@ } - { - static DMScaledBlitFunc cblit = NULL; - static SDL_Surface *maski = NULL; - static BOOL nollattu = FALSE; - - if (!nollattu) - { - engineGetResImage(engine, maski, "maski.png"); - cblit = dmGetScaledBlitFunc(maski->format, engine->screen->format, DMD_TRANSPARENT); - } - - cblit(maski, - 0, 0, - dmQX(engine, maski, 1), - dmQY(engine, maski, 1), - engine->screen); - } - + // // Skrolleri - if (t > 2) + // + if (t > 3) { int tt = engineGetTime(engine, 2); static DMScaledBlitFunc cblit, qblit; @@ -485,7 +556,9 @@ } } + // // Loppufeidi + // if (t > 70) { static DMLerpContext fadeLerp; @@ -503,6 +576,28 @@ dmLerpSCurveClamp(&fadeLerp, fadeTime)); } + // + // Maskaus + // + { + static DMScaledBlitFunc cblit = NULL; + static SDL_Surface *maski = NULL; + static BOOL nollattu = FALSE; + + if (!nollattu) + { + engineGetResImage(engine, maski, "maski.png"); + cblit = dmGetScaledBlitFunc(maski->format, engine->screen->format, DMD_TRANSPARENT); + } + + cblit(maski, + 0, 0, + dmQX(engine, maski, 1), + dmQY(engine, maski, 1), + engine->screen); + } + + if (t > 75) return 1; else