PDA

View Full Version : Programing


dennishea
10-30-2006, 06:03 PM
Let me start out by saying I have never programed in c, c++,pascal. I have programed some in visual basic 5 and 6, pdatoolbox for palm, and basic4ppc for windowsce. At the moment I'm in over my head with ppl. If I ask some pretty dumb questions please be patient with me. Ok I've managed to create a form and put some textboxs and a label on it. I also created two menu items one named Draw and one Quit. Quit has Exit and Clear and Exit shuts down the program. Draw has Line,Circle, and Arc. I am trying to use gameapi for my line. For the moment I thought I could cut a portion of code from simple3 with the mousemove section and it run to the point when I press menu item line and then it says,

app: drawing.ppl
(menu5004_onclick(4,1))
access voilation at 0x4e6bad.

dennishea

kornalius
10-30-2006, 06:41 PM
Hi,

First to use the GameAPI you need a fullscreen application, meaning no menus are allowed.

You need to initialize the GameAPI first. You can't really use the form builder to use GameAPI functions.

dennishea
10-30-2006, 07:34 PM
Is gameapi the only way to draw line circles and arcs to the screen?

dennishea

kornalius
10-30-2006, 07:56 PM
No there are other ways using the Windows API but for this you need an image control that you custom draw to. It is not an easy thing to do in Windows.

We might look into implementing a library for easy drawing of shapes on forms.

dennishea
10-30-2006, 08:56 PM
Here is a basic4ppc program that I am try to expand on. It not much but give you an idea of what I'm trying to do. It's fairly simple. Arc and freehand are not working yet. The arc's that I've managed to do are 15 to 20 seconds to draw. Not good.

dennishea
10-30-2006, 08:59 PM
Here is a basic4ppc program that I am try to expand on. It not much but give you an idea of what I'm trying to do. It's fairly simple. Arc and freehand are not working yet. The arc's that I've managed to do are 15 to 20 seconds to draw. Not good.


trying to attach file.

How do you attach a file?

dennishea

bmanske
10-31-2006, 08:35 PM
dennishea

At the bottom of the page is a Post Reply button.* Press that and you will get a screen with a larger reply box and below that a browse button to browse for an attachment.

Brad

dennishea
11-01-2006, 12:31 PM
Hi bmanske.
I thought thats what I tried and after reading your post I thought I would try it again. When I went to upload the file I'm talking about I discovered the hotsync I did yesterday somehow wiped out my basic4ppc directory. So now I have to rewrite all my work todate. It's not what I wanted to do in my spare time because I was hopeing to spend that time learning ppl. Oh well I need to emprove my programing skills anyway. I will try to upload something else at a later time. Thanks for the quik reply Brad.

dennishea

dennishea
11-01-2006, 01:43 PM
Try this again and see if my file makes it.

dennishea[br]1162388609_112_FT1143_drawprg.zip

P.S.
This time it made it. There are things that aren't like I want them but I am getting there. The arc menu item under draw doesn't work, but I have solved the formula for that just haven't programed it in. This is just one piece of a much larger program, but it is the hardest one to do. It should give you an idea of what I'm trying to do.
P.P.S.
This was written in basic4ppc. I think if I can solve it for ppl it would run much faster and would let me do more functions.

kornalius
11-01-2006, 05:25 PM
I think your best bet is the following:

1. Create an Bitmap control.
2. In its OnPaint code do this:

struct(ps$, PAINTSTRUCT);
struct(rt$, RECT);

// get the rect to draw
GetClientRect(hWnd$, &rt$);

hdc$ = GetDC(hWnd$);
BeginPaint(hWnd$, &ps$);

// Erase the background and draw a black boarder
Rectangle(hdc$, rt.Left$, rt.Top$, rt.Right$ - rt.Left$, rt.Bottom$);

s$ = "My Text";
DrawText(hdc$, s$, length(s$), &DrawRect$, DT_WORDBREAK | DT_CENTER);

// Done close up
EndPaint(hWnd$, &ps$);
ReleaseDC(hWnd$, hdc$);

There are many Window GDI functions you can use to draw to a HDC in Windows.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/wingdistart_9ezp.asp