0

I am developing an interactive CD most of my life I wrote console applications writing something mostly graphical is akward for me.

So here is my approach :

I am drawing on the canavas using shapes and images the left and top position are stored in a file. Is there any easier approach ? I thought using shapes objects would simplify my work what do you guys think ?

Any examples are welcome.

If you consider this question subjective please vote for closing.

opc0de
  • 11,557
  • 14
  • 94
  • 187
  • It is somewhat subjective. But in any case you'll probably better using a game library for this; see [this question](http://stackoverflow.com/questions/5060302/recommended-2d-sprite-engine-for-a-delphi-board-game/5060730) for an example. – Leonardo Herrera Jun 05 '13 at 19:54

3 Answers3

3

The proper way is to write an OnPaint handler (that is, listening to the WM_PAINT message) and drawing using the GDI.

Here are a couple of simple examples:

Drawing by moving controls is very awkward.

Community
  • 1
  • 1
Andreas Rejbrand
  • 105,602
  • 8
  • 282
  • 384
  • I started doing that but I must always check if I am in a clickable zone,using OnmouseMove and checking if the cursor is in a clickable TRect. Isn't that too cpu expensive, any ideas on how to check if I am in a clickable zone when the mouse moves ? – opc0de Jun 06 '13 at 06:27
  • @opc0de: Modern CPUs are *very* fast, so in my experience, you shouldn't be afraid of adding a lot of code that runs often, as long as the code isn't expensive. Checking a small number of inequalities isn't expensive. – Andreas Rejbrand Jun 06 '13 at 11:38
1

Since you didn't specify a any version, I assume you're not wasting your time with an ancient Delphi, so maybe you should also take a look at FireMonkey.

That also opens the door to having your interactive stuff work on other platforms..

Wouter van Nifterick
  • 23,603
  • 7
  • 78
  • 122
0

I recommend the Delphi GDI+ Library which I have used with success. It's a wrapper around GDI+ which takes alot of the pain out of it.

Alan Clark
  • 2,017
  • 21
  • 28