Welcome, Guest. Please login or register.

Author Topic: How to program Intuition Example in Storm C.  (Read 2963 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Thomas

Re: How to program Intuition Example in Storm C.
« on: October 24, 2003, 01:00:29 PM »

Well, StormC is like any other C, so every example should work. I don't have my Storm C installation here at work, so I cannot verify now if there are some specialties to attend.

Here is an example that works great with Dice C and VBCC. From my experience there should be no difficulty with Storm C.


#include
#include
#include

int main (int argc,char **argv)
{
BOOL cont;
struct Window *win;
struct RastPort *rp;
struct MsgPort *port;
struct IntuiMessage *mess;

if (win = OpenWindowTags (NULL,
      WA_Left,20,WA_Top,10,
      WA_Width,200,WA_Height,50,
      WA_Title,"My Window",
      WA_Flags,WFLG_CLOSEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_ACTIVATE|WFLG_GIMMEZEROZERO,
      WA_IDCMP,IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY,
      TAG_END))
   {
   port = win->UserPort;
   rp = win->RPort;

   SetDrMd (rp,JAM2);
   SetAPen (rp,1);
   SetBPen (rp,2);
   Move (rp,10,20);
   Text (rp,"Close me !",10);

   cont = TRUE;
   while (cont)
      {
      WaitPort (port);
      while (mess = (struct IntuiMessage *) GetMsg (port))
         {
         switch (mess->Class)
            {
         case IDCMP_CLOSEWINDOW:
            cont = FALSE;
            break;
         case IDCMP_VANILLAKEY:
            if (mess->Code == 0x1b) /* Esc */
               cont = FALSE;
            break;
            }
         ReplyMsg ((struct Message *)mess);
         }
      }

   CloseWindow (win);
   }

return (0);
}


Bye,
Thomas

Offline Thomas

Re: How to program Intuition Example in Storm C.
« Reply #1 on: October 24, 2003, 02:11:13 PM »
Quote

Piru wrote:
...and to make it work on all amiga compilers, use:
#include
#include
#include



Erm, no. Dice C has heavy problems with register calls (proto/xxx includes pragma/xxx). Sometimes it uses A6 as a scratch register after it has loaded the library base into it and other faults. Also it easily runs out of registers.

Bye,
Thomas