Welcome, Guest. Please login or register.

Author Topic: "Close Window" tutorial errors  (Read 3939 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline cycloidTopic starter

  • Full Member
  • ***
  • Join Date: Jun 2002
  • Posts: 155
    • Show all replies
"Close Window" tutorial errors
« on: May 10, 2003, 02:44:46 PM »
well i've scoured the "Amiga C Tutorial" website at liquido2.com for an email link but cant find one, so i'll post it here. i got my first amiga window runnig using the source but found some "issues" with the code that needed debugging, here they are:


>45                struct IntuiText *MyText;

this fills me with dread, surely that should be:

>45                struct IntuiText *MyText = new IntuiText;

but does that mean i have to "free" it when i shutdown?



>54                PrintIText( MyWindow->RPort, MyText, 0, 0 );

changing it to this:

>54                PrintIText( MyWindow->RPort, MyText, MyWindow->BorderLeft, MyWindow->BorderTop );

offsets it into the window's window bit. i learnt that by reading intuition.h :-)




>104           CloseLibrary( (struct Library *)IntuitionBase );

This caused shell lockups and all sorts of memory trouble, it worked cleanly when i made it:

>104           CloseLibrary( IntuitionBase );




also

>106
>107    return 0;
>108
>109 }


cycloid - willing and able C++ coder who's struggling through lack of documentation!
 

Offline cycloidTopic starter

  • Full Member
  • ***
  • Join Date: Jun 2002
  • Posts: 155
    • Show all replies
Re: "Close Window" tutorial errors
« Reply #1 on: May 11, 2003, 02:02:58 PM »
being a migrating winblows C++ coder i'd expect to use malloc (and thus having it auto-freed for me if i'm feeling lazy :) ) but i thought i'd better check first.

i'll get me a dev CD but of course that involves £££ and i have zero at the moment... anyone up for a swap of some kind? i've a spare 1200 :-)

 

Offline cycloidTopic starter

  • Full Member
  • ***
  • Join Date: Jun 2002
  • Posts: 155
    • Show all replies
Re: "Close Window" tutorial errors
« Reply #2 on: May 12, 2003, 04:14:02 PM »
i realised later that i'm doing things in C++ so actually just doing a "new" should do the allocing tracking for ya shouldnt it as a strcut is a class is an object in c++ innit! :-)


oh and the C++ thing goes for the (Library *) cast mentioned earlier. if IntuitionBase is a type of Library then any function that accepts a Library * will accept an IntuitionBase * by order of inheritance. of course if i want to do an IntuitionBase * thing in particular then the function would have to re-cast it back from a Library * ... i do lots of class based game type coding on the winblows box (e.g. a player is of type monster is of type animating is of type Entity)

C++ rules  :-D
 

Offline cycloidTopic starter

  • Full Member
  • ***
  • Join Date: Jun 2002
  • Posts: 155
    • Show all replies
Re: "Close Window" tutorial errors
« Reply #3 on: May 13, 2003, 02:32:24 PM »
Quote

Changing the internals of my Mem interface class is easy and doesn't break any of my application code


now i'm curious, a bunch of #ifdefs? i'm targetting a mini-game for os4 along the lines of minesweeper (along those lines meaning, just a small game that gets really hard so you can play it instead of working) ... but of course if i'm beginning coding it in 3.1 then it might get released for that too :-) ...
 

Offline cycloidTopic starter

  • Full Member
  • ***
  • Join Date: Jun 2002
  • Posts: 155
    • Show all replies
Re: "Close Window" tutorial errors
« Reply #4 on: May 15, 2003, 01:05:17 PM »
heh, i think i baited you off topic though.. but it looks like we're the only one's in here so that's ok :-)

that's pretty much what i suspected and i have a sudden urge to write a nice MM C++ class now. but i think i should get on with trying to load sprites and display them in my new window