News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

sinus, cosinus table with cpctelera ?

Started by funkheld, 09:20, 20 July 20

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

funkheld



Hi good afternoon.

- I'm looking for a sine, cosine table fed cpctelera.
i want to turn lines.

- how can you pleaseimplement the "tag" command from basic for cptcelera?

thanks
greeting

ervin

For sine and cosine tables, you can define arrays with 360 elements.
And then you can include math.h, and use the sin() and cos() functions to calculate the tables.
Or you can use a different language to calculate the tables for you and save the data to text files, which you can simply include in your code.

cpctelera lets you print a character at any byte horizontally (so there are 80 possibilities), and on any raster line (200 possibilities).
However for TAG(), you'd need to print at pixel-level horizontally, which cpctelera doesn't have a function for.


funkheld

#2
hello, thanks for the info

there is a math.h somewhere in cpctelera?
what should the table look like for this sin / cos? how then is math.h used for this.
I'm looking for a small example for cpctelera.


the important sin / cos is part of the graphics.
I am surprised that this was not installed by the developers. the sprites just up / down right / left is little.
you should also be able to set a sprite at a certain angle.


greeting

teopl

there is only one header file in cpctelera and it misses a lot of features usually for a good reason. (memory and "speed" limitation).

you have very good manual with all the functions listed and explained so if you can't find it there, it is not implemented.

so if you want a function and it's not there, you must create it. (maybe some of those missing will be added later)

when I started with the retro development it was also strange to me how limited I am, but soon it became also something which is very interesting to overcome - I guess that is one of the main reasons why someone develops for Amstrad instead for modern computer)

funkheld


i wish the young people had as much courage to do cpctelera as i did at 71 years old from germany. I think there would be more programs. 8) 
my english skills are poor.

greeting

awergh

math.h is a standard C header file and is included with SDCC.

I would suggest trying to avoid needing to use any floating point because it is slower and will require more memory.

funkheld


math.h is not intended for the CPC from sdcc.

greeting

andycadley

Quote from: funkheld on 16:05, 20 July 20

you should also be able to set a sprite at a certain angle.

Drawing sprites at arbitrary angles is an expensive operation. Even 16-bit consoles like the Megadrive and SNES typically needed extra hardware for effects like that.


Instead most 8-bit (and 16-bit) games handle it by having pre-drawn animation frames that make it look like a sprite has rotated. That typically limits the number of available angles, but on a low res screen that usually isn't much of a problem.


Likewise with sin/cos tables, you can use them to some extent but generally you want to avoid it because there are often better tricks to accomplish similar effects that you might use trig for on a more modern platform.

Powered by SMFPacks Menu Editor Mod