PDA

View Full Version : Using UndelphiX again.



Chesso
03-06-2013, 09:34 AM
Decided to crack open Delphi again and UnDelphiX was always the easiest to use and seems to be the only thing updated recently lol.

I have a bit of an odd problem, an old game I made with it (recompiled with newer version) works just as it did previously. My new one however, which
only draws some tiles and text overlay is borked. When it first starts up, my FPS overlay says FPS: 0....... unless I click away from the screen and then
select it again it will not update, at all. If I move the screen it will black out as well until I click away and back onto it.

I checked the dxDraw, dxTimer, Main Form properties/settings as well as how I drew things in the timer event in the old game and they appear to be identical.

Darkhog
03-06-2013, 11:10 AM
Post some code, without it we can't really help you, only make guesses.

Chesso
03-06-2013, 11:40 AM
The only code is enable timer on init and draw an image in the
timer event. Inclusion or lack of begin/end scene or drawing fps
makes no difference.

User137
03-06-2013, 11:56 AM
Have you enabled the timer? Do you see any animation on screen if you try?

edit: Oh you said you did. Need more actual source code or something more to give more hints then.

Also the way i used DelphiX back then was with DXImagelist1.Items.Find('mytexture').Draw(Surface, X, Y, pattern); (might have forgotten the syntax). So you could say nxpascal is a predecessor to it in a sense. Now i do the same with:
tex.SetByName('mytexture');
nx.Draw(X, Y, pattern);

So if you're looking for something modern, and much faster than DelphiX, you can give it a try ;)

SilverWarior
03-06-2013, 12:58 PM
Are you sure you are using OnTimer event of DXTimer.
DXTimer component has three different events OnActivate, OnDeactivate, and OnTimer.
When you doubleclick on component it creates OnActivate even reference and not OnTimer event reference as it is with Delphi default TTimer component.

That might explain why your game updates only by activating your application

PS I expirienced such problem a while ago myself :-[

Chesso
03-06-2013, 09:28 PM
Wow SilverWarrior, right on the mark. As soon as I read your reply I thought to myself "I have never done that before, but it has been awhile since I used Delphi....", sure enough it is indeed the timers activate event.

As far as what I use for drawing I am open to suggestions. I am only using dxDraw, dxImageList and dxTimer components, I intend on using BASS for audio as I have in the past and everything else I program myself. I
picked up UnDelphiX again because generally speaking I have never had an issue in using it and it has been updated recently, where as with other alternatives seemed overly complex to do something simple like draw an image to the screen or the result
was undesirable.

Anything similar with all the drawing features I would definitely try out. (I'm using Delphi XE2). Apparently they are up to XE4 now! :|