Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Oct 1999
Offline Last Active Today, 06:56 AM

Posts I've Made

In Topic: Reading game data from archive

20 September 2015 - 02:53 AM

A simple way to handle this is to use PhysFS. This is exactly the sort of problem it is intended to solve.

In Topic: D language array syntax question

11 September 2015 - 06:54 AM

Yes, that's exactly right. As this program demonstrates.
void main() {
    import std.stdio : writeln;

    ulong[][uint] cache;
    cache[10] = [10UL];
    cache[100] = [30UL, 40UL, 50UL];

    foreach(key, val; cache) {
        foreach(ul; val) {

The [items] syntax is an array literal. It creates a dynamic array on the heap, the elements of which are whatever inside the brackets.

In Topic: SDL doubts

10 September 2015 - 07:39 AM

Yes, you will generally want to use the SDL_Renderer API and SDL_Textures for games these days. SDL_Surfaces are used for loading images from disk, generating images to create textures from, and such. Other than that, there's little reason to use them outside of a few special cases. For example, if I ever felt the desire to work on an old-style raycaster or a custom software 3D renderer, I would likely use the SDL_Surface API.

In Topic: Compiling SDL with MinGW on Window 8.1?

25 August 2015 - 09:42 PM

How are you building? CMake should be looking for xaudio2.h and, failing to find it, configure the makefile so that it isn't enabled. I just tried it out using the Windows cmd prompt (I normally build through MSYS) to be sure it works for me:
cd sdl-source-dir
mkdir build
cd build
CMake -G"MinGW Makefiles" ..

-->CMake spits out a lot of stuff here, including:
-- Looking for d3d9.h
-- Looking for d3d9.h - not found
-- Looking for d3d11_1.h
-- Looking for d3d11_1.h - not found
-- Looking for ddraw.h
-- Looking for ddraw.h - not found
-- Looking for dsound.h
-- Looking for dsound.h - not found
-- Looking for dinput.h
-- Looking for dinput.h - not found
-- Looking for xaudio2.h
-- Looking for xaudio2.h - not found

---> Then, when it finishes:
I get both static and dynamic versions of SDL successfully compiled as a result. I don't know why CMake isn't finding the DX headers, though, as I'm looking at most of them in Windows Explorer, but that's beside the point.

In Topic: Compiling SDL with MinGW on Window 8.1?

23 August 2015 - 10:37 PM

Don't use vanilla MinGW. Life is easier with a distribution like TDM-GCC, which is based on MinGW-w64. I comes with all of the DirectX headers and libraries you'll need. I also recommend installing MSYS2 and working through that rather than the Windows cmd shell, if you aren't already.

Furthermore, it's generally a bad idea to mix things compiled via the Microsoft toolchain with MinGW, such as the binaries found in the Windows SDK. MinGW can link dynamically with DLLs if you pass them along, but attempting to link with static or import libraries is asking for trouble. Any third-party libraries you use should generally be compiled with MinGW as well.