D Bits

Profile
Seoul, South Korea
Game development with the D Programming Language.
46 comments
1 followers
32 entries
Advertisement
Aldacron
March 03, 2016
Extended Package Protection in D

Since the D1 days, D has had a package protection attribute akin to Java's (though unlike Java, it is not the default). Applying package protection to any symbol in a module makes it accessible only to modules in the same package.[code=nocode:0]module mylib.mypackage.mymodule;package struct MyStruc…

4,086 views
Aldacron
November 30, 2015
My New Book: Learning D

From late February up until about two weeks ago, I've had my head down over my keyboard working on a book about the D programming language for PACKT called 'Learning D'. The electronic version is currently available from the publisher's site for roughly half-price. Both kindle and print versions ar…

3,048 views
Aldacron
November 03, 2013
D Tip: Use Scope Statements in Proper Scope
One D construct I often use is the scope guard statement. This allows you to write code that executes when a scope exits under one of three circumstances: an exception is thrown, no exception is thrown, or always. Example:[code=nocode:0]void main() { import std.stdio; scope( failure ) { …
4,378 views
Aldacron
January 23, 2013
Functional Me
I recall very clearly the first time I ever saw a video game. It must have been in the summer of either '78 or '79, just before my 7th or 8th birthday. I walked into a local 7-11, just a short distance from my house, and was puzzled to see this big box surrounded by a bunch of older kids. Space Inv…
4,048 views
Aldacron
December 31, 2012
Binding D to C Part Five
This is the fifth and final part of a series on creating bindings to C libraries for the D Programming Language.

In part one, I introduced the difference between dynamic and static bindings and some of the things to consider when choosing which kind to implement. In part two, I talked about the diff…
5,366 views
Aldacron
December 22, 2012
Fun with GCC (or A Lesson Relearned)
This story has nothing really to do with D except peripherally, but it's a tale worth telling as a warning to others.This is the best place for me to tell it.

I had a collection of C code that I'd built up over the years. I suppose I still have it, but it's sitting on the hard drive of a closeted do…
3,804 views
Aldacron
December 02, 2012
TicTacToe and Modules in D
Given that my BorderWatch project has languished on github for months without any updates beyond the first few days of random hacking, it's going to be a while before it can serve as an example of game programming in D. So I had some free time recently and decided to do something different. I put t…
6,113 views
Aldacron
August 05, 2012
Binding D to C Part Four
This is the fourth part of a series on creating bindings to C libraries for the D Programming Language.

In part one, I introduced the difference between dynamic and static bindings and some of the things to consider when choosing which kind to implement. In part two, I talked about the different lin…
6,214 views
Aldacron
June 29, 2012
Uniform Function Call Syntax in D
Uniform Function Call Syntax (UFCS) is a feature of the D Programming Language that was finally implemented in all its glory in a recent compiler release. It has been available for use with arrays for quite some time, since the early days of D1. But now it is available for every type imaginable.

On …
13,276 views
Aldacron
May 19, 2012
Binding D to C Part Three
This is the (long overdue) third part of a series on creating bindings to C libraries for the D programming language.

In part one, I introduced the difference between dynamic and static bindings and some of the things to consider when choosing which kind to implement. In part two, I talked about th…
7,558 views
Aldacron
April 03, 2012
Setting Thread Affinity on Windows in D
When working with D's standard library, it is sometimes necessary to work around missing declarations in the core.sys.windows.windows module. It's a fairly big module as is, but it isn't all-inclusive. If you are doing any heavy-duty Windows development, you'll likely want a third-party Win32 API b…
4,001 views
Aldacron
March 08, 2012
Putting D's Array Slices to Use
I've been working on BorderWatch a little bit every day. My focus has been on getting the ASCII engine, Arthur, into a state that will let me get a game up and running. With the few modules that I've implemented so far, I believe I'm there. One of the D features that has come into play in this proc…
3,118 views
Aldacron
March 05, 2012
BorderWatch
I'm afraid I'm going to be waving goodbye to Dolce. It's been sitting, bit rotting, for a while now. Some time ago I encountered two major issues with my Allegro binding in Derelict 2. One, a random (and I mean random) crashing bug, I've been unable to solve. Another, regarding Allegro's interactio…
3,134 views
Aldacron
March 03, 2012
Compiling Data into a D Executable
I'm supposed to be posting part three of my series on binding D to C. It's going to be boring to write, so I keep putting it off. But I *will* get to it eventually. In the meantime, I wanted to blog about a neat feature of D that I'd sort of forgotten about until I needed it.

I'm working on an ASCII…
8,035 views
Aldacron
January 31, 2012
Binding D to C Part Two
This is part two of a series on creating bindings to C libraries for the D programming language.

In part one, I discussed the difference between dynamic and static bindings and some of the considerations to take into account when deciding which way to go. Here in part two, I'm going to talk about an…
7,045 views
Aldacron
January 08, 2012
Binding D to C
This is part one of a series on creating bindings to C libraries for the D programming language.

This is a topic that has become near and dear to my heart. Derelict is the first, and only, open source project I've ever maintained. It's not a complicated thing. There's very little actual original cod…
11,949 views
Aldacron
December 18, 2011
Dolce and Da5teroids
So I've finally gotten started on some game code. In order to see if Dolce is actually useful or a waste of time, I decided to start by porting the A5teroids demo that ships with the Allegro 5 package. Here's what I've learned so far.

First, the whole idea of Dolce as a framework on top of Allegro t…
1,975 views
Aldacron
November 17, 2011
Dolce Gets Some Love
Once the semester ended, I took a week to do nothing but play Dark Age of Camelot and get some much needed guitar practice in. Then I dove back in to the gym for some long overdue exercise. I also managed to pick up a few more private classes to fill some of the gaps in my schedule. Once I let off …
1,795 views
Aldacron
October 09, 2011
On My Job, and Some Big D News
Dolce is still very much alive, just getting little attention while I wrap up the second semester at the university. For anyone interested, I'm teaching in a special program where a local university here in Seoul is partnered with a university in America. The students do two semesters here in Korea…
1,894 views
Aldacron
September 04, 2011
Dolce Refinements
In my last post, I showed the minimal amount of code needed to get something up and running with Dolce. And while it's a really small amount of code, something kept bugging me about the implementation. It just wasn't "D" enough.

Over the years, the lion's share of my programming experience has been …
1,792 views
Aldacron
August 21, 2011
Dolce and Overriding Methods in D
I'm making very slow progress on Dolce, but progress nonetheless. I managed to grab a couple of hours today to refactor event handling and to simplify the framework interface.

In my initial implementation, it was necessary when making a game with Dolce to make all of the initialization and terminati…
2,364 views
Aldacron
August 02, 2011
D Structs vs Classes and a Simple Template Example
D shares a lot of similarities with C++ and Java, but a lot of the sameness is just a bit different. One of the first places new users see this is in the handling of structs and classes.

D's classes have more in common with those of Java than C++. For starters, they're reference types. Whenever you …
3,876 views
Aldacron
July 31, 2011
Dolce Progress, Importing D Modules in a Function, and WYSIWYG Strings
I've made a bit of progress on Dolce, but I realized something while I was doing it. My purpose for starting the project was to work on a game idea I've had for a long, long time. I knew from the get go that graphics were going to be a problem The problem is the open-endedness and complexity of the…
2,115 views
Aldacron
July 03, 2011
D's Default Initializers
I've been away from Dolce for a couple of weeks now. Just came back to it last night and realized I don't like it. I've horribly over engineered some of the modules. So from last night I started stripping stuff out and refactoring. In the process, I realized a silly mistake in my resource managemen…
1,882 views
Aldacron
June 24, 2011
DerelictGLFW and a Word on Binding D to C
Recently, in the Derelict forums, someone asked me if I wanted him to update his GLFW binding, based on the old Derelict, for the Derelict 2 branch so that I could add it to the trunk. We had a GLFW binding in Derelict before, but removed it due to issues with building the GLFW shared libraries. De…
3,381 views
Aldacron
June 11, 2011
Dolce Progress and A Word on Mixins
My time has been limited lately, but the core of Dolce continues to evolve. I think it's converging into something fairly decent. I'm still not completely happy with it, but I believe I'm most of the way there. As usual, I'm getting wild ideas for new projects. Like a renewed interest in building a…
1,743 views
Aldacron
May 29, 2011
Operator Overloading in D
I didn't add much of anything new to Dolce in the past week. The time I had to work on it was mostly spent refactoring. I'm patching this thing together haphazardly as I go along. I have a good idea of what I want it to do, but how to organize it all wasn't clear from the beginning. Package hierarc…
2,584 views
Aldacron
May 26, 2011
D Arrays
Every D programmer loves D's arrays. All of them. I challenge you to find one who doesn't. Particularly, it's the ability to slice and manipulate arrays without worrying about memory that really pulls people in.

In my previous post, I talked about Dolce's game screens and the stack-based screen mana…
1,840 views
Aldacron
May 24, 2011
Game Screens
The concept of a game screen is a fairly common one in game engines and frameworks these days. Usually it's an interface or base class that defines a lifecycle for what once upon a time was commonly known as a game state. It eliminates the need for those ugly if-else trees, or long switch statement…
2,057 views
Aldacron
May 22, 2011
Dolce and Free Functions
There's one thing that's missing from D that I really wish it had: namespaces. There have been discussions about this on the D newsgroup in the past. Walter Bright, D's daddy, has taken the position that D's modules *are* namespaces. In a way, they are. But, not really.

For those new to the party, D…
2,171 views
Advertisement

Popular Blogs

shawnhar
Generalist
101 Entries
8 Followers
15 Entries
9 Followers
johnhattan
Programmer
1,277 Entries
46 Followers
ApochPiQ
Generalist
628 Entries
43 Followers
dgreen02
Generalist
338 Entries
55 Followers
Advertisement