Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 12,420 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
STRUCTS #165143
11/02/07 12:25
11/02/07 12:25
Joined: Oct 2007
Posts: 49
Hildesheim, Germany
benni Offline OP
Newbie
benni  Offline OP
Newbie

Joined: Oct 2007
Posts: 49
Hildesheim, Germany
Hello, are Structs in Lite-C compareable to classes in Java?
And it is recommended to make extensive use of self-made Structs?

Re: STRUCTS [Re: benni] #165144
11/02/07 12:35
11/02/07 12:35
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Quote:

Hello, are Structs in Lite-C compareable to classes in Java?




No. Structs are used for datastructures and comes from C, a procedural language. Classes can hold data, too, but not solely. They are inheritable and used in an object oriented scope. I guess you don't know the difference or the meaning of each. Buy a book or read an open book - about C.

Quote:

And it is recommended to make extensive use of self-made Structs?




If it fits your needs, why not?

Last edited by HeelX; 11/02/07 12:36.
Re: STRUCTS [Re: HeelX] #165145
11/02/07 12:47
11/02/07 12:47
Joined: Oct 2007
Posts: 49
Hildesheim, Germany
benni Offline OP
Newbie
benni  Offline OP
Newbie

Joined: Oct 2007
Posts: 49
Hildesheim, Germany
Quote:

I guess you don't know the difference or the meaning of each.




If you are talking about "inheritable" and "object scope" you are wrong, if you mean "struct" and "class" you are closer

Re: STRUCTS [Re: benni] #165146
11/02/07 13:03
11/02/07 13:03
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
So why do you ask here?

Re: STRUCTS [Re: HeelX] #165147
11/02/07 13:21
11/02/07 13:21
Joined: Oct 2007
Posts: 49
Hildesheim, Germany
benni Offline OP
Newbie
benni  Offline OP
Newbie

Joined: Oct 2007
Posts: 49
Hildesheim, Germany
I've got a problem structuring my code, my brother who is a java-programmer but doesn't know C said he would solve it by using a class and after looking at the Lite-c manual he said a Struct could do perhaps. But so far as I read a Struct cannot contain a function or method like a class, so my idea won't work either.

Re: STRUCTS [Re: benni] #165148
11/02/07 13:32
11/02/07 13:32
Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
Machinery_Frank Offline
Senior Expert
Machinery_Frank  Offline
Senior Expert

Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
Maybe you can store a pointer to a function in your struct? Then you might simulate some objects.

But nevertheless it cannot provide the power of classes.


Models, Textures and Games from Dexsoft
Re: STRUCTS [Re: Machinery_Frank] #165149
11/02/07 13:38
11/02/07 13:38
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Functions inside structs are planned, but it will still take some time until this feature reaches us

Re: STRUCTS [Re: FBL] #165150
11/02/07 13:51
11/02/07 13:51
Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
Machinery_Frank Offline
Senior Expert
Machinery_Frank  Offline
Senior Expert

Joined: Nov 2004
Posts: 7,121
Potsdam, Brandenburg, Germany
This is interesting. I just read that classes are on the forecast list.


Models, Textures and Games from Dexsoft
Re: STRUCTS [Re: Machinery_Frank] #165151
11/03/07 01:50
11/03/07 01:50
Joined: Mar 2007
Posts: 677
0x00000USA
M
MrCode Offline
User
MrCode  Offline
User
M

Joined: Mar 2007
Posts: 677
0x00000USA
I would use an init function to get things moving.

Code:

#include <acknex.h>

typedef struct
{
PANEL* tbar;
PANEL* tbuttons;
PANEL* content;
PANEL* mbar;
char tbar_string;
char mbar_options;
float sizex,sizey;
}XPWIN;

void win_init(XPWIN* win)
{
while(1)
{
win.tbuttons.pos_x= win.tbar.pos_x + (win.tbar.size_x - 16);
win.tbar.size_x= clamp(win.tbar.size_x,win.tbuttons.size_x,1024);
win.content.pos_x= win.tbar.pos_x;
win.content.size_x= win.tbar.size_x;
win.content.size_y= clamp (win.content.size_y,0.05,1024);
wait(1);
}
}



Re: the code: I was gonna try and "fake" a Windows window. But then I took the time to look through a Win32 API tutorial.


Code:
void main()
{
    cout << "I am MrCode,";
    cout << "hear me roar!";
    system("PAUSE");
}
Re: STRUCTS [Re: MrCode] #165152
11/03/07 06:56
11/03/07 06:56
Joined: Jul 2006
Posts: 503
Australia
A
adoado Offline

User
adoado  Offline

User
A

Joined: Jul 2006
Posts: 503
Australia
Structs are not classes. Structs just hold segments of data. But, like Friendly_Frank said, classes are on the forecast list -;)


Visit our development blog: http://yellloh.com
Page 1 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1