<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-19836617</id><updated>2011-04-21T13:16:02.370-07:00</updated><title type='text'>Richard's (NOZ) WIN32 C++ 6 DirectX Wrapper DLL For Use With Visual FoxPro (VFP).</title><subtitle type='html'>BLOG on my attempt at writing a WIN32 C++ exported library (DLL) wrapping the DirectX COM Interfaces for use within Visual FoxPro.  NUTTER! :)</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://vfpnoz.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19836617/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://vfpnoz.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>NozFx</name><uri>http://www.blogger.com/profile/14982627273440352852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_c64B3ud2_KE/R2vQcdpqw6I/AAAAAAAAAAM/S_ZFTDWwAbA/S220/n595053588_289938_2202.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-19836617.post-113449570448524374</id><published>2005-12-13T09:23:00.000-08:00</published><updated>2006-10-17T13:52:41.760-07:00</updated><title type='text'>VFP DirectX Win32 Wrapper DLL (Hey I got lots of time - NOT!)</title><content type='html'>HELL HATH NO FURY LIKE A DIRECTX DEVELOPER!&lt;br /&gt;&lt;br /&gt;Love games, love programming, forced to love Windows, dislike WIN32, hate GDI, despise DirectX API! Decided I wanted to write some simple 2D games in Windows. Ah, I though, GDI could be the tool for the job, um, if you like line drawings, ellipses, and don't mind jumpy animations! Unfortunately there is too much nastiness and far too many gotchas for GDI to achieve what I need. So we got this lovely API DirectX and its easy to use, right? If you’re a rocket scientist!&lt;br /&gt;&lt;br /&gt;OK, so let’s face it, DirectX (in my opinion) is the defacto for Windows game programming. If you want a game that has more than a few line drawings staggering across the screen then DirectX is the tool for you. The problem is that it's very complex to use (As with all great Game API's) and getting anything to work in it is a slow and painful process. The good thing is that it does a great job at giving you the power to write great games in Windows.&lt;br /&gt;&lt;br /&gt;PROBLEM - I want to write simple but visually pleasing games that perform well on your average computer. Oh, and I want to do by January! Too much you say?! Well, yes it is, but I hope to achieve something close by writing a WIN32 DLL wrapper around the DirectX COM Interface (No I will not be finished by January!). I'm guessing many people will offer alternatives and probably advise me this is a stupid thing to do, but I think I will probably learn a lot along the way by doing it.&lt;br /&gt;&lt;br /&gt;I'm new to the DirectX API, actually I'm so new that the only Interface I've got a handle on is DirectDraw (DD). Unfortunately (or fortunately) it has been superseded since Version 7 of the API and amalgamated with Direct3D to create DirectGraphics; the pin ultimate of graphics API's (basically 3D stuff, but 2D is still possible, better even). Saying that I'm not yet looking at using the DirectGraphics Interface for this job. I think that DirectDraw (DD) is more than capable of achieving what I need to do as a pilot project.&lt;br /&gt;&lt;br /&gt;I decided to write this library using MS Visual C++ 6 and using DirectX 9 (actually 7 for DD) . I've already built a library that abstracts the DD Interface into classes such as Sprites etc. These are all internal functions as there is a lot of COM pointers floating about. I've successfully exported three functions that call my internal functions and have run a successful test. One of these functions is called RunGDIDemo(). This function proves the concept of using DD to take over the Video Hardware from GDI (using the windows HAL). Unfortunately, for simplicity, I actually used GDI alongside DD in this example to render graphics (fonts) to the Video Memory. It certainly proved a point though, it works and it works very well. Here’s the code I used in Visual FoxPro (vfp) that exports functions from my new DLL:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;LOCAL lcDLL&lt;br /&gt;lcDLL = "C:\Local Development\Visual C++ 6 Projects\statusdxengine\Debug\statusdxengine.dll"&lt;br /&gt;DECLARE INTEGER InitializeDLL IN (lcDLL) INTEGER hwindow, INTEGER windwidth, INTEGER windheight, INTEGER bbp&lt;br /&gt;DECLARE INTEGER ShutdownDLL IN (lcDLL)&lt;br /&gt;DECLARE INTEGER RunGDIDemo IN (lcDLL)&lt;br /&gt;IF InitializeDLL(_VFP.hWnd,800,600,8) = 1&lt;br /&gt;RunGDIDemo()&lt;br /&gt;ShutdownDLL()&lt;br /&gt;ENDIF&lt;/pre&gt;&lt;p&gt;Basically the InitializeDLL() function requires a window handle, screen width, screen height and number of bits per pixel (Colour Depth). The RunGDIDemo() function internally starts a game loop (quick and dirty of course) and allows you to quit with the ESC key. It randomly draws GDI text (fonts) on the screen in a range of different 8bit colours. Once we are finished with the DLL it’s important to call the ShutdownDLL() function as we need to properly release the DD Interfaces Instantiated and clean up any use of heap memory. What I hope I will eventually end up with is a fully functioning game engine that I can use within VFP. What I will also be doing is wrapping up these calls in vfp classes to abstact the library further. I should then end up with a really neat VFP framework for writing 2D games (if so then I'll move onto 3D "AHHH!"). What I do realise that if anyone reads this blog is that some of the first questions I'll probably get are: Will I be able to use this library in Visual Basic 6 (VB6)? and Will you create some wrapper classes in VB6? Obviously the answer to the first question is yes and in the answer to the second question, maybe, unless someone else does. It all depends on the time I get, but I primarily am doing this for me as I love VFP. I also doing this for all the diehard vfp fans out there that would find this cool to use in their spare time. So thats all for now folks. I'm off and away and I'll be posting my updates here if anyone is interested. When I got some stable stuff I'll make sure I'll post it here as shareware.&lt;br /&gt;&lt;br /&gt;L8ers... Rich a.k.a Noz &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/19836617-113449570448524374?l=vfpnoz.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://vfpnoz.blogspot.com/feeds/113449570448524374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=19836617&amp;postID=113449570448524374' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/19836617/posts/default/113449570448524374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/19836617/posts/default/113449570448524374'/><link rel='alternate' type='text/html' href='http://vfpnoz.blogspot.com/2005/12/vfp-directx-win32-wrapper-dll-hey-i.html' title='VFP DirectX Win32 Wrapper DLL (Hey I got lots of time - NOT!)'/><author><name>NozFx</name><uri>http://www.blogger.com/profile/14982627273440352852</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://bp0.blogger.com/_c64B3ud2_KE/R2vQcdpqw6I/AAAAAAAAAAM/S_ZFTDWwAbA/S220/n595053588_289938_2202.jpg'/></author><thr:total>1</thr:total></entry></feed>
