Who's Online |
67 user(s) are online ( 42 user(s) are browsing Forums)
Members: 0
Guests: 67
more...
|
|
|
|
Re: Need help loading Animbrushed using datatype system.
|
Posted on: 2009/1/14 22:36
#2921
|
Home away from home
|
@Wanderer Quote: Wanderer wrote: @LiveForIt
Maybe you can also access it via Picture Datatype using the PDTA_WhichPicture TagItem. It is worh a try.
Picture datatype will only read the first image.
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/14 22:33
#2922
|
Home away from home
|
@Atheist Quote: I have used over 50 (to be safe) AMOS Pro commands, including manipulating a 4 dimensional array with at least 126 elements in it. guess you read the manual to know what all the 50 commands did. Quote: If then ...elseif , while... wend, For...Next, Inkey$, string manipulations (mid$,Left$,Right$), chr$, procedures, Dim/globals, do...loop Exit, exit if, Repeat/until, and have written some fairly complex equations for decision making....
You need a beginners book about C. Quote: printing to/from disk files, 32 bit binary data storage/comparison, read sdk:Documentation/autodocs/dos.doc Quote: drawing boxes/lines/points, opening all 8 screens, read sdk:Documentation/autodocs/ntuition.doc read sdk:Documentation/AutoDocs/graphics.doc if you need 32bit / 16bit graphics read: read sdk:Documentation/AutoDocs/Picasso96API.doc Quote: increasing stack space (had to), read sdk:Documentation/autodocs/dos.doc Quote: gorsub does not exist, goto exists in C,
Edited by LiveForIt on 2009/1/14 23:07:14
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/14 22:12
#2923
|
Home away from home
|
@Atheist Quote: You see, if I ask "how do I change that pixel on the screen to blue?" to set current color to 9 SetAPen(rp,9);to set Plot a pixel on the window at x=159 and y=99 WritePixel(rp,159,99);Basic code: PLot 159,99,9C code: SetAPen(rp,9); WritePixel(rp,159,99);
you need to read the autodocs about graphics library sdk:Documentation/AutoDocs/graphics.doc
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/14 8:36
#2924
|
Home away from home
|
@Atheist Quote: is there case sensitivity? Yes. Only AmigsOS commands use capital chars in start of command name. standard C commands are all lower case. typical format. FirstnameLastname upper chars divides one word form an other word. OpenWindow CloseWindow Quote: And that last bracket seems to be missing the semi-colon. This is why I can not understand C. I can not understand why there isn't a semicolon to the right of the final bracket??
semi-colon divides commands, so you write every thing on one line or on many lines. for example in AMOS you write Locate 15,20 : Print "AMOS is cool" : A=A+10 : B=B-20 you do the same in C, but semi-colon is required after each command unlike in Basic. Locate(15,20); prntf("C is cool\n"); A=A+10; B=B-20; as you see lines ends whit ';' becouse its required that every command ends whit it.
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/14 8:14
#2925
|
Home away from home
|
@Allanon Quote: you can have non-numeric indexes to simulate structures: mytable = { name = "Johnny", surname = "Mnemonic" }
so you can access them with: mytable.name mytable.surname
but this is not a LUA thread
enum Days {Sat=1, Sun, Mon, Tue, Wed, Thu, Fri}; /* Now you have auto numbers. so you don't need to remember numbers. Sat =1 Sun =2 Mon =3 Tue =4 Wen =5 Fri =6 use this in side tables and event handlers, and so as you like. */
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/14 8:01
#2926
|
Home away from home
|
@Atheist
#include <proto/intuition.h> #include <proto/graphics.h> #include <proto/dos.h>
int main(void) { struct Window *window; struct RastPort *rp; int color; int x; int y;
// if window opens
// OpenWindow paramiters starts whit '(' and end's whit ')'
if (window = OpenWindowTags ( NULL, WA_Title,"My window", WA_Left,80, WA_Top,40, WA_Width,400, WA_Height,300, WA_Flags,WFLG_CLOSEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_GIMMEZEROZERO|WFLG_ACTIVATE, WA_IDCMP,IDCMP_CLOSEWINDOW|IDCMP_RAWKEY|IDCMP_INTUITICKS, TAG_END ) { // THEN rp = window->RPort; // Set color to use SetAPen(rp,color); // Draw pixel at x,y WritePixel(rp,x,y); // Wait 20 Delay(20); // You most close the window. CloseWindow(window); } // END IF } // END MAIN FUNC.
to compile the program type
gcc my_prog.c -o my_prog -D__USE_INLINE__ -lauto
you need -D__USE_INLINE__ so you don't need to type
IDOS-> IGraphics-> IIntuition->
you need -lauto so you don't need to open librarys. As the gcc command line gets longer you should put it in AmigaDOS script or makefile.
Edited by LiveForIt on 2009/1/14 22:15:14
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Need help loading Animbrushed using datatype system.
|
Posted on: 2009/1/13 23:40
#2927
|
Home away from home
|
@Hans
bob_type *load_dt_animbrush( char *name ) { Object *dto; struct BitMapHeader *bm_header; struct BitMap *dt_bitmap; struct BitMap *new_bitmap; struct RastPort RP; int lock; struct RenderInfo rinf; char *byte; char tmp; short stmp; short r; short g; short b; char *alfa; ULONG num_images,num; ULONG num_colors; ULONG anim_dept; ULONG *color_regs; unsigned char *plain; int p,color; int format,dept; int pixel_size; int rgb_color; bob_type *new_bob = NULL; bob_type *last_bob = NULL; bob_type *ret = NULL; type_bit *bob_func = NULL; int x,y,xoff,yoff; printf( "load datatype image %s\n",name);
if(dto = (void *) NewDTObject( name, DTA_GroupID, GID_ANIMATION, TAG_DONE)) { SetDTAttrs ( (void *) dto, NULL,NULL, PDTA_DestMode, (ULONG) PMODE_V43,TAG_DONE);
GetDTAttrs ( (void *) dto, ADTA_Frames, &num_images, ADTA_NumColors, &num_colors, ADTA_CRegs, &color_regs, ADTA_Depth, &anim_dept, TAG_DONE);
printf("Num images %d\n",num_images); printf("Num colours %d\n",num_colors); printf("Num anim depth %d\n",anim_dept);
for (color = 0; color<num_colors;color++) { printf ("%d %x,%x,%x\n",color, color_regs[color*3+0]>>24,color_regs[color*3+1]>>24,color_regs[color*3+2]>>24 ); }
if (num_images<1) { printf("Not an animation?\n"); num_images = 1; }
for (num=0;num<num_images;num++) { printf("num %d\n",num); DoDTMethod ( (void *) dto,NULL,NULL,ADTM_LOCATE,num,TRUE);
GetDTAttrs ( (void *) dto,PDTA_BitMapHeader, (ULONG *) &bm_header, ADTA_KeyFrame, (ULONG) &dt_bitmap,TAG_DONE);
// find bit format in dto. pixel_size = p96GetBitMapAttr(__screen_bitmap,P96BMA_BYTESPERPIXEL);
printf("screens pixel size %d\n",pixel_size);
if (!bm_header) { printf("no bm header\n"); break; }
if (new_bob = (void *) malloc(sizeof(bob_type))) { make_bitmap_alfa(new_bob, bm_header -> bmh_Width, bm_header -> bmh_Height, pixel_size); if (ret == 0) ret = new_bob; // set return value
printf( "datatype bitmap 0x%x\n", dt_bitmap); printf( "bob bitmap 0x%x\n", new_bob -> bitmap);
DoDTMethod ( (void *) dto,NULL,NULL,ADTM_LOADFRAME);
bob_func = new_bob -> geo.c; bob_func -> lock(new_bob);
printf( "bob bitmap mem 0x%x\n", new_bob -> memory);
for(y=0;y<new_bob -> geo.h;y++) { for (x=0;x<new_bob -> geo.w;x++) { color = 0;
for (p=0;p<anim_dept;p++) { plain = (unsigned char *) (((ULONG) dt_bitmap -> Planes[p]) + ( dt_bitmap -> BytesPerRow * y)); color += plain[ x >> 8 ] & (x & 255) ? (1<<p) : 0 ; }
rgb_color = bob_func-> color(new_bob,color_regs[color*3+0]>>24,color_regs[color*3+1]>>24,color_regs[color*3+2]>>24 );
printf("%d,%d\n",x,y);
bob_func-> pixel(new_bob, rgb_color ,x,y);
} }
bob_func -> unlock(new_bob);
DoDTMethod ( (void *) dto,NULL,NULL,ADTM_UNLOADFRAME);
if (last_bob) { last_bob -> next = new_bob; } last_bob = new_bob;
} }
DisposeDTObject(dto); } else { printf("%s is loaded as image, not a animbrush!\n"); ret = load_dt_image( name ); }
return ret; }
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/13 23:12
#2928
|
Home away from home
|
@Atheist Quote: Hi LiveForIt,
You lost me.
ptr=0x1000
"x" isn't a number?!? The more I see, the less "normal" it all becomes.
yes it is a number it's a hex number $1000 '0x' = '$'
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/13 23:08
#2929
|
Home away from home
|
@Atheist Quote: I have made a 4 dimensional array in AMOS, as well as many many other arrays and have no problem whatsoever manipulating them. this how you make a 4 dimensional array in C. int values[50][50][50][50]; structures are not the same, the basic idea behind structures is to name content group properties. if you have used virtual basic you know that virtual basic objects have properties for fonts, text, caption, x, y, width, height, index. // count from 0 to 9 for (n=0;n<10;n++) { printf("Car x pos = %d\n",car[n].x); printf("Car y pos = %d\n",car[n].y); printf("Car name = %s\n", name[n].name); } the same code in basic using a 2 dimensional array for n = 0 to 9 step 1 print "Car x pos = " ; car[n,0] print "Car y pos = " ; car[n,1] print "car name = " ; car[n,2] next n the 2en example is harder to read, you need to know that 0 is x, and 1 is y and 2 is name. it's not problem remembering this the day you write it, but if find you find your old source code 5 years later then its hard to remember what 0 is and 1 is and 2 is.
Edited by LiveForIt on 2009/1/13 23:24:59
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/13 22:41
#2930
|
Home away from home
|
@Atheist Quote: To me char *str1; means multiply "char" with "str1".
Thats because this some thing that does not exist in basic, this is an array whit out any defined size and storage space, it called a char pointer, and it's major difference between basic and C. I think you know what this is: char str1[100]; it's array of 100 chars, some programs language define this as strings. I can give you an example of how pointers work: Typical basic program: Quote: ptr=$1000 Rem read one byte form address ptr+0 Print "Get value of peek ="; Peek(ptr+0)
the same program in C Quote: char *ptr; ptr=0x1000; /* Read one byte from address n+0 */ printf("Get value of peek = %d\n",ptr[0]);
This two do the same, the C program does not use a command to read from address 0x1000+0, but uses a special table variable (char pointer). the above examples will give you a DSI error, change the code to; Quote: #include <stdlib.h>
int main() { char *ptr; // reserves 100 bytes at any address ptr = malloc(100); printf("Get value of peek = %d\n",ptr[0]); // frees 100 bytes after use. free(ptr); }
A better way to read and write chars, are to use sscanf(), sprintf().
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/13 18:58
#2931
|
Home away from home
|
@Allanon Quote: In Hollywood you can force <number> to be globally or locally declared with:
Global number = 5 or Local number = 5
If you declare a variable outside a function it?s a global variable in C. If you declare it inside a function it?s a local variable. Quote: // var is global int var;
Int main() { // var is local int local_var; }
Your example: Quote: number = 5 ; <--- numeric type number = "five" ; <--- string type number = { "one", "two", 3, 4, "five" } ; <--- table of mixed types
C does not allow you to change types, but you can do it anyway. ULONG number; number = 5; number = (ULONG) ?five?; // ask address of ?five? to become a unsigned long value. I don?t know what you?re trying to do whit the last line; I think a structure might be better. A structure is a way to group variables. Struct { char *str1; char *str2; int value1; int value2; char *str3; } my_value_type; struct my_value_type my_values={ "one", "two", 3, 4, "five" }; printf(? string 2 = %s\n?,my_values.str2); printf(? value 1 = %d\n?,my_values.value1); If you need a table of grouped variables you can do that like this: struct my_value_type my_values[50]; Let?s say you have 50 objects they all have an x and y coordinate and maybe a name, then a structure is how you organize all variables.
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/13 18:27
#2932
|
Home away from home
|
@Atheist a working C program for setting value to 5, and display it. Quote: /* program should always start whit this two lines. */ #include <stdlib.h> #include <stdio.h>
/* C requires the program code to be inside a function, main is where the program starts. */ Int main() { /* value is of type signed integer (negative and positive values)*/ int value; /* value is set to 5 */ value=5; /* formatted print, '%d' is replaced by a decimal value, ?\n? equals ?new line? */ printf(?value is %d\n?,value); }
save the file as my_prog.c To compile the program you type this in shell Stack 500000 gcc my_prog.c ?o my_prog.exe to start the program type: Prog.exe
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/13 18:02
#2933
|
Home away from home
|
@Atheist Quote: how would I go about saying the variable "number" is now "5"? Provided you write good basic code it more work. Virtual Basic example:Rem number is of type integer Dim number as integer Rem set number to 5 number = 5 C example:// number is of type integer Int number; // set number to 5 number = 5; Or if you like the short version:// Number is of type integer and is default to number 5. Int number=5; C requires you to define type of variables; basic does not but if you don?t Virtual Basic programs get slower, if you do define variables in Basic you well not get warning if your destination variables is too small hold number, but under C you will get warnings like that.
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/13 17:42
#2934
|
Home away from home
|
@Hans Quote: Basic/Amos looks "intuitive" to you because you're used to it, but it is actually a poor programming language when compared to modern ones. I spend most of my time in Basic, until I switched to C. I most say some thing about difference in tow languages. Baisc is a safe language, all commands provided have some kind of error handler, hard to crash, easy to debug, but is limited to tiny subset of commands provided whit basic dialect, and if there is bugs or problems whit the language there is nothing you can do about it, its slow compared to C and other languages because does not give the developer any way to optimize there code, there are many dialects of basic its not always easy to take one source code and make work on Linux and AmigaOS. C is a bit more low level, it?s designed to be easy to write complex programs, its reads and writes directly to memory, and developer most take responsibility for memory usage, if you do some thing wrong the operating system might crash, you have full access to any OS library?s, so its easy to take advantage of new features in the OS, there are more syntaxes in the language, but this most not be confused as being harder to understand, C is an universal language, and there exists standard commands in glibc or newlib, so you can write one program that will work on Windows, Linux and AmigaOS. In many cases Basic will do what you need for application development, because it?s easy to debug, and because commands provided are easier to use, there are better examples and documentations and it takes where little time to make a program, but often Basic is too slow, often the language will restrict you in some way, and it?s impossible to write a system libraries or devices in Basic. C programs are better because the operating system is written in that language, so when you need 64bit DOS support or 64bit file system support, maybe there some new Reaction classes, or some MiniGL commands or some thing and Basic does not support what your tiring to do, then there you have no choice, maybe you found cool program written for Linux you like to rewrite so supports AmigaOS4.x. As I?m trying to point out is there are disadvantages and advantages to Basic and C.
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Need help loading Animbrushed using datatype system.
|
Posted on: 2009/1/13 8:29
#2935
|
Home away from home
|
@LiveForIt
Are there any working examples out there, Anim brushes, must have been popular whit game development.
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/12 17:53
#2936
|
Home away from home
|
@Allanon Quote: I've played with E many years ago and IIRC it's much more simple and "natural" then C. I don?t agree, and I don?t like how E uses () where C uses [], E uses old Pascal Equal symbol := where C uses =. I really don?t see the benefit of the Amiga E language over C. C uses { and } symbol to indicate start of some thing and end of some thing, it might be confusing at first, but once you have read a few C source codes is not that hard to understand. "For" example in C:For (a=0;a<=100;a++) { printf(?counter %d\n?,a); } "For" example in Basic.For a=0 to 100 step 1 Print ?counter ?;a Next a Procedure example in CVoid my_procedure( int value1, int value2 ) { } // end of procedure Procedure example in AMOSProcedure my_procedure[value1,value2] End procedure
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
|
Posted on: 2009/1/12 17:18
#2937
|
Home away from home
|
Need help loading Animbrushed using datatype system?
What I need to is load one frame, decode the planar graphics to the native video mode (16 or 32bit).
Does any one know how to do it?
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/11 17:12
#2938
|
Home away from home
|
@Atheist
AmiBlitz is maybe the best basic launuage you can get that will work on AmigaoS4.x, it does not produce native PowerPC machine code, but thats the only disadvantage.
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Doesn't Seem to be Any Programing Languages for AOS4 for the Average Person
|
Posted on: 2009/1/11 15:42
#2939
|
Home away from home
|
@Atheist
your wasting your time whit Basic, go and learn C its the only language that can make full use of AmigaOS, besides "portable E" and PowerPC assembler.
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|
Re: Workbench hotkeys
|
Posted on: 2009/1/11 15:39
#2940
|
Home away from home
|
@Lio
In that case typing this in uboot should work.
setenv kbddev_norwin yes saveenv
Edited by LiveForIt on 2009/1/11 16:58:38
|
(NutsAboutAmiga)
Basilisk II for AmigaOS4 AmigaInputAnywhere Excalibur and other tools and apps.
|
|
|