Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TImage with "new"... 1

Status
Not open for further replies.

lobodo44

Technical User
Sep 8, 2003
27
CA
I'm making a game and I have created a new kind of object from TImage but I just added some properties. But now I need to create an object to make things appear on game. I tried with the new but it didn't worked. Here is what I tried.(TSpaceObj is my new TImage thing)


TSpaceObj *rock = new TSpaceObj;
 
Check the params for the constructor of the TSpaceObj.
If this is a class without params then try this
TSpaceObj *rock = new TSpaceObj();

--- LastCyborg ---
 
Here is the declaration of the function untouch.

inline __fastcall TSpaceObj(TComponent* Owner);

I don't understand that. What can I put as an owner? I tried the form but it didnt worked.
 
Below is a short sample. "this" is a pointer to the object for which the function is called.

TImage *im;
//-----------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
im=new TImage(this);
}
//---------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
im->Parent=this;
im->Left=0;
im->Top=0;
im->Width=1200;
im->Height=1200;;
im->Visible=true;
im->Picture->LoadFromFile("C:\\sc9.bmp");
}
//---------------------------------------------------------
void __fastcall TForm1::FormDestroy(TObject *Sender)
{
delete im;
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top