Author Topic: [HTML5] How to get started with TinyC5  (Read 24411 times)

0 Members and 1 Guest are viewing this topic.

Offline jace_stknights

  • Amiga 1200
  • ****
  • Posts: 399
  • Karma: 32
  • PEEK & POKE are not MOVEM!
    • View Profile
    • ST Knights WebSite
Re: [HTML5] How to get started with TinyC5
« Reply #20 on: December 07, 2011 »
Nevertheless, it is still possible to additionally add normal canvas operation on the resulting output canvas. Refer to Example 06 and have a look how the text is drawn on the canvas. It's all handled in the tinyC5.postUpdate().

Thanks Benny,

I will make the effect I was thinking of alongside a genuine TinyC5 pixel effect.

Yep I've made a heavy use of the two way :D

I've also merged CODEF with TinyC5, but it will be for a next compo  ;D
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: [HTML5] How to get started with TinyC5
« Reply #21 on: December 07, 2011 »
...
Thanks Benny,

I will make the effect I was thinking of alongside a genuine TinyC5 pixel effect.

Cool! Looking forward to see it!

...
(Already made tunnel, plasma, zoomer effects  ;D)

Huhu back to my code... Hum at the end, I will produce a mega demo  :bfuck2:

Woot ... wow .. that sounds awesome.  O0
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline jace_stknights

  • Amiga 1200
  • ****
  • Posts: 399
  • Karma: 32
  • PEEK & POKE are not MOVEM!
    • View Profile
    • ST Knights WebSite
Re: [HTML5] How to get started with TinyC5
« Reply #22 on: December 07, 2011 »
The problem is that all my effects are "common". I hope to find a original one up to the 24th of december  :P
Guys like Raizor, Shockwave, Padman, Combatking0, Hellfire, Rbz, and so on (and even you ;) ) will do!

Have to work hard if I don't want to make up the numbers here!  ;)


Challenge Trophies Won:

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1215
  • Karma: 230
    • View Profile
    • Homepage
Re: [HTML5] How to get started with TinyC5
« Reply #23 on: December 08, 2011 »
I got a few questions, sorry if they seem obvious or weird...

- Where can I find a command list or something, the docs only contain a todo list and changelog?
- How do I get or set specific pixel color values?
- This is prolly my animation brain talking but where is the framrate determined? For my old js games I used an interval timer which called a redraw function, what is making it tick here and at what speed?

PS I find the code bits in the examples quite elegant, some clever coding there!  :cheers:
www.kirl.nl
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: [HTML5] How to get started with TinyC5
« Reply #24 on: December 08, 2011 »
...
- Where can I find a command list or something, the docs only contain a todo list and changelog?

Unfortunately, I havent had the time to research a good javascript documentator. Please refer to the public functions descriptions within the TinyC5 code (all functions declared like this:
Code: [Select]
this.functionName = function( .. ) {
}
are publically available. I tried to do my best to added as explicit comments to their headers. Nevertheless, you are write I should provide a better docs for the functions. I will work on that!

- How do I get or set specific pixel color values?

For example to set a pixel at point (100,10) here is the equivalent code:

Code: [Select]
    var destY = 10, destX=100, pixelIndex;
    pixelIndex = ( destX * 4 ) + ( tinyC5.WIDTH * destY * 4);
    tinyC5.pixels[ pixelIndex   ] = 0;      // Red color value (0-255)
    tinyC5.pixels[ pixelIndex+1 ] = 255;    // Green color value (0-255)
    tinyC5.pixels[ pixelIndex+2 ] = 0;    // Blue color value (0-255)
    tinyC5.pixels[ pixelIndex+3 ] = 255;    // Alhpa value (0-255)

I multiply with 4 because each pixel contains of the following single values: Red, Green, Blue, Alpha.

- This is prolly my animation brain talking but where is the framrate determined? For my old js games I used an interval timer which called a redraw function, what is making it tick here and at what speed?

Framerate is set to constant 60fps. Nothing to do about this, because some browsers already implement natively a function called requestAnimationFrame() which is also set to 60fps.

PS I find the code bits in the examples quite elegant, some clever coding there!  :cheers:

Thanks ;-)
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: [HTML5] How to get started with TinyC5
« Reply #25 on: December 09, 2011 »
I have worked out how to draw a line in individual pixels. Now I can add a TinyC5 effect to the lines themselves :)
You are our 9001st visitor.
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: [HTML5] How to get started with TinyC5
« Reply #26 on: December 09, 2011 »
I have worked out how to draw a line in individual pixels. Now I can add a TinyC5 effect to the lines themselves :)

Sounds cool. Good news!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline combatking0

  • JavaScript lives!
  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4569
  • Karma: 235
  • Retroman!
    • View Profile
    • Combat King's Barcode Battler Home
Re: [HTML5] How to get started with TinyC5
« Reply #27 on: December 10, 2011 »
- Where can I find a command list or something, the docs only contain a todo list and changelog?

I use the following site as a javascript reference:
http://www.w3schools.com/js/default.asp

It won't contain anything specific to TinyC5, but it will help anyone who is new to JS in general.
You are our 9001st visitor.
Challenge Trophies Won:

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1215
  • Karma: 230
    • View Profile
    • Homepage
Re: [HTML5] How to get started with TinyC5
« Reply #28 on: December 14, 2011 »
Thanks for the help benny, I'm up and running now! :)

w3schools is a great resource I haven't checked in a while, thanks CK!
« Last Edit: December 14, 2011 by Kirl »
www.kirl.nl
Challenge Trophies Won:

Offline Kirl

  • Senior Member
  • Pentium
  • ********
  • Posts: 1215
  • Karma: 230
    • View Profile
    • Homepage
Re: [HTML5] How to get started with TinyC5
« Reply #29 on: December 16, 2011 »
Does anybody have an easy solution for a performance indicator like an fps counter?
www.kirl.nl
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: [HTML5] How to get started with TinyC5
« Reply #30 on: December 17, 2011 »
Does anybody have an easy solution for a performance indicator like an fps counter?

Definately. I would recommend:

https://github.com/mrdoob/stats.js?utm_source=javascriptweekly&utm_medium=email

It's simple easy to get them working. Pseudocode:

Code: [Select]
var stats = new Stats();

// Align top-left
stats.domElement.style.position = 'absolute';
stats.domElement.style.left = '0px';
stats.domElement.style.top = '0px';

document.getElementsByTagName('body')[0].appendChild( stats.domElement );

tinyC5.update = function() {
    stats.update();
}
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline jace_stknights

  • Amiga 1200
  • ****
  • Posts: 399
  • Karma: 32
  • PEEK & POKE are not MOVEM!
    • View Profile
    • ST Knights WebSite
Re: [HTML5] How to get started with TinyC5
« Reply #31 on: December 17, 2011 »
 :clap: my favorite  :updance:
« Last Edit: December 17, 2011 by jace_stknights »
Challenge Trophies Won:

Offline jace_stknights

  • Amiga 1200
  • ****
  • Posts: 399
  • Karma: 32
  • PEEK & POKE are not MOVEM!
    • View Profile
    • ST Knights WebSite
Re: [HTML5] How to get started with TinyC5
« Reply #32 on: December 18, 2011 »
A question for Benny!

when I use the script ( http://www.greywyvern.com/code/php/binary2base64 ) to encode binary (music), if I want to decode it to plain/text (base64 decode) with the atob() javascript function I have to remove the start and the end of the text

"data:text/plain;base64,IQYtbGg1LWsRAADfJQIAAgD9EiAAC1NZTlRIRDUuQklOk... .... %3D" in bold

Have you got a technique or a function that auto-remove this? thanx
Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: [HTML5] How to get started with TinyC5
« Reply #33 on: December 19, 2011 »
Hmm ... would it be enough if you simply remove the header and trailing part with some string manipulation functions. Something like:

Code: [Select]
base64String.replace( "data:text/plain;base64,", "" );
base64String.replace( "%3D", "" );

Would this work for you?
« Last Edit: December 19, 2011 by benny! »
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: [HTML5] How to get started with TinyC5
« Reply #34 on: December 19, 2011 »
Or doing something similar with slice/subsring.
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won:

Offline jace_stknights

  • Amiga 1200
  • ****
  • Posts: 399
  • Karma: 32
  • PEEK & POKE are not MOVEM!
    • View Profile
    • ST Knights WebSite
Re: [HTML5] How to get started with TinyC5
« Reply #35 on: December 19, 2011 »
Huhu yep I know this, but I thought about a special function that remove this "header" :D It will works for everything :P Hmmm I think there nothing :D
Challenge Trophies Won:

Offline Fol

  • ZX 81
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Re: [HTML5] How to get started with TinyC5
« Reply #36 on: February 03, 2012 »
Nice tutorial, thanks !

Quote
Thanks for the "K" ... guess most of the coders here don't need that tutorial - but maybe its useful for one or the other. In addition, I hope to pull some non-forum members into this forum (tutorial is also linked from google code). Will see ...

And you where right about pulling some non-forum members here ; )

Offline benny!

  • Senior Member
  • DBF Aficionado
  • ********
  • Posts: 4384
  • Karma: 228
  • in this place forever!
    • View Profile
    • bennyschuetz.com - mycroBlog
Re: [HTML5] How to get started with TinyC5
« Reply #37 on: February 04, 2012 »
Nice tutorial, thanks !

Thanks ;-)

Quote
Thanks for the "K" ... guess most of the coders here don't need that tutorial - but maybe its useful for one or the other. In addition, I hope to pull some non-forum members into this forum (tutorial is also linked from google code). Will see ...

And you where right about pulling some non-forum members here ; )

Hehe ... cool to know, that my tactics work ;-)

So,  :hi: to the forum!
[ mycroBLOG - POUET :: whatever keeps us longing - for another breath of air - is getting rare ]

Challenge Trophies Won: