Sign in Join
Wiki copytemporary

FPC and DirectX: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: FPC and DirectX

OldNewLine
1+## Introduction
2+
3+First of all, DirectX is only suited for Microsoft Windows.
4+
5+DirectX programming in Free Pascal is fast. Calling a DirectX function is not different from other languages like C++ (with some small exceptions).
6+
7+To use DirectX you will need to know some basic stuff about the language. A valuable resource is Google, and the [MSDN network](http://msdn.microsoft.com). As most of the tutorials and examples are in C++, it is recommended to have some basic C++ knowledge, but translating to Pascal is not very difficult: you will get the hang of it in no time. This page is going to explain the basics of how to setup DirectX with Free Pascal, where to obtain the Pascal headers etc.
8+
9+## Obtaining DirectX headers for FPC
10+
11+You will need pascal headers to be able to use DirectX with FPC . You can download them from <http://www.clootie.ru/fpc/index.html>. In the downloadable file you will find the headers, and also the DLL files that need to go with your application. They always go together.
12+
13+## Examples
14+
15+It's convenient to use a program like Lazarus to create DirectX applications, because it needs a window to draw all graphics and programming directly in Win32 is very awkward. In Lazarus you can just connect all your drawing objects to the Form and everything works fine.
16+
17+You just place the units you will use in your program in your uses section. Be sure to place the units in your program folder. Like this:
18+
19+``` pascal
20+interface
21+uses
22+ Windows, Classes, SysUtils, LResources, Forms, Dialogs, ExtCtrls, // standard stuff
23+ Direct3D8, // the DirectX units
24+ D3DX8,
25+ Directinput,
26+ DirectMusic,
27+ DirectSound;
28+```
29+
30+If you have placed the DLLs in your program folder you now can use all DirectX calls in your program.
31+
32+---
33+*From the Free Pascal wiki, page "FPC and DirectX", as it stood on 2020-02-16 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history