🔒 Locked
API-only
Advertisement
Original Post
Hey Ampaze!
...when you gonna tell us more bout the API-only ultra-hardcore DX programmin under Delphi?
A-Lore
Hey Amp... *grinZ* - as unlikely as it may sound... I don''t have e-mail access riTe now, but I can internet a bit; so I simply reply the intended mail via >here< 
I''ve actually had time over this weekend to do some Delphi again, and promptly gone through your first HardCoreDX build you send me, and did my own conversions.
Everything works more or less beautifully now.
Now for my problems:
You use {$Define ErweiterteFehlerMeldung} (or something) and make extended use of it inside your code, with two versions of ErrorToLog depending on whether Erwei...ung is defined.
As far as I could descern, both ErrorToLog will always produce the same Output, and there is infact nothing to distinguish the one
{$IFDEF ...}
..
{$ELSE}
..
{$ENDIF}
from the next.
So... why not unify them into one set of statements? - or alternatively, change the programming, to only produce a logfile if the Define is set.
Next - my program is virtually a direct copy from yours, except for a few comments, exclusively english names, and stylistic differences.
Oh yea... except... replace your "If .. then .. repeat .. until" with a while loop. And perhabs a number of repeat-loops should be converted to while-loops.
Then finally... - the deinitialization. (The one that causes the logfile to say "Error ...."
I''ve checked into the DX7SDK and then also into how DelphiX, DGC and WDirectX handle it.
They all seem to simply set Surfaces and Interfaces to nil, rather then calling Release explicitely. Apparently Delphi (or somebody) calls Release implicitly.
[If anybody else out there has some guaranteed answer on this... please voice it.
]
cyaZ
A-Lore
I''ve actually had time over this weekend to do some Delphi again, and promptly gone through your first HardCoreDX build you send me, and did my own conversions.
Everything works more or less beautifully now.
Now for my problems:
You use {$Define ErweiterteFehlerMeldung} (or something) and make extended use of it inside your code, with two versions of ErrorToLog depending on whether Erwei...ung is defined.
As far as I could descern, both ErrorToLog will always produce the same Output, and there is infact nothing to distinguish the one
{$IFDEF ...}
..
{$ELSE}
..
{$ENDIF}
from the next.
So... why not unify them into one set of statements? - or alternatively, change the programming, to only produce a logfile if the Define is set.
Next - my program is virtually a direct copy from yours, except for a few comments, exclusively english names, and stylistic differences.
Oh yea... except... replace your "If .. then .. repeat .. until" with a while loop. And perhabs a number of repeat-loops should be converted to while-loops.
Then finally... - the deinitialization. (The one that causes the logfile to say "Error ...."
I''ve checked into the DX7SDK and then also into how DelphiX, DGC and WDirectX handle it.
They all seem to simply set Surfaces and Interfaces to nil, rather then calling Release explicitely. Apparently Delphi (or somebody) calls Release implicitly.
[If anybody else out there has some guaranteed answer on this... please voice it.
cyaZ
A-Lore
To release COM objects in Delphi, simply set the variable to nil. It's that easy. There is no need to call Release, and in fact it does cause an error as was mentioned.
The factors that determine whether to use a repeat or while loop are whether you want the loop at least once or possibly zero times. A repeat loop will execute at least once because the end-of-loop condition is tested at the end of the loop, whereas with the while loop the end-of-loop condition is tested at the beginning of the loop with the result that the loop may never be executed at all if the condition is initially false.
repeat loop - one or more executions of loop
while loop - zero or more executions of loop
As for my own API-only (which I read as non-VCL) library, it has been slow going in the last couple of weeks what with a holiday in the snow and a change of job. Definitely a good change of job though as I am now working at a games development studio.
Steve 'Sly' Williams
Tools Developer
Krome Studios
Edited by - Sly on August 27, 2000 8:11:25 PM
The factors that determine whether to use a repeat or while loop are whether you want the loop at least once or possibly zero times. A repeat loop will execute at least once because the end-of-loop condition is tested at the end of the loop, whereas with the while loop the end-of-loop condition is tested at the beginning of the loop with the result that the loop may never be executed at all if the condition is initially false.
repeat loop - one or more executions of loop
while loop - zero or more executions of loop
As for my own API-only (which I read as non-VCL) library, it has been slow going in the last couple of weeks what with a holiday in the snow and a change of job. Definitely a good change of job though as I am now working at a games development studio.
Steve 'Sly' Williams
Tools Developer
Krome Studios
Edited by - Sly on August 27, 2000 8:11:25 PM
Hi Henri !
No email, huh ? Well that is strange ...
Okay lets try this ...
I use {$Define ErweiterteFehlerMeldung} to give additional information to the logfile. If this is set, Assert is used to get the file and line number where the error occured. If it''s
not set, only the errormessage will get to the log.
I made this because I don''t know what influence Assert has on file-size and so on. So it can easily be turned of by not defining "AdvancedErrorMessage" and recompiling. Got it ?
Here I have a question. I thought if I define something in the dpr file it would be set in every file of the project. But unfortunately this isn''t case ... whats wrong here ?
Do you mean these repeat until loops in TUrsprung ?
Well this is clever
, I never got used to while-loops so much, but you are right. I''ll change it.
To the deinitialization : I also nil the Interfaces and Surfaces (I wrote about it in the last mail, you probably didn''t get) but I always wondered why calling "._release" would give an error.
Simply setting everything to nil can''t be the solution ... can it ?
Do you have a way to send me your conversion (new mail address ?)I would like to update HardcoreDX before moving on with development.
[ Ampaze | www.crazyentertainment.net ]
No email, huh ? Well that is strange ...
Okay lets try this ...
I use {$Define ErweiterteFehlerMeldung} to give additional information to the logfile. If this is set, Assert is used to get the file and line number where the error occured. If it''s
not set, only the errormessage will get to the log.
I made this because I don''t know what influence Assert has on file-size and so on. So it can easily be turned of by not defining "AdvancedErrorMessage" and recompiling. Got it ?
Here I have a question. I thought if I define something in the dpr file it would be set in every file of the project. But unfortunately this isn''t case ... whats wrong here ?
Do you mean these repeat until loops in TUrsprung ?
Well this is clever
To the deinitialization : I also nil the Interfaces and Surfaces (I wrote about it in the last mail, you probably didn''t get) but I always wondered why calling "._release" would give an error.
Simply setting everything to nil can''t be the solution ... can it ?
Do you have a way to send me your conversion (new mail address ?)I would like to update HardcoreDX before moving on with development.
[ Ampaze | www.crazyentertainment.net ]
Normal defines are only valid for the file that they are defined in. There are two ways to get global defines.
1. In Project Options on the Directories tab, add your define to the Defines editbox.
2. Add a file called define.inc. Then at the top of each source file, add the line {$INC define.inc}. This will include the contents of define.inc as if it were inserted at that point in the file. Now make your defines in define.inc and they will be present in each file that includes define.inc.
For COM objects, Delphi knows that the variable is an interface to a COM object. Therefore it knows that Release must be called if you are not going to use the object anymore. The compiler knows this when you set the variable to nil. It is only in C/C++ that release must be called because it must remain compatible across compilers and platforms. Borland basically has sole control over Object Pascal and can therefore make these nice additions for us.
Steve 'Sly' Williams
Tools Developer
Krome Studios
1. In Project Options on the Directories tab, add your define to the Defines editbox.
2. Add a file called define.inc. Then at the top of each source file, add the line {$INC define.inc}. This will include the contents of define.inc as if it were inserted at that point in the file. Now make your defines in define.inc and they will be present in each file that includes define.inc.
For COM objects, Delphi knows that the variable is an interface to a COM object. Therefore it knows that Release must be called if you are not going to use the object anymore. The compiler knows this when you set the variable to nil. It is only in C/C++ that release must be called because it must remain compatible across compilers and platforms. Borland basically has sole control over Object Pascal and can therefore make these nice additions for us.
Steve 'Sly' Williams
Tools Developer
Krome Studios
Also das jeder ne extra Version hat find ich irgendwie keine so gute Idee. Und vom Stil muss ich ganz klar meinen bevorzugen
.
Nein aber ernsthaft, ich finde das der Stil einfach eine bessere Lesbarkeit mit sich bringt. Ist sicher wieder Ansichtssachen. Aber wenn du ganz ehrlich bist ...
Wie willst du mir den Code schicken ? Ich denke deine Mail geht nicht. Naja du wirst schon wissen wie.
Also erstmal cu, bis auf weiteres ...
PS : Oh ein Thema auf Deutsch ... cool
[ Ampaze | www.crazyentertainment.net ]
Nein aber ernsthaft, ich finde das der Stil einfach eine bessere Lesbarkeit mit sich bringt. Ist sicher wieder Ansichtssachen. Aber wenn du ganz ehrlich bist ...
Wie willst du mir den Code schicken ? Ich denke deine Mail geht nicht. Naja du wirst schon wissen wie.
Also erstmal cu, bis auf weiteres ...
PS : Oh ein Thema auf Deutsch ... cool
[ Ampaze | www.crazyentertainment.net ]
Hey Amp! 
also... Mail geht schon, aber nicht von den PCs von den ich manchmal arbeite... *GrinZ* - also mail kann ich ohne weiteres empfangen und schicken; nur ne Sache den richtigen PC zu benutzen...
Okay... dein Stil, meine Variable-Names. ''kay?
Ich setze die "Ideal"-Mischung zusammen und schicke sie "real soon" (also irgendwann mal...)
ciao mon amp
Henri aka A-Lore
also... Mail geht schon, aber nicht von den PCs von den ich manchmal arbeite... *GrinZ* - also mail kann ich ohne weiteres empfangen und schicken; nur ne Sache den richtigen PC zu benutzen...
Okay... dein Stil, meine Variable-Names. ''kay?
Ich setze die "Ideal"-Mischung zusammen und schicke sie "real soon" (also irgendwann mal...)
ciao mon amp
Henri aka A-Lore
Gladiator : You''re not necessarily supposed to understand what we write here, as it discusses nothing that would help you anyway. And : do you thing that was english you wrote there? 
Henri : Geht klar, Englische Variablennamen sind wohl net schlecht
aber könntest du "(also irgendwann mal...)" mal ein wenig genauer definieren ? Dieses Jahr noch ???
[ Ampaze | www.crazyentertainment.net ]
Henri : Geht klar, Englische Variablennamen sind wohl net schlecht
[ Ampaze | www.crazyentertainment.net ]
*GrinZ* - Lo Ampo 
klar... "irgendwann" wird etwa spaetestens gegen 7ten 8ten sein... das ist wann meine (10 Tage) Ferien anfangen.
cyaZ
A-Lore
klar... "irgendwann" wird etwa spaetestens gegen 7ten 8ten sein... das ist wann meine (10 Tage) Ferien anfangen.
cyaZ
A-Lore
Also ich muss hier einfach antworten. Hey ein deutscher Thread...
Ok das war jetzt ein geistreicher Beitrag.
So und für den Rest der Welt, hier mal eine wie ich finde doch angenehme Babelfish Übersetzung
Thus I must answer simple here. Hey a German Thread... Ok that was now a spirit-rich contribution.
CU Neo
www.neobrothers.de
Ok das war jetzt ein geistreicher Beitrag.
So und für den Rest der Welt, hier mal eine wie ich finde doch angenehme Babelfish Übersetzung
Thus I must answer simple here. Hey a German Thread... Ok that was now a spirit-rich contribution.
CU Neo
www.neobrothers.de
LOL - It seems like this babelfish still needs some lessons 
Ach und Neo ... wirklich geistreich ... klasse ! ...
Nur 10 Tage Ferien ? Uff das ja nich lange. Aber das is ja noch ne ganze Woche hin ! Oh nein !!
naja gut, hilft ja alles nix.
Gladiator : Well if you are so curios.
We were talking about which programming style we should use and when Henri will send me his "translated" Version of my initial HardcoreDX Version.
[ Ampaze | www.crazyentertainment.net ]
Ach und Neo ... wirklich geistreich ... klasse ! ...
Nur 10 Tage Ferien ? Uff das ja nich lange. Aber das is ja noch ne ganze Woche hin ! Oh nein !!
Gladiator : Well if you are so curios.
We were talking about which programming style we should use and when Henri will send me his "translated" Version of my initial HardcoreDX Version.
[ Ampaze | www.crazyentertainment.net ]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement