PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Help/Tutorial?

Can anybody point me to some tutorials involving a from the beginning step-by-step minimal set up?

I tried the ones that come with gapidraw, but I can't even compile the program when I open the workspace... it doesn't have the option. Any reason? I went through the setup on the main gapidraw SDK page, and got that running fine. But I don't know where to go from there...? Even that page says it's gonna have to come later.
I'd like a kick in the right direction if possible, thanks!
I tried the ones that come with gapidraw, but I can't even compile the program when I open the workspace... it doesn't have the option. Any reason? I went through the setup on the main gapidraw SDK page, and got that running fine. But I don't know where to go from there...? Even that page says it's gonna have to come later.


Heya,

1. Try using EVC++ 3.0 with the samples. If you use EVC 4.0 you probably need to rebuild the projects from scratch.
2. Try the "new project tutorial", at http://www.gapidraw.com/doc/300/doc-project.htm

//Johan
Thanks, did that last night, actually. Went fine.... no real problems. BUT, where to go from there? What about creating surfaces, loading bitmaps, blitting, locking and flipping surfaces...?
While I'm familiar with the process I don't really KNOW It, especially in the context of this library.
There is virtually nothing that explains this stuff. I could wade through the SDK documentation but it took me a good amount of effort just to find the constant that would allow me to rotate the screen 90 degrees...
Okay, after looking through the SDK docs at work a bit, here is the understanding I've come to, in order to use the 'example' code (uses CGapiApplication) for an actual project:

1.) Override InitInstance() with whatever pregame setup might be needed.
2.) Override CreateSysMemSurfaces() to create my game surfaces.
3.) Override ProfessNextFrame() and use that for my in game loop.

Assuming that is correct, I need to look into setting up a primary and secondary surface, right? In which case, I probably need to find out how to load bitmaps...

Any guidance if i'm wrong would be helpful, thanks :)
Hi!

Yes, you got the three steps correct!

[quote]Assuming that is correct, I need to look into setting up a primary and secondary surface, right? In which case, I probably need to find out how to load bitmaps... [quote]

In process next frame you are passed a pointer to the secondary surface (pBackbuffer), and you can draw everything to that surface. When the loop exits ProcessNextFrame() the contents of the backbuffer is copied to the display (primary surface).

You can load bitmaps quite easily using CreateSurface(). Try adding a member variable "CGapiSurface m_testsurface;" to the "MyApplication.h" header file (under "attributes"). Then call CreateSurface using the doc at:
http://www.gapidraw.com/doc/300/doc-surface-frame.htm

Code:

HRESULT CreateSurface(DWORD dwFlags, const TCHAR* pImageFile);
HRESULT CreateSurface(DWORD dwFlags, BYTE* pImageFileMem, DWORD dwImageFileSize);
HRESULT CreateSurface(DWORD dwFlags, HINSTANCE hInstance, DWORD dwResourceID, const TCHAR* pResourceType = NULL);
HRESULT CreateSurface(CGapiSurface* pSrcSurface);
HRESULT CreateSurface(DWORD dwFlags, DWORD dwWidth, DWORD dwHeight);


For example, to load a bitmap from file, add the following in CreateSysMemSurfaces:
m_testsurface.CreateSurface(GDSURFACE_SYSTEMMEMORY, TEXT("\\mypicture.png"));

to load from a resource you have added to the project, add:
m_testsurface.CreateSurface(GDSURFACE_SYSTEMMEMORY, hInstance, IDR_MYRESOURCENAME, TEXT("RESOURCESECTION"));
If you add a "PNG" image to your project, you are asked to name the section where you want to add it. Rename RESOURCESECTION above with the name of the section.

So. To finally draw your bitmap, in ProcessNextFrame, add:
pBackbuffer->BltFast(0, 0, & m_testsurface, NULL, 0, NULL);

That's it, and a good starting point for a game...
Thanks! Can't wait to try it when I get home tonight ;)
I take it CGapiApplication is a sort of "Wizard", and eventually I should try working away from that, in favor of more customization?

Is there anywhere I could download the complete SDK Docs (.pdf etc.) to print out (Or to put on my PPC!)?
Volte6 wrote:I take it CGapiApplication is a sort of "Wizard", and eventually I should try working away from that, in favor of more customization?


Actually, CGapiApplication is a nice framework, and I use it in all of my GD based applications.
Yes the CGapiApplication class is a great place to start "fiddling" around to help gain the feel regarding how applications should use GD and how applications are basicially set up.

However, I wouldn't use it for any production level code but thats just me.

I've worked with DirectX for many years and I find this API to be very similiar. Which is great really, as it practicially removes the learning curve so one could begin right away.

The only thing I am hoping for is that upgrading to newer versions of GapiDraw is less frustrating than upgrading to newer DX versions. ;)
Layre5150 wrote:The only thing I am hoping for is that upgrading to newer versions of GapiDraw is less frustrating than upgrading to newer DX versions. ;)


Thus far, changes from GapiDraw 1 -> 2 -> 3 have been pretty easy to handle. I upgraded Warlords II from GD 2.04 to 3.0 in about an hour, so it is a very easy process. I left the desktop gaming world just as DX8 was released, and I'm pretty happy I don't have to concern myself with it any longer. =)
Yeah - no more 100+ work weeks trying to get that darn E3 build out eh? heh
A bit offtopic: I and Shahab will be visiting E3 in May so perhaps we'll be able to meet with some of the forum regulars there.. :)
Layre5150 wrote:Yeah - no more 100+ work weeks trying to get that darn E3 build out eh? heh


And no more pulling the funding just before the project is completed either. :wink:
Johan wrote:A bit offtopic: I and Shahab will be visiting E3 in May so perhaps we'll be able to meet with some of the forum regulars there.. :)


I'm hoping to make it there this year.
I'm hoping to make it there this year


Cool!

E3 can be exciting and if you have a product on display that you were a part of can be even more memorable.

So just before I started my project I made a promise to myself which was to only go to E3 when I have something done (or almost done) - either way, something to show that is. However, since this right now is only a hobby (something that I'd like to make full-time eventually) and also that I'm the only one doing this, it may be some time before all that happens.

However, hope you make it to E3 - as it's always a blast!