debian/0000755000000000000000000000000012164042423007164 5ustar debian/source/0000755000000000000000000000000012164042423010464 5ustar debian/source/format0000644000000000000000000000001412164042423011672 0ustar 3.0 (quilt) debian/docs0000644000000000000000000000003012164042423010030 0ustar readme_e.txt readme.txt debian/copyright0000644000000000000000000000522212164042423011120 0ustar This package was debianized by Miriam Ruiz on Sat, 25 Aug 2007 19:58:40 +0000. It was downloaded from http://www.asahi-net.or.jp/~cs8k-cyu/windows/ttn_e.html Upstream Author: Kenta Cho Copyright: Copyright 2006 Kenta Cho import/SDL* : Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga License: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import/SDL*: This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA On Debian systems, the complete text of the GNU Lesser General Public License can be found in `/usr/share/common-licenses/LGPL-2'. The Debian packaging is Copyright (C) 2007, Miriam Ruiz and is licensed under the GPL, see `/usr/share/common-licenses/GPL-3'. debian/menu0000644000000000000000000000022312164042423010050 0ustar ?package(titanion):needs="X11" section="Games/Action"\ title="Titanion" command="/usr/games/titanion" \ icon="/usr/share/pixmaps/titanion.xpm" debian/changelog0000644000000000000000000000327612164042423011046 0ustar titanion (0.3.dfsg1-5) unstable; urgency=low * Ported to D language version 2 (closes: #707271) * Added build-depends on libphobos-dev * Switch dh-style minimal rules file * Mark -data package as Multi-Arch: foreign * Conforms to standards 3.9.4 -- Peter De Wachter Sun, 30 Jun 2013 13:09:09 +0200 titanion (0.3.dfsg1-4) unstable; urgency=low * Team upload. * Explicitly build with D version 1 (closes: #653091) * Switch to format 3.0 (quilt) and drop build-dep on quilt * Provide build-arch and build-indep targets * Conforms to standards 3.9.2 -- Vincent Fourmond Sat, 07 Jan 2012 16:31:48 +0100 titanion (0.3.dfsg1-3) unstable; urgency=low [ Miriam Ruiz ] * Removed Homepage from long description. * Replaced XS-DM-Upload-Allowed by DM-Upload-Allowed in debian/control. [ Ansgar Burchardt ] * Remove deprecated Encoding key from .desktop file [ Peter De Wachter ] * Patched for changes in the D language. (Closes: #574332) -- Peter De Wachter Wed, 17 Mar 2010 23:49:12 +0100 titanion (0.3.dfsg1-2) unstable; urgency=low [ Barry deFreese ] * Add watch file * Add myself to uploaders * Add Homepage field in control * Remove XS- from VCS fields in control [ Peter De Wachter ] * Fixed link command, patch from Arthur Loiret. (Closes: #458283, #458637) [ Miriam Ruiz ] * Added XS-DM-Upload-Allowed tag to control to allow uploads from Debian Maintainers. -- Miriam Ruiz Thu, 03 Jan 2008 12:12:59 +0000 titanion (0.3.dfsg1-1) unstable; urgency=low * Initial release (Closes: #439682) -- Miriam Ruiz Sat, 25 Aug 2007 19:58:40 +0000 debian/compat0000644000000000000000000000000212164042423010362 0ustar 9 debian/titanion.install0000644000000000000000000000013512164042423012400 0ustar titanion usr/games/ debian/*.xpm usr/share/pixmaps/ debian/*.desktop usr/share/applications/ debian/watch0000644000000000000000000000023112164042423010211 0ustar version=3 opts="uversionmangle=s/_/\./,dversionmangle=s/[+.]dfsg(.?\d+)?$//" \ http://www.asahi-net.or.jp/~cs8k-cyu/windows/ttn_e.html ttn([\d_]+)\.zip debian/titanion-data.install0000644000000000000000000000010212164042423013301 0ustar images usr/share/games/titanion/ sounds usr/share/games/titanion/ debian/titanion.60000644000000000000000000001203412164042423011100 0ustar .\" (c) 2007 Miriam Ruiz .\" (c) 2006 Kenta Cho .\" .\" This document is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 2 of the License, or .\" (at your option) any later version. .\" .\" This package is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" along with this package; if not, write to the Free Software .\" Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA .TH "Titanion" "6" "" "" "" .SH "NAME" titanion \- strike down super high\-velocity swooping insects .SH "DESCRIPTION" Strike down super high\-velocity swooping insects. Fixed shooter in the good old days, 'Titanion'. Titanion is an abstract shooter game. While we fire with one button, the other one acts as a tractor ray to attract the enemies and take them to the combat line. The game in itself is quite simple, but with such graphics and playability that it's a great experience to play. .SH "OPTIONS" These command\-line options are available: .TP \fB\-brightness n\fR Set the brightness of the screen. (n = 0 \- 100, default = 100) .TP \fB\-res x y\fR Set the screen resolution to (x, y). (default = 640, 480) .TP \fB\-nosound\fR Stop the sound. .TP \fB\-bgmvol n\fR Set the volume of the background music. (n = 0 \- 128, default = 100) .TP \fB\-sevol n\fR Set the volume of the sound effects. (n = 0 \- 128, default = 100) .TP \fB\-window\fR Run in windowed mode. .TP .TP \fB\-fullscreen\fR Run in full\-screen mode. .TP \fB\-exchange\fR Exchange the shot button and the beam button. .TP \fB\-trail\fR Add a trail effect to enemies. .TP \fB\-noslowdown\fR Stop an intentional slowdown. .TP \fB\-randomized\fR Attack patterns of enemies randomly change with each play. .SH "USAGE" * How to start At the title screen, you can select a game mode (CLASSIC, BASIC, MODERN) with the up/down key. Push a shot button to start a game. .TP \fBCLASSIC mode\fR \- Sporadic firing. \- Use a capture beam to make a friend of an enemy. \- When your ship collides against an enemy, your ship is destroyed. .TP \fBBASIC mode\fR \- Middle course. \- You can use the capture beam anytime. \- When your ship collides against an enemy, your ship is knocked away. .TP \fBMODERN mode\fR \- Bullet hell. \- Use a provocation beam to force an enemy to fire more bullets and earn a bullet multiplier bonus. \- When your ship collides against an enemy, nothing happens. Your ship and an enemy go through each other. .P * How to play Avoid incoming bullets and strike down all enemies. Controls: .TP \fBMove\fR Arrow / Num / [WASD] / [IJKL] / Stick .TP \fBShot\fR [Z][L\-Ctrl][R\-Ctrl][.] / Button 1, 3, 5, 7, 9, 11 Hold down a button to fire automatically. + MODERN mode \- Hold a provocation beam button at the same time to slow down speed of your ship and fire intensively. .TP \fBCapture beam / Provocation beam\fR [X][L\-Alt][R\-Alt][L\-Shift][R\-Shift][/][Return] / Button 2, 4, 6, 8, 10, 12 + CLASSIC mode \- Capture beam You can capture enemies with the capture beam. To fire the capture beam, a capture beam energy (displayed in the left panel) should be full. The capture beam energy increased when you destroy an enemy. Captured enemies are lined up beside the player and counterattack to other enemies. Your ship is invincible when you are firing the capture beam. + BASIC mode \- Capture beam You can use the capture beam anytime, but your ship isn't invincible while firing. + MODERN mode \- Provocation beam The provocation beam forces an enemy to fire more bullets and you can earn more bullet multiplier bonus. You have to release the shot button to fire the provocation beam. .TP \fBPause\fR [P] .TP \fBExit / Return to the title\fR [ESC] .P Multiplier: A score multiplier is displayed in the upper right. It increases when you destroy a enemy and decreases slowly when the enemy is on the screen. Proximity multiplier: .TP \fBBASIC mode\fR When you destroy an enemy at close range, you can get a proximity multiplier (Max x16). .P Bullet multiplier: .TP \fBMODERN mode\fR When you destroy a pink midsize enemy, bullets flying side\-by\-side are changed into a bullet multiplier in a chain reaction. Use the provocation beam to the midsize enemy to get higher bonus. .P Extra ship: .TP \fBCLASSIC mode\fR You earn an extra ship every 100,000 points. .TP \fBBASIC mode\fR You earn an extra ship every 1,000,000 points. .TP \fBMODERN mode\fR A score to earn the next extra ship is displayed in the upper left. .P .SH "SEE ALSO" You can find more about the game on its homepage: http://www.asahi\-net.or.jp/~cs8k\-cyu/windows/ttn_e.html .SH "AUTHOR" This game has been written by Kenta Cho debian/rules0000755000000000000000000000071112164042423010243 0ustar #!/usr/bin/make -f ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) DFLAGS = -fdebug else DFLAGS = -frelease endif %: dh $@ override_dh_auto_build: dh_auto_build -- DFLAGS="$(DFLAGS)" get-orig-source: dh_testdir dh_testroot wget http://www.asahi-net.or.jp/~cs8k-cyu/windows/ttn0_3.zip unzip ttn0_3.zip rm ttn/*.dll rm ttn/*.exe rm ttn/lib/*.lib rm ttn/resource/*.RES tar cvfz ../titanion_0.3.dfsg1.orig.tar.gz ttn rm -rf ttn0_3.zip ttn debian/control0000644000000000000000000000330012164042423010563 0ustar Source: titanion Section: games Priority: extra Maintainer: Debian Games Team Uploaders: Miriam Ruiz , Peter De Wachter , Barry deFreese Build-Depends: debhelper (>= 9), gdc (>= 4.8.1), libphobos-dev, libglu1-mesa-dev | libglu-dev, libgl1-mesa-dev | libgl-dev, libsdl1.2-dev, libsdl-mixer1.2-dev Build-Conflicts: libphobos-4.4-dev Standards-Version: 3.9.4 Homepage: http://www.asahi-net.or.jp/~cs8k-cyu/windows/ttn_e.html Vcs-Svn: svn://anonscm.debian.org/pkg-games/packages/trunk/titanion/ Vcs-Browser: http://anonscm.debian.org/viewvc/pkg-games/packages/trunk/titanion/ Package: titanion Architecture: any Depends: titanion-data (= ${source:Version}), ${shlibs:Depends}, ${misc:Depends} Description: strike down super high-velocity swooping insects Titanion is an abstract shooter game. While you fire with one button, the other one acts as a tractor ray to attract the enemies and take them to the combat line. The game in itself is quite simple, but with such graphics and playability that it's worth a try. . Titanion is another gem among many by Kenta Cho. Package: titanion-data Architecture: all Multi-Arch: foreign Depends: ${shlibs:Depends}, ${misc:Depends} Recommends: titanion Description: strike down super high-velocity swooping insects - game data Titanion is an abstract shooter game. While you fire with one button, the other one acts as a tractor ray to attract the enemies and take them to the combat line. The game in itself is quite simple, but with such graphics and playability that it's worth a try. . This package includes the architecture-independent data for the game Titanion. debian/titanion.manpages0000644000000000000000000000002212164042423012520 0ustar debian/titanion.6 debian/patches/0000755000000000000000000000000012164042423010613 5ustar debian/patches/series0000644000000000000000000000017012164042423012026 0ustar imports.patch fix.diff directories.patch windowed.patch dotfile.patch window-resize.patch makefile.patch dlang_v2.patch debian/patches/dotfile.patch0000644000000000000000000000554412164042423013272 0ustar # Copyright (C) 2007 Peter De Wachter # Distributed under the same license as the game. See debian/copyright. Index: titanion_0.3.dfsg1/src/abagames/ttn/replay.d =================================================================== --- titanion_0.3.dfsg1.orig/src/abagames/ttn/replay.d 2007-08-26 22:20:21.000000000 +0200 +++ titanion_0.3.dfsg1/src/abagames/ttn/replay.d 2007-08-26 22:20:26.000000000 +0200 @@ -8,13 +8,13 @@ private import std.stream; private import abagames.util.sdl.pad; private import abagames.util.sdl.recordableinput; +private import abagames.ttn.preference; /** * Save/Load a replay data. */ public class ReplayData { public: - static const char[] DIR = "replay"; static const int VERSION_NUM = 30; InputRecord!(PadState) inputRecord; long seed; @@ -24,7 +24,7 @@ private: public void save(char[] fileName) { - auto File fd = new File(DIR ~ "/" ~ fileName, FileMode.OutNew); + auto File fd = new File(Preference.pref_dir() ~ "/" ~ fileName, FileMode.OutNew); fd.write(VERSION_NUM); fd.write(seed); fd.write(score); @@ -35,7 +35,7 @@ } public void load(char[] fileName) { - auto File fd = new File(DIR ~ "/" ~ fileName, FileMode.In); + auto File fd = new File(Preference.pref_dir() ~ "/" ~ fileName, FileMode.In); int ver; fd.read(ver); if (ver != VERSION_NUM) Index: titanion_0.3.dfsg1/src/abagames/ttn/preference.d =================================================================== --- titanion_0.3.dfsg1.orig/src/abagames/ttn/preference.d 2007-08-26 22:20:21.000000000 +0200 +++ titanion_0.3.dfsg1/src/abagames/ttn/preference.d 2007-08-26 23:15:14.000000000 +0200 @@ -6,6 +6,9 @@ module abagames.ttn.preference; private import std.stream; +private import std.file; +private import std.c.stdlib; +private import std.string; private import abagames.util.preference; /** @@ -21,10 +24,24 @@ int[RANKING_NUM][MODE_NUM] _highScore; int _lastMode; + public static char[] pref_dir() + { + char * home = getenv("HOME"); + if (home is null) + throw new Error("HOME environment variable not defined"); + char[] dir = std.string.toString(home) ~ "/.titanion"; + try { + mkdir(dir); + } catch (FileException e) { + } + return dir; + } + + public void load() { auto File fd = null; try { - fd = new File(PREF_FILE_NAME, FileMode.In); + fd = new File(pref_dir() ~ "/" ~ PREF_FILE_NAME, FileMode.In); int ver; fd.read(ver); if (ver != VERSION_NUM) @@ -50,7 +67,7 @@ } public void save() { - auto File fd = new File(PREF_FILE_NAME, FileMode.OutNew); + auto File fd = new File(pref_dir() ~ "/" ~ PREF_FILE_NAME, FileMode.OutNew); fd.write(VERSION_NUM); fd.write(_lastMode); for(int j = 0; j < MODE_NUM; j++) debian/patches/windowed.patch0000644000000000000000000000154612164042423013462 0ustar # Copyright (C) 2007 Miriam Ruiz # Distributed under the same license as the game. See debian/copyright. Index: titanion-0.3.dfsg1/src/abagames/ttn/boot.d =================================================================== --- titanion-0.3.dfsg1.orig/src/abagames/ttn/boot.d 2007-08-26 18:35:35.000000000 +0000 +++ titanion-0.3.dfsg1/src/abagames/ttn/boot.d 2007-08-26 18:36:23.000000000 +0000 @@ -183,5 +183,5 @@ private void usage(char[] progName) { Logger.error - ("Usage: " ~ progName ~ " [-fullscreen] [-res x y] [-brightness [0-100]] [-nosound] [-bgmvol [0-128]] [-sevol [0-128]] [-exchange] [-trail] [-noslowdown] [-randomized]"); + ("Usage: " ~ progName ~ " [-window] [-fullscreen] [-res x y] [-brightness [0-100]] [-nosound] [-bgmvol [0-128]] [-sevol [0-128]] [-exchange] [-trail] [-noslowdown] [-randomized]"); } debian/patches/fix.diff0000644000000000000000000000506012164042423012234 0ustar # Copyright (C) 2007 Marcel Unbehaun # Distributed under the same license as the game. See debian/copyright. Index: titanion-0.3.dfsg1/src/abagames/ttn/screen.d =================================================================== --- titanion-0.3.dfsg1.orig/src/abagames/ttn/screen.d 2007-08-29 19:46:41.000000000 +0200 +++ titanion-0.3.dfsg1/src/abagames/ttn/screen.d 2007-08-29 19:46:43.000000000 +0200 @@ -21,7 +21,7 @@ Field field; protected void setIcon() { - SDL_WM_SetIcon(SDL_LoadBMP(ICON_FILE_NAME), null); + SDL_WM_SetIcon(SDL_LoadBMP(std.string.toStringz(ICON_FILE_NAME)), null); } protected void init() { Index: titanion-0.3.dfsg1/src/abagames/util/rand.d =================================================================== --- titanion-0.3.dfsg1.orig/src/abagames/util/rand.d 2007-08-29 19:46:41.000000000 +0200 +++ titanion-0.3.dfsg1/src/abagames/util/rand.d 2007-08-29 19:46:43.000000000 +0200 @@ -176,14 +176,14 @@ void next_state() { - uint *p=state; + uint *p=state.ptr; /* if init_genrand() has not been called, */ /* a default initial seed is used */ if (initf==0) init_genrand(5489UL); left = N; - next = state; + next = state.ptr; for (int j=N-M+1; --j; p++) *p = p[M] ^ TWIST(p[0], p[1]); Index: titanion-0.3.dfsg1/src/abagames/util/sdl/texture.d =================================================================== --- titanion-0.3.dfsg1.orig/src/abagames/util/sdl/texture.d 2007-08-29 19:46:41.000000000 +0200 +++ titanion-0.3.dfsg1/src/abagames/util/sdl/texture.d 2007-08-29 19:46:43.000000000 +0200 @@ -103,13 +103,13 @@ } glBindTexture(GL_TEXTURE_2D, num + ti); gluBuild2DMipmaps(GL_TEXTURE_2D, 4, panelWidth, panelHeight, - GL_RGBA, GL_UNSIGNED_BYTE, pixels); + GL_RGBA, GL_UNSIGNED_BYTE, pixels.ptr); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); if (maskColor != 0xffffffffu) { glBindTexture(GL_TEXTURE_2D, maskNum + ti); gluBuild2DMipmaps(GL_TEXTURE_2D, 4, panelWidth, panelHeight, - GL_RGBA, GL_UNSIGNED_BYTE, maskPixels); + GL_RGBA, GL_UNSIGNED_BYTE, maskPixels.ptr); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } debian/patches/makefile.patch0000644000000000000000000000076512164042423013421 0ustar # Copyright (C) 2007 Marcel Unbehaun # Copyright (C) 2007 Miriam Ruiz # Distributed under the same license as the game. See debian/copyright. --- /dev/null +++ b/Makefile @@ -0,0 +1,11 @@ +GDC=gdc +DSRC=$(shell find import src/abagames -name "*.d" | sort) +EXE=titanion + +all: $(EXE) + +$(EXE): $(DSRC) + $(GDC) -o $@ -Iimport -Isrc -Wno-deprecated $(DFLAGS) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(DSRC) -lSDL -lGL -lGLU -lSDL_mixer + +clean: + rm -f $(EXE) debian/patches/window-resize.patch0000644000000000000000000000507512164042423014451 0ustar # Copyright (C) 2007 Peter De Wachter # Distributed under the same license as the game. See debian/copyright. Index: titanion_0.3.dfsg1/src/abagames/util/sdl/screen3d.d =================================================================== --- titanion_0.3.dfsg1.orig/src/abagames/util/sdl/screen3d.d 2007-08-28 22:16:36.000000000 +0200 +++ titanion_0.3.dfsg1/src/abagames/util/sdl/screen3d.d 2007-08-28 23:02:14.000000000 +0200 @@ -24,6 +24,7 @@ int _width = 640; int _height = 480; bool _windowMode = true; + Uint32 _videoFlags = 0; protected abstract void init(); protected abstract void close(); @@ -37,13 +38,12 @@ } setIcon(); // Create an OpenGL screen. - Uint32 videoFlags; if (_windowMode) { - videoFlags = SDL_OPENGL | SDL_RESIZABLE; + _videoFlags = SDL_OPENGL | SDL_RESIZABLE; } else { - videoFlags = SDL_OPENGL | SDL_FULLSCREEN; + _videoFlags = SDL_OPENGL | SDL_FULLSCREEN; } - if (SDL_SetVideoMode(_width, _height, 0, videoFlags) == null) { + if (SDL_SetVideoMode(_width, _height, 0, _videoFlags) == null) { throw new SDLInitFailedException ("Unable to create SDL screen: " ~ std.string.toString(SDL_GetError())); } @@ -56,7 +56,20 @@ // Reset a viewport when the screen is resized. public void screenResized() { - glViewport(0, 0, _width, _height); + int screen_width = _width; + int screen_height = _height; + if (SDL_SetVideoMode(screen_width, screen_height, 0, _videoFlags) == null) { + throw new SDLInitFailedException + ("Unable to resize SDL screen: " ~ std.string.toString(SDL_GetError())); + } + + // adjust width and height to maintain correct aspect ratio + if (screen_width * 480 > screen_height * 640) + _width = screen_height * 640 / 480; + else if (screen_width * 480 < screen_height * 640) + _height = screen_width * 480 / 640; + + glViewport((screen_width - _width) / 2, screen_height - _height, _width, _height); glMatrixMode(GL_PROJECTION); setPerspective(); glMatrixMode(GL_MODELVIEW); Index: titanion_0.3.dfsg1/src/abagames/ttn/screen.d =================================================================== --- titanion_0.3.dfsg1.orig/src/abagames/ttn/screen.d 2007-08-28 23:21:31.000000000 +0200 +++ titanion_0.3.dfsg1/src/abagames/ttn/screen.d 2007-08-28 23:22:06.000000000 +0200 @@ -52,7 +52,6 @@ else if (lw > 4) lw = 4; glLineWidth(lw); - glViewport(0, 0, width, height); if (field) field.setLookAt(); } debian/patches/directories.patch0000644000000000000000000000402612164042423014152 0ustar # Copyright (C) 2007 Miriam Ruiz # Distributed under the same license as the game. See debian/copyright. Index: titanion-0.3.dfsg1/src/abagames/ttn/screen.d =================================================================== --- titanion-0.3.dfsg1.orig/src/abagames/ttn/screen.d 2007-08-26 18:32:33.000000000 +0000 +++ titanion-0.3.dfsg1/src/abagames/ttn/screen.d 2007-08-26 18:33:12.000000000 +0000 @@ -17,7 +17,7 @@ public class Screen: Screen3D { private: static const char[] CAPTION = "Titanion"; - static const char[] ICON_FILE_NAME = "images/ttn_icon32.bmp"; + static const char[] ICON_FILE_NAME = "/usr/share/games/titanion/images/ttn_icon32.bmp"; Field field; protected void setIcon() { Index: titanion-0.3.dfsg1/src/abagames/util/sdl/sound.d =================================================================== --- titanion-0.3.dfsg1.orig/src/abagames/util/sdl/sound.d 2007-08-26 18:33:31.000000000 +0000 +++ titanion-0.3.dfsg1/src/abagames/util/sdl/sound.d 2007-08-26 18:33:55.000000000 +0000 @@ -61,7 +61,7 @@ public class Music { public: static int fadeOutSpeed = 1280; - static char[] dir = "sounds/musics"; + static char[] dir = "/usr/share/games/titanion/sounds/musics"; private: Mix_Music* music; @@ -115,7 +115,7 @@ */ public class Chunk { public: - static char[] dir = "sounds/chunks"; + static char[] dir = "/usr/share/games/titanion/sounds/chunks"; private: Mix_Chunk* chunk; int chunkChannel; Index: titanion-0.3.dfsg1/src/abagames/util/sdl/texture.d =================================================================== --- titanion-0.3.dfsg1.orig/src/abagames/util/sdl/texture.d 2007-08-26 18:32:26.000000000 +0000 +++ titanion-0.3.dfsg1/src/abagames/util/sdl/texture.d 2007-08-26 18:33:04.000000000 +0000 @@ -16,7 +16,7 @@ */ public class Texture { public: - static char[] imagesDir = "images/"; + static char[] imagesDir = "/usr/share/games/titanion/images/"; static SDL_Surface*[char[]] surface; private: GLuint num, maskNum; debian/patches/dlang_v2.patch0000644000000000000000000012732312164042423013340 0ustar Description: port to D language version 2 With this patch the code is accapted by gdc-4.6 0.29.1-4.6.4-3 without triggering deprecated feature warnings/errors. Author: Peter De Wachter --- a/src/abagames/ttn/boot.d +++ b/src/abagames/ttn/boot.d @@ -6,6 +6,7 @@ module abagames.ttn.boot; private import std.string; +private import std.conv; private import std.stream; private import std.math; private import std.c.stdlib; @@ -53,10 +54,10 @@ _moduleCtor(); char exe[4096]; GetModuleFileNameA(null, exe, 4096); - char[][1] prog; - prog[0] = std.string.toString(exe); - result = boot(prog ~ std.string.split(std.string.toString(lpCmdLine))); - } catch (Object o) { + string[1] prog; + prog[0] = to!string(exe); + result = boot(prog ~ std.string.split(to!string(lpCmdLine))); + } catch (Throwable o) { Logger.error("Exception: " ~ o.toString()); result = EXIT_FAILURE; } @@ -65,12 +66,12 @@ } } else { // Boot as the general executable. - public int main(char[][] args) { + public int main(string[] args) { return boot(args); } } -public int boot(char[][] args) { +public int boot(string[] args) { screen = new Screen; input = new RecordablePad; frame = new Frame; @@ -85,11 +86,11 @@ return EXIT_SUCCESS; } -private void parseArgs(char[][] commandArgs, Screen screen, RecordablePad pad, MainLoop mainLoop) { - char[][] args = readOptionsIniFile(); +private void parseArgs(string[] commandArgs, Screen screen, RecordablePad pad, MainLoop mainLoop) { + string[] args = readOptionsIniFile(); for (int i = 1; i < commandArgs.length; i++) args ~= commandArgs[i]; - char[] progName = commandArgs[0]; + string progName = commandArgs[0]; for (int i = 0; i < args.length; i++) { switch (args[i]) { case "-fullscreen": @@ -104,9 +105,9 @@ throw new Exception("Invalid options"); } i++; - int w = std.string.atoi(args[i]); + int w = to!int(args[i]); i++; - int h = std.string.atoi(args[i]); + int h = to!int(args[i]); screen.width = w; screen.height = h; break; @@ -116,7 +117,7 @@ throw new Exception("Invalid options"); } i++; - float b = cast(float) std.string.atoi(args[i]) / 100; + float b = cast(float) to!int(args[i]) / 100; if (b < 0 || b > 1) { usage(args[0]); throw new Exception("Invalid options"); @@ -132,7 +133,7 @@ throw new Exception("Invalid options"); } i++; - int v = std.string.atoi(args[i]); + int v = to!int(args[i]); if (v < 0 || v > 128) { usage(args[0]); throw new Exception("Invalid options"); @@ -145,7 +146,7 @@ throw new Exception("Invalid options"); } i++; - int v = std.string.atoi(args[i]); + int v = to!int(args[i]); if (v < 0 || v > 128) { usage(args[0]); throw new Exception("Invalid options"); @@ -171,17 +172,17 @@ } } -private const char[] OPTIONS_INI_FILE = "options.ini"; +private const string OPTIONS_INI_FILE = "options.ini"; -private char[][] readOptionsIniFile() { +private string[] readOptionsIniFile() { try { return Tokenizer.readFile(OPTIONS_INI_FILE, " "); - } catch (Object e) { + } catch (Throwable e) { return null; } } -private void usage(char[] progName) { +private void usage(string progName) { Logger.error ("Usage: " ~ progName ~ " [-window] [-fullscreen] [-res x y] [-brightness [0-100]] [-nosound] [-bgmvol [0-128]] [-sevol [0-128]] [-exchange] [-trail] [-noslowdown] [-randomized]"); } --- a/src/abagames/ttn/bullet.d +++ b/src/abagames/ttn/bullet.d @@ -31,7 +31,7 @@ BulletState.move(); } - public void removeAround(inout int cnt, Vector pos, + public void removeAround(ref int cnt, Vector pos, ParticlePool particles, ParticlePool bonusParticles, Player player) { foreach (Bullet b; actors) { @@ -183,7 +183,7 @@ glEnd(); p = field.calcCircularPos(pos); float d; - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: d = PI; break; --- a/src/abagames/ttn/enemy.d +++ b/src/abagames/ttn/enemy.d @@ -205,7 +205,7 @@ state.ellipseRatio = er; state.ellipseDeg = ed; state.isGoingDownBeforeStandBy = gd; - switch (appPattern) { + switch (appPattern) { default: break; case 0: state.phase = -200; break; @@ -290,7 +290,7 @@ spec.drawTrails(state); } - public Vector pos() { + public override Vector pos() { return state.pos; } } @@ -321,7 +321,7 @@ bool isFirstEnemy; float anger; - invariant { + invariant() { if (isInitialized) { assert(baseBaseSpeed >= 0); assert(baseSpeed >= 0); @@ -345,7 +345,7 @@ public this() { super(); - foreach (inout TurretState ts; turretStates) + foreach (ref TurretState ts; turretStates) ts = new TurretState; vel = new Vector; centerPos = new Vector; @@ -355,7 +355,7 @@ targetSize = new Vector; sizeVel = new Vector; trails = new Trail[TRAIL_NUM]; - foreach (inout Trail t; trails) + foreach (ref Trail t; trails) t = new Trail; } @@ -444,10 +444,10 @@ float rank = 0; bool capturable; int score; - char[] explosionSeName; + string explosionSeName; bool removeBullets; - invariant { + invariant() { assert(shield > 0); assert(rank >= 0); assert(turretWidth >= 0); @@ -548,7 +548,7 @@ TurretState ts = turretStates[i]; float tx = pos.x; float ty = pos.y; - switch (i) { + switch (i) { default: break; case 0: break; case 1: @@ -560,7 +560,7 @@ } float turretDeg = atan2(field.normalizeX(-(player.pos.x - tx)), player.pos.y - ty); - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: if (turretDeg >= 0 && turretDeg < PI - PI / 6) turretDeg = PI - PI / 6; @@ -591,7 +591,7 @@ private void moveCaptured(EnemyState es) { with (es) { - switch (captureState) { + switch (captureState) { default: break; case 1: vel.x += (player.pos.x - pos.x) * 0.03f; vel.y += (player.pos.y - pos.y) * 0.03f; @@ -684,7 +684,7 @@ destroyed(es, dd); return true; } - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: targetSize.x *= 1.3f; targetSize.y *= 1.3f; @@ -793,7 +793,7 @@ switch (phase) { case -300: float cpw; - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: case GameState.Mode.BASIC: cpw = 0.2f; @@ -959,7 +959,7 @@ (cast(EnemyShape) shape).draw(p, cd, es.deg, es.cnt, es.size); for (int i = 1; i < turretNum; i++) { float x = es.pos.x; - switch (i) { + switch (i) { default: break; case 1: x -= turretWidth; break; @@ -988,7 +988,7 @@ float deg; int cnt; - invariant { + invariant() { assert(pos.x <>= 0); assert(pos.y <>= 0); assert(deg <>= 0); @@ -1015,7 +1015,7 @@ this.shape = shape; } - public void draw(EnemyState es) { + public override void draw(EnemyState es) { with (es) { Vector3 p = field.calcCircularPos(pos); float cd = field.calcCircularDeg(pos.x); @@ -1027,13 +1027,13 @@ public override void set(EnemyState es) {} public override bool move(EnemyState es) { return true; } public override void destroyed(EnemyState es, float dd = 0) {} - public void setRank(float rank) {} - public void init(EnemyState es) {} - public bool gotoNextPhase(EnemyState es) { return false; } - public bool isInAttack(EnemyState es) { return false; } - protected int calcStandByTime(EnemyState es) { return 0; } - public bool isBeingCaptured(EnemyState es) { return true; } - public bool isCaptured(EnemyState es) { return true; } + public override void setRank(float rank) {} + public override void init(EnemyState es) {} + public override bool gotoNextPhase(EnemyState es) { return false; } + public override bool isInAttack(EnemyState es) { return false; } + protected override int calcStandByTime(EnemyState es) { return 0; } + public override bool isBeingCaptured(EnemyState es) { return true; } + public override bool isCaptured(EnemyState es) { return true; } } public class MiddleEnemySpec: EnemySpec { @@ -1047,10 +1047,10 @@ GameState gameState) { super(field, bullets, player, particles, bonusParticles, enemies, stage, shape, trailShape, bulletSpec, counterBulletSpec, gameState); - foreach (inout TurretSpec ts; turretSpecs) + foreach (ref TurretSpec ts; turretSpecs) ts = new TurretSpec(field, bullets, player, enemies, particles, stage, bulletSpec, gameState); - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: shield = 2; capturable = false; @@ -1079,10 +1079,10 @@ } } - public void setRank(float r) { + public override void setRank(float r) { rank = sqrt(r); float tr; - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: rank = sqrt(rank); tr = r * 2; @@ -1102,7 +1102,7 @@ if (gameState.mode == GameState.Mode.MODERN) { TurretSpec ts = turretSpecs[0]; int ptn = rand.nextInt(6); - switch (ptn) { + switch (ptn) { default: break; case 0: break; case 1: @@ -1244,7 +1244,7 @@ shape, trailShape, bulletSpec, counterBulletSpec, gameState); turretSpecs[0] = new TurretSpec(field, bullets, player, enemies, particles, stage, bulletSpec, gameState); - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: case GameState.Mode.BASIC: shield = 1; @@ -1276,10 +1276,10 @@ } } - public void setRank(float r) { + public override void setRank(float r) { rank = sqrt(r * 0.5f); float tr; - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: rank = sqrt(rank); tr = r; @@ -1321,7 +1321,7 @@ with (es) { if (phase < 0) return gotoNextPhaseInAppearing(es); - switch (phase) { + switch (phase) { default: break; case 1: if (!player.hasCollision || enemies.numInAttack > stage.attackSmallEnemyNum) { phase = 0; @@ -1374,7 +1374,7 @@ with (es) { if (phase < 0) return gotoNextPhaseInAppearing(es); - switch (phase) { + switch (phase) { default: break; case 1: if (!player.hasCollision || enemies.numInAttack > stage.attackSmallEnemyNum) { phase = 0; @@ -1442,7 +1442,7 @@ int burstNum; int nwaySpeedAccelDir; - invariant { + invariant() { if (isInitialized) { assert(fireCnt <>= 0); assert(burstCnt <>= 0); @@ -1488,7 +1488,7 @@ bool _disabled; float minimumFireDist; - invariant { + invariant() { assert(interval > 0); assert(speed > 0); assert(speedAccel < 1 && speedAccel > -1); @@ -1557,7 +1557,7 @@ float nsr = 0.5f + rand.nextSignedFloat(0.3f); float nr, br, ir; float intervalMax = INTERVAL_MAX; - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: nr = br = 0; ir = sqrt(rank * nsr) * 2; @@ -1603,7 +1603,7 @@ else speed = sqrt(speed * 10) / 10; assert(speed > 0); - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: speed *= 0.36f; if (speed < 0.05f) @@ -1632,7 +1632,7 @@ float nr, br, ir; float nwayDegRatio; float intervalMax = INTERVAL_MAX; - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: nr = br = 0; ir = sqrt(rank * (0.5f + rand.nextSignedFloat(0.3f))) * 2; @@ -1655,7 +1655,7 @@ burstInterval = 3 + rand.nextInt(2); break; case GameState.Mode.MODERN: - switch (rand.nextInt(5)) { + switch (rand.nextInt(5)) { default: break; case 0: rank *= 1.2f; nr = 0; @@ -1702,7 +1702,7 @@ else speed = sqrt(speed * 10) / 10; assert(speed > 0); - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: speed *= 0.36f; if (speed < 0.05f) @@ -1739,6 +1739,10 @@ minimumFireDist = 5; } + public override bool move(TurretState ts) { + return move(ts, 1, 0); + } + public bool move(TurretState ts, float time = 1, float anger = 0) { if (_disabled) return true; --- a/src/abagames/ttn/frame.d +++ b/src/abagames/ttn/frame.d @@ -33,7 +33,7 @@ */ public class Frame: abagames.util.sdl.frame.Frame { private: - static const char[] LAST_REPLAY_FILE_NAME = "last.rpl"; + static const string LAST_REPLAY_FILE_NAME = "last.rpl"; Pad pad; Screen screen; Field field; @@ -235,7 +235,7 @@ replayData.mode = gameState.mode; replayData.stageRandomized = stage.randomized; saveReplay(LAST_REPLAY_FILE_NAME); - } catch (Object o) {} + } catch (Throwable o) {} } public void loadLastReplay() { @@ -244,16 +244,16 @@ gameState.lastGameScore = replayData.score; gameState.lastGameMode = replayData.mode; stage.randomized = replayData.stageRandomized; - } catch (Object o) { + } catch (Throwable o) { resetReplay(); } } - public void saveReplay(char[] fileName) { + public void saveReplay(string fileName) { replayData.save(fileName); } - public void loadReplay(char[] fileName) { + public void loadReplay(string fileName) { replayData = new ReplayData; replayData.load(fileName); } @@ -269,7 +269,7 @@ CLASSIC, BASIC, MODERN, }; static const int MODE_NUM = 3; - static const char[][] MODE_NAME = ["CLASSIC", " BASIC ", "MODERN"]; + static const string[] MODE_NAME = ["CLASSIC", " BASIC ", "MODERN"]; static bool stageRandomized = false; private: static const enum Scene { @@ -298,7 +298,7 @@ int extendScore; int proximityMultiplier, pmDispCnt; - invariant { + invariant() { assert(_multiplier >= 1.0f); } @@ -332,7 +332,7 @@ } public void setExtendScore() { - switch(_mode) { + switch(_mode) { default: break; case Mode.CLASSIC: extendScore = 100000; break; --- a/src/abagames/ttn/letter.d +++ b/src/abagames/ttn/letter.d @@ -111,7 +111,7 @@ return idx; } - public static void drawString(char[] str, float lx, float y, float s, + public static void drawString(string str, float lx, float y, float s, int d = Direction.TO_RIGHT, bool rev = false, float od = 0, float r = 1, float g = 1, float b = 1) { @@ -120,7 +120,7 @@ float x = lx; int idx; float ld; - switch (d) { + switch (d) { default: break; case Direction.TO_RIGHT: ld = 0; break; @@ -157,7 +157,7 @@ } } if (od == 0) { - switch(d) { + switch(d) { default: break; case Direction.TO_RIGHT: x += s * LETTER_WIDTH; break; @@ -299,6 +299,8 @@ case Shape.LINE: drawSegmentLine(x, y, size, length, deg); break; + default: + break; } } } --- a/src/abagames/ttn/particle.d +++ b/src/abagames/ttn/particle.d @@ -47,7 +47,7 @@ float x, float y, float deg, float speed, float sz, float r, float g, float b, int c = 60, bool ebg = true, float num = 0, int waitCnt = 0) { - switch (type) { + switch (type) { default: break; case Shape.TRIANGLE: spec = triangleParticleSpec; break; @@ -108,7 +108,7 @@ float trgSize; int waitCnt; - invariant { + invariant() { if (isInitialized) { assert(pos.x <>= 0); assert(pos.y <>= 0); --- a/src/abagames/ttn/player.d +++ b/src/abagames/ttn/player.d @@ -69,7 +69,7 @@ if (!hasCollision) return false; if (fabs(pos.x - p.x) < size.x && fabs(pos.y - p.y) < size.y) { - switch (spec.gameState.mode) { + switch (spec.gameState.mode) { default: break; case GameState.Mode.CLASSIC: destroy(); break; @@ -140,7 +140,7 @@ } public bool enemiesHasCollision() { - switch (spec.gameState.mode) { + final switch (spec.gameState.mode) { case GameState.Mode.CLASSIC: return state.hasCollision; case GameState.Mode.BASIC: @@ -178,7 +178,7 @@ int ghostShotCnt; bool midEnemyProvacated; - invariant { + invariant() { if (isInitialized) { assert(vel.x <>= 0); assert(vel.y <>= 0); @@ -359,7 +359,7 @@ public void start() { clear(); - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: bulletHitWidth = 0.4f; shotMaxNum = 3; @@ -455,7 +455,7 @@ d += PI / 2; } } - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: /*if (input.button & PadState.Button.A) { if (!aPressed) { @@ -506,7 +506,7 @@ capturedEnemyWidth = 1; } } - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: if (input.button & PadState.Button.B && !captureBeamReleased && captureBeamEnergy >= 1 && @@ -548,7 +548,7 @@ shotCnt--; if (capturedEnemyShotCnt > 0) capturedEnemyShotCnt--; - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: case GameState.Mode.BASIC: if (pos.y > 0) @@ -863,7 +863,7 @@ int cnt; bool isExtending; - invariant { + invariant() { assert(length <>= 0); } @@ -933,7 +933,7 @@ if (s > 1) s = 1; glScalef(s, s, s); - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: case GameState.Mode.BASIC: shapes[c % 3].draw(); --- a/src/abagames/ttn/preference.d +++ b/src/abagames/ttn/preference.d @@ -9,6 +9,7 @@ private import std.file; private import std.c.stdlib; private import std.string; +private import std.conv; private import abagames.util.preference; /** @@ -20,16 +21,16 @@ static const int MODE_NUM = 3; private: static const int VERSION_NUM = 30; - static const char[] PREF_FILE_NAME = "ttn.prf"; + static const string PREF_FILE_NAME = "ttn.prf"; int[RANKING_NUM][MODE_NUM] _highScore; int _lastMode; - public static char[] pref_dir() + public static string pref_dir() { - char * home = getenv("HOME"); + const(char)* home = getenv("HOME"); if (home is null) throw new Error("HOME environment variable not defined"); - char[] dir = std.string.toString(home) ~ "/.titanion"; + string dir = to!string(home) ~ "/.titanion"; try { mkdir(dir); } catch (FileException e) { @@ -39,9 +40,8 @@ public void load() { - auto File fd = null; try { - fd = new File(pref_dir() ~ "/" ~ PREF_FILE_NAME, FileMode.In); + scope File fd = new File(pref_dir() ~ "/" ~ PREF_FILE_NAME, FileMode.In); int ver; fd.read(ver); if (ver != VERSION_NUM) @@ -50,12 +50,8 @@ for(int j = 0; j < MODE_NUM; j++) for(int i = 0; i < RANKING_NUM; i++) fd.read(_highScore[j][i]); - } catch (Object e) { + } catch (Throwable e) { init(); - } finally { - if (fd) - if (fd.isOpen()) - fd.close(); } } @@ -67,7 +63,7 @@ } public void save() { - auto File fd = new File(pref_dir() ~ "/" ~ PREF_FILE_NAME, FileMode.OutNew); + scope File fd = new File(pref_dir() ~ "/" ~ PREF_FILE_NAME, FileMode.OutNew); fd.write(VERSION_NUM); fd.write(_lastMode); for(int j = 0; j < MODE_NUM; j++) --- a/src/abagames/ttn/replay.d +++ b/src/abagames/ttn/replay.d @@ -23,8 +23,8 @@ bool stageRandomized; private: - public void save(char[] fileName) { - auto File fd = new File(Preference.pref_dir() ~ "/" ~ fileName, FileMode.OutNew); + public void save(string fileName) { + scope File fd = new File(Preference.pref_dir() ~ "/" ~ fileName, FileMode.OutNew); fd.write(VERSION_NUM); fd.write(seed); fd.write(score); @@ -34,8 +34,8 @@ fd.close(); } - public void load(char[] fileName) { - auto File fd = new File(Preference.pref_dir() ~ "/" ~ fileName, FileMode.In); + public void load(string fileName) { + scope File fd = new File(Preference.pref_dir() ~ "/" ~ fileName, FileMode.In); int ver; fd.read(ver); if (ver != VERSION_NUM) --- a/src/abagames/ttn/screen.d +++ b/src/abagames/ttn/screen.d @@ -16,15 +16,15 @@ */ public class Screen: Screen3D { private: - static const char[] CAPTION = "Titanion"; - static const char[] ICON_FILE_NAME = "/usr/share/games/titanion/images/ttn_icon32.bmp"; + static const string CAPTION = "Titanion"; + static const string ICON_FILE_NAME = "/usr/share/games/titanion/images/ttn_icon32.bmp"; Field field; - protected void setIcon() { + protected override void setIcon() { SDL_WM_SetIcon(SDL_LoadBMP(std.string.toStringz(ICON_FILE_NAME)), null); } - protected void init() { + protected override void init() { setCaption(CAPTION); glBlendFunc(GL_SRC_ALPHA, GL_ONE); glEnable(GL_BLEND); @@ -42,7 +42,7 @@ screenResized(); } - protected void close() {} + protected override void close() {} public override void screenResized() { super.screenResized(); --- a/src/abagames/ttn/sound.d +++ b/src/abagames/ttn/sound.d @@ -17,17 +17,17 @@ public class Sound: abagames.util.sdl.sound.Sound { mixin StaticRandImpl; private static: - char[][] seFileName = + string[] seFileName = ["shot.wav", "explosion1.wav", "explosion2.wav", "explosion3.wav", "tractor.wav", "flying_down.wav", "player_explosion.wav", "flick.wav", "extend.wav"]; int[] seChannel = [0, 1, 2, 3, 4, 5, 6, 6, 7]; - Music[char[]] bgm; - Chunk[char[]] se; - bool[char[]] seMark; - char[][] bgmFileName; - char[] currentBgm; - int prevBgmIdx; + Music[string] bgm; + Chunk[string] se; + bool[string] seMark; + string[] bgmFileName; + string currentBgm; + ptrdiff_t prevBgmIdx; int nextIdxMv; bool _bgmEnabled = true; bool _seEnabled = true; @@ -38,14 +38,14 @@ } private static void loadMusics() { - Music[char[]] musics; - char[][] files = listdir(Music.dir); - foreach (char[] fileName; files) { - char[] ext = getExt(fileName); - if (ext != "ogg" && ext != "wav") + Music[string] musics; + auto files = dirEntries(Music.dir, SpanMode.shallow); + foreach (string fileName; files) { + string ext = extension(fileName); + if (ext != ".ogg" && ext != ".wav") continue; Music music = new Music(); - music.load(fileName); + music.load(baseName(fileName)); bgm[fileName] = music; bgmFileName ~= fileName; Logger.info("Load bgm: " ~ fileName); @@ -54,7 +54,7 @@ private static void loadChunks() { int i = 0; - foreach (char[] fileName; seFileName) { + foreach (string fileName; seFileName) { Chunk chunk = new Chunk(); chunk.load(fileName, seChannel[i]); se[fileName] = chunk; @@ -64,7 +64,7 @@ } } - public static void playBgm(char[] name) { + public static void playBgm(string name) { currentBgm = name; if (!_bgmEnabled) return; @@ -73,14 +73,14 @@ } public static void playBgm() { - int bgmIdx = rand.nextInt(bgm.length); + int bgmIdx = rand.nextInt(cast(uint)bgm.length); nextIdxMv = rand.nextInt(2) * 2 - 1; prevBgmIdx = bgmIdx; playBgm(bgmFileName[bgmIdx]); } public static void nextBgm() { - int bgmIdx = prevBgmIdx + nextIdxMv; + ptrdiff_t bgmIdx = prevBgmIdx + nextIdxMv; if (bgmIdx < 0) bgmIdx = bgm.length - 1; else if (bgmIdx >= bgm.length) @@ -101,15 +101,15 @@ Music.halt(); } - public static void playSe(char[] name) { + public static void playSe(string name) { if (!_seEnabled) return; seMark[name] = true; } public static void playMarkedSes() { - char[][] keys = seMark.keys; - foreach (char[] key; keys) { + string[] keys = seMark.keys; + foreach (string key; keys) { if (seMark[key]) { se[key].play(); seMark[key] = false; @@ -118,16 +118,16 @@ } public static void clearMarkedSes() { - char[][] keys = seMark.keys; - foreach (char[] key; keys) + string[] keys = seMark.keys; + foreach (string key; keys) seMark[key] = false; } public static void bgmEnabled(bool v) { - return _bgmEnabled = v; + _bgmEnabled = v; } public static void seEnabled(bool v) { - return _seEnabled = v; + _seEnabled = v; } } --- a/src/abagames/ttn/stage.d +++ b/src/abagames/ttn/stage.d @@ -202,7 +202,7 @@ rank *= 0.1f; if (!randomized) { long rs = phaseNum; - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: rs *= 2; break; @@ -218,7 +218,7 @@ } _existsCounterBullet = false; int en; - switch (gameState.mode) { + switch (gameState.mode) { default: break; case GameState.Mode.CLASSIC: en = 24 + cast(int) ((50 + rand.nextInt(10)) * sqrt(rank) * 0.2f); smallEnemyNum = 4 + rand.nextInt(2); @@ -333,7 +333,7 @@ break; SmallEnemySpec ses; int appPattern = formationIdx % 2; - switch (formationIdx % 3) { + switch (formationIdx % 3) { default: break; case 0: case 1: ses = cast(SmallEnemySpec) smallEnemy1Spec; --- a/src/abagames/ttn/title.d +++ b/src/abagames/ttn/title.d @@ -6,6 +6,7 @@ module abagames.ttn.title; private import std.string; +private import std.conv; private import opengl; private import abagames.util.vector; private import abagames.util.sdl.pad; @@ -162,7 +163,7 @@ float y = 140; for (int i = 0; i < rn; i++) { if (cnt < 600) { - char[] rstr; + string rstr; switch (i) { case 0: rstr = "1ST"; @@ -174,7 +175,7 @@ rstr = "3RD"; break; default: - rstr = std.string.toString(i + 1) ~ "TH"; + rstr = to!string(i + 1) ~ "TH"; break; } if (i < 9) --- a/src/abagames/ttn/token.d +++ b/src/abagames/ttn/token.d @@ -22,7 +22,7 @@ ST state; SP spec; - public void init(Object[] args) { + public override void init(Object[] args) { state = new ST; } @@ -45,7 +45,7 @@ _exists = true; } - public void move() { + public override void move() { if (!spec.move(state)) remove(); } @@ -55,7 +55,7 @@ spec.removed(state); } - public void draw() { + public override void draw() { spec.draw(state); } @@ -74,7 +74,7 @@ float deg; float speed; - invariant { + invariant() { if (isInitialized) { assert(pos.x <>= 0); assert(pos.y <>= 0); --- a/src/abagames/util/actor.d +++ b/src/abagames/util/actor.d @@ -5,7 +5,7 @@ */ module abagames.util.actor; -private import std.stdarg; +private import core.vararg; /** * Actor that has an interface to move and draw. @@ -35,7 +35,7 @@ public: T[] actors; protected: - int actorIdx = 0; + ptrdiff_t actorIdx = 0; private: bool hasNoActor; @@ -54,7 +54,7 @@ protected void createActors(int n, Object[] args = null) { actors = new T[n]; - foreach (inout T a; actors) { + foreach (ref T a; actors) { a = new T; a.exists = false; a.init(args); --- a/src/abagames/util/iterator.d +++ b/src/abagames/util/iterator.d @@ -35,10 +35,10 @@ } } -alias ArrayIterator!(char[]) StringIterator; +alias ArrayIterator!(string) StringIterator; public class NoMoreItemsException: Exception { - public this(char[] msg) { + public this(string msg) { super(msg); } } --- a/src/abagames/util/logger.d +++ b/src/abagames/util/logger.d @@ -7,6 +7,7 @@ private import std.stdio; private import std.string; +private import std.conv; /** * Logger for error and info messages. @@ -18,25 +19,21 @@ public class Logger { - public static void info(char[] msg, bool nline = true) { + public static void info(string msg, bool nline = true) { } public static void info(double n, bool nline = true) { } - private static void putMessage(char[] msg) { + private static void putMessage(string msg) { MessageBoxA(null, std.string.toStringz(msg), "Error", MB_OK | MB_ICONEXCLAMATION); } - public static void error(char[] msg) { + public static void error(string msg) { putMessage("Error: " ~ msg); } - public static void error(Exception e) { - putMessage("Error: " ~ e.toString()); - } - - public static void error(Error e) { + public static void error(Throwable e) { putMessage("Error: " ~ e.toString()); } } @@ -45,7 +42,7 @@ public class Logger { - public static void info(char[] msg, bool nline = true) { + public static void info(string msg, bool nline = true) { if (nline) writefln(msg); else @@ -54,20 +51,16 @@ public static void info(double n, bool nline = true) { if (nline) - writefln(std.string.toString(n)); + writefln(to!string(n)); else - writef(std.string.toString(n)); + writef(to!string(n)); } - public static void error(char[] msg) { + public static void error(string msg) { writefln("Error: %s", msg); } - public static void error(Exception e) { - writefln("Error: %s", e.toString()); - } - - public static void error(Error e) { + public static void error(Throwable e) { writefln("Error: %s", e.toString()); if (e.next) error(e.next); --- a/src/abagames/util/rand.d +++ b/src/abagames/util/rand.d @@ -6,7 +6,7 @@ module abagames.util.rand; private import std.stream; -private import std.date; +private import std.datetime; /** * Random number generator. @@ -25,12 +25,12 @@ public class Rand { public this() { - d_time timer = getUTCtime(); - init_genrand(timer); + long timer = Clock.currStdTime(); + init_genrand(cast(uint)timer); } public void setSeed(long n) { - init_genrand(n); + init_genrand(cast(uint)n); } public uint nextInt32() { @@ -66,7 +66,7 @@ Matthe Bellew, and Isaku Wada Andrew C. Edwards v0.1 30 September 2003 edwardsac@ieee.org - Before using, initialize the state by using init_genrand(seed) + Before using, initialize the state by using init_genrand(cast(uint)seed) or init_by_array(init_key, key_length). Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, @@ -133,7 +133,7 @@ { state[0]= s & 0xffffffffUL; for (int j=1; j> 30)) + j); + state[j] = (1812433253U * (state[j-1] ^ (state[j-1] >> 30)) + j); /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ /* In the previous versions, MSBs of the seed affect */ /* only MSBs of the array state[]. */ @@ -151,11 +151,11 @@ void init_by_array(uint init_key[], uint key_length) { int i, j, k; - init_genrand(19650218UL); + init_genrand(cast(uint)19650218UL); i=1; j=0; k = (N>key_length ? N : key_length); for (; k; k--) { - state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1664525UL)) + state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1664525U)) + init_key[j] + j; /* non linear */ state[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ i++; j++; @@ -163,7 +163,7 @@ if (j>=key_length) j=0; } for (k=N-1; k; k--) { - state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1566083941UL)) + state[i] = (state[i] ^ ((state[i-1] ^ (state[i-1] >> 30)) * 1566083941U)) - i; /* non linear */ state[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ i++; @@ -178,9 +178,9 @@ { uint *p=state.ptr; - /* if init_genrand() has not been called, */ + /* if init_genrand(cast(uint)) has not been called, */ /* a default initial seed is used */ - if (initf==0) init_genrand(5489UL); + if (initf==0) init_genrand(cast(uint)5489UL); left = N; next = state.ptr; --- a/src/abagames/util/sdl/mainloop.d +++ b/src/abagames/util/sdl/mainloop.d @@ -91,7 +91,7 @@ frameNum = cast(int) (nowTick - prvTickCount) / itv; if (frameNum <= 0) { frameNum = 1; - SDL_Delay(prvTickCount + itv - nowTick); + SDL_Delay(cast(uint)(prvTickCount + itv - nowTick)); prvTickCount += interval; } else if (frameNum > MAX_SKIP_FRAME) { frameNum = MAX_SKIP_FRAME; --- a/src/abagames/util/sdl/recordableinput.d +++ b/src/abagames/util/sdl/recordableinput.d @@ -39,7 +39,7 @@ } public class NoRecordDataException: Exception { - public this(char[] msg) { + public this(string msg) { super(msg); } } --- a/src/abagames/util/sdl/screen3d.d +++ b/src/abagames/util/sdl/screen3d.d @@ -6,6 +6,7 @@ module abagames.util.sdl.screen3d; private import std.string; +private import std.conv; private import std.math; private import SDL; private import opengl; @@ -34,7 +35,7 @@ // Initialize SDL. if (SDL_Init(SDL_INIT_VIDEO) < 0) { throw new SDLInitFailedException( - "Unable to initialize SDL: " ~ std.string.toString(SDL_GetError())); + "Unable to initialize SDL: " ~ to!string(SDL_GetError())); } setIcon(); // Create an OpenGL screen. @@ -45,7 +46,7 @@ } if (SDL_SetVideoMode(_width, _height, 0, _videoFlags) == null) { throw new SDLInitFailedException - ("Unable to create SDL screen: " ~ std.string.toString(SDL_GetError())); + ("Unable to create SDL screen: " ~ to!string(SDL_GetError())); } glViewport(0, 0, width, height); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); @@ -60,7 +61,7 @@ int screen_height = _height; if (SDL_SetVideoMode(screen_width, screen_height, 0, _videoFlags) == null) { throw new SDLInitFailedException - ("Unable to resize SDL screen: " ~ std.string.toString(SDL_GetError())); + ("Unable to resize SDL screen: " ~ to!string(SDL_GetError())); } // adjust width and height to maintain correct aspect ratio @@ -110,10 +111,10 @@ if (error == GL_NO_ERROR) return; closeSDL(); - throw new Exception("OpenGL error(" ~ std.string.toString(error) ~ ")"); + throw new Exception("OpenGL error(" ~ to!string(error) ~ ")"); } - protected void setCaption(char[] name) { + protected void setCaption(string name) { SDL_WM_SetCaption(std.string.toStringz(name), null); } --- a/src/abagames/util/sdl/sdlexception.d +++ b/src/abagames/util/sdl/sdlexception.d @@ -9,7 +9,7 @@ * SDL initialize failed. */ public class SDLInitFailedException: Exception { - public this(char[] msg) { + public this(string msg) { super(msg); } } @@ -18,7 +18,7 @@ * SDL general exception. */ public class SDLException: Exception { - public this(char[] msg) { + public this(string msg) { super(msg); } } --- a/src/abagames/util/sdl/sound.d +++ b/src/abagames/util/sdl/sound.d @@ -6,6 +6,7 @@ module abagames.util.sdl.sound; private import std.string; +private import std.conv; private import SDL; private import SDL_mixer; private import abagames.util.sdl.sdlexception; @@ -30,7 +31,7 @@ if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { noSound = true; throw new SDLInitFailedException - ("Unable to initialize SDL_AUDIO: " ~ std.string.toString(SDL_GetError())); + ("Unable to initialize SDL_AUDIO: " ~ to!string(SDL_GetError())); } audio_rate = 44100; audio_format = AUDIO_S16; @@ -39,7 +40,7 @@ if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) < 0) { noSound = true; throw new SDLInitFailedException - ("Couldn't open audio: " ~ std.string.toString(SDL_GetError())); + ("Couldn't open audio: " ~ to!string(SDL_GetError())); } Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); Mix_VolumeMusic(bgmVol); @@ -61,19 +62,19 @@ public class Music { public: static int fadeOutSpeed = 1280; - static char[] dir = "/usr/share/games/titanion/sounds/musics"; + static string dir = "/usr/share/games/titanion/sounds/musics"; private: Mix_Music* music; - public void load(char[] name) { + public void load(string name) { if (Sound.noSound) return; - char[] fileName = dir ~ "/" ~ name; + string fileName = dir ~ "/" ~ name; music = Mix_LoadMUS(std.string.toStringz(fileName)); if (!music) { Sound.noSound = true; throw new SDLException("Couldn't load: " ~ fileName ~ - " (" ~ std.string.toString(Mix_GetError()) ~ ")"); + " (" ~ to!string(Mix_GetError()) ~ ")"); } } @@ -115,20 +116,20 @@ */ public class Chunk { public: - static char[] dir = "/usr/share/games/titanion/sounds/chunks"; + static string dir = "/usr/share/games/titanion/sounds/chunks"; private: Mix_Chunk* chunk; int chunkChannel; - public void load(char[] name, int ch) { + public void load(string name, int ch) { if (Sound.noSound) return; - char[] fileName = dir ~ "/" ~ name; + string fileName = dir ~ "/" ~ name; chunk = Mix_LoadWAV(std.string.toStringz(fileName)); if (!chunk) { Sound.noSound = true; throw new SDLException("Couldn't load: " ~ fileName ~ - " (" ~ std.string.toString(Mix_GetError()) ~ ")"); + " (" ~ to!string(Mix_GetError()) ~ ")"); } chunkChannel = ch; } --- a/src/abagames/util/sdl/texture.d +++ b/src/abagames/util/sdl/texture.d @@ -16,19 +16,19 @@ */ public class Texture { public: - static char[] imagesDir = "/usr/share/games/titanion/images/"; - static SDL_Surface*[char[]] surface; + static string imagesDir = "/usr/share/games/titanion/images/"; + static SDL_Surface*[string] surface; private: GLuint num, maskNum; int textureNum, maskTextureNum; Uint32[128 * 128] pixels; Uint32[128 * 128] maskPixels; - public static SDL_Surface* loadBmp(char[] name) { + public static SDL_Surface* loadBmp(string name) { if (name in surface) { return surface[name]; } else { - char[] fileName = imagesDir ~ name; + string fileName = imagesDir ~ name; SDL_Surface *s = SDL_LoadBMP(std.string.toStringz(fileName)); if (!s) throw new SDLInitFailedException("Unable to load: " ~ fileName); @@ -55,7 +55,7 @@ } } - public this(char[] name) { + public this(string name) { SDL_Surface *s = loadBmp(name); glGenTextures(1, &num); glBindTexture(GL_TEXTURE_2D, num); @@ -65,7 +65,7 @@ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); } - public this(char[] name, int sx, int sy, int xn, int yn, int panelWidth, int panelHeight, + public this(string name, int sx, int sy, int xn, int yn, int panelWidth, int panelHeight, Uint32 maskColor = 0xffffffffu) { SDL_Surface *s = loadBmp(name); Uint32* surfacePixels = cast(Uint32*) s.pixels; --- a/src/abagames/util/tokenizer.d +++ b/src/abagames/util/tokenizer.d @@ -7,6 +7,7 @@ private import std.stream; private import std.string; +private import std.conv; /** * Tokenizer. @@ -14,16 +15,16 @@ public class Tokenizer { private: - public static char[][] readFile(char[] fileName, char[] separator) { - char[][] result; - auto File fd = new File(fileName, FileMode.In); + public static string[] readFile(string fileName, string separator) { + string[] result; + scope File fd = new File(fileName, FileMode.In); for (;;) { - char[] line = fd.readLine(); + string line = to!string(fd.readLine()); if (!line) break; - char[][] spl = std.string.split(line, separator); - foreach (char[] s; spl) { - char[] r = strip(s); + string[] spl = std.string.split(line, separator); + foreach (string s; spl) { + string r = strip(s); if (r.length > 0) result ~= r; } @@ -39,7 +40,7 @@ public class CSVTokenizer { private: - public static char[][] readFile(char[] fileName) { + public static string[] readFile(string fileName) { return Tokenizer.readFile(fileName, ","); } } --- a/src/abagames/util/vector.d +++ b/src/abagames/util/vector.d @@ -7,6 +7,7 @@ private import std.math; private import std.string; +private import std.conv; /** * 2D vector. @@ -241,8 +242,8 @@ x = tx; } - public char[] toString() { - return "(" ~ std.string.toString(x) ~ ", " ~ std.string.toString(y) ~ ")"; + public override string toString() { + return "(" ~ to!string(x) ~ ", " ~ to!string(y) ~ ")"; } } @@ -361,7 +362,7 @@ z /= a; } - public char[] toString() { - return "(" ~ std.string.toString(x) ~ ", " ~ std.string.toString(y) ~ ", " ~ std.string.toString(z) ~ ")"; + public override string toString() { + return "(" ~ to!string(x) ~ ", " ~ to!string(y) ~ ", " ~ to!string(z) ~ ")"; } } --- a/src/abagames/util/sdl/pad.d +++ b/src/abagames/util/sdl/pad.d @@ -164,7 +164,11 @@ mixin RecordableInput!(PadState); private: - public PadState getState(bool doRecord = true) { + public override PadState getState() { + return getState(true); + } + + public PadState getState(bool doRecord) { PadState s = super.getState(); if (doRecord) record(s); --- a/src/abagames/ttn/field.d +++ b/src/abagames/ttn/field.d @@ -19,8 +19,8 @@ public class Field { public: static const float PIT_SIZE_Y_RATIO = 12.0f; - private: static const float CIRCLE_RADIUS = 64.0f; + private: static const float EYE_POS_DIST_RATIO = 1.25f; static const float X_EXPANSION_RATIO = 1.0f; static const float SIDEWALL_WIDTH = 145; --- a/src/abagames/ttn/pillar.d +++ b/src/abagames/ttn/pillar.d @@ -55,7 +55,7 @@ } - public int opCmp(Object o) { + public override int opCmp(Object o) { Pillar p = cast(Pillar) o; if (!p) return 0; debian/patches/imports.patch0000644000000000000000000010135312164042423013334 0ustar Description: port import/ code to D language version 2 With this patch the code is accapted by GDC 4.8 without triggering deprecation warnings/errors. Author: Peter De Wachter --- a/import/SDL_Version.d +++ /dev/null @@ -1,75 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Sam Lantinga - slouken@devolution.com -*/ - -/* This header defines the current SDL version */ - -import SDL_types; - -extern(C): - -/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL -*/ -const uint SDL_MAJOR_VERSION = 1; -const uint SDL_MINOR_VERSION = 2; -const uint SDL_PATCHLEVEL = 6; - -struct SDL_version { - Uint8 major; - Uint8 minor; - Uint8 patch; -} - -/* This macro can be used to fill a version structure with the compile-time - * version of the SDL library. - */ -void SDL_VERSION(SDL_version* X) -{ - X.major = SDL_MAJOR_VERSION; - X.minor = SDL_MINOR_VERSION; - X.patch = SDL_PATCHLEVEL; -} - -/* This macro turns the version numbers into a numeric value: - (1,2,3) -> (1203) - This assumes that there will never be more than 100 patchlevels -*/ -uint SDL_VERSIONNUM(Uint8 X, Uint8 Y, Uint8 Z) -{ - return X * 1000 + Y * 100 + Z; -} - -/* This is the version number macro for the current SDL version */ -const uint SDL_COMPILEDVERSION = SDL_MAJOR_VERSION * 1000 + - SDL_MINOR_VERSION * 100 + - SDL_PATCHLEVEL; - -/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */ -bit SDL_VERSION_ATLEAST(Uint8 X, Uint8 Y, Uint8 Z) -{ - return (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)); -} - -/* This function gets the version of the dynamically linked SDL library. - it should NOT be used to fill a version structure, instead you should - use the SDL_Version() macro. - */ -SDL_version * SDL_Linked_Version(); --- a/import/SDL_audio.d +++ b/import/SDL_audio.d @@ -24,6 +24,7 @@ import SDL_error; import SDL_rwops; import SDL_byteorder; +import std.string; extern(C): @@ -42,7 +43,7 @@ Once the callback returns, the buffer will no longer be valid. Stereo samples are stored in a LRLRLR ordering. */ - void (*callback)(void *userdata, Uint8 *stream, int len); + void function(void *userdata, Uint8 *stream, int len) callback; void *userdata; } @@ -74,7 +75,7 @@ int len_cvt; /* Length of converted audio buffer */ int len_mult; /* buffer must be len*len_mult big */ double len_ratio; /* Given len, final size is len*len_ratio */ - void (*filters[10])(SDL_AudioCVT *cvt, Uint16 format); + void function(SDL_AudioCVT *cvt, Uint16 format)[10] filters; int filter_index; /* Current audio conversion function */ } @@ -161,7 +162,7 @@ * This function loads a WAVE from the data source, automatically freeing * that source if 'freesrc' is non-zero. For example, to load a WAVE file, * you could do: - * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", toStringz("rb")), 1, ...); * * If this function succeeds, it returns the given SDL_AudioSpec, * filled with the audio data format of the wave data, and sets @@ -178,7 +179,7 @@ SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); /* Compatibility convenience function -- loads a WAV from a file */ -SDL_AudioSpec *SDL_LoadWAV(char* file, SDL_AudioSpec* spec, +SDL_AudioSpec *SDL_LoadWAV(const(char)* file, SDL_AudioSpec* spec, Uint8 **audio_buf, Uint32 *audio_len) { return SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1, spec, --- a/import/SDL_cdrom.d +++ b/import/SDL_cdrom.d @@ -49,7 +49,7 @@ } /* Given a status, returns true if there's a disk in the drive */ -bit CD_INDRIVE(int status) { return status > 0; } +bool CD_INDRIVE(int status) { return status > 0; } struct SDL_CDtrack { Uint8 id; /* Track number */ --- a/import/SDL_endian.d +++ b/import/SDL_endian.d @@ -47,7 +47,7 @@ */ Uint16 SDL_Swap16(Uint16 D) { - return((D<<8)|(D>>8)); + return cast(Uint16)((D<<8)|(D>>8)); } Uint32 SDL_Swap32(Uint32 D) { --- a/import/SDL_events.d +++ b/import/SDL_events.d @@ -271,7 +271,7 @@ The filter is protypted as: */ -alias int (*SDL_EventFilter)(SDL_Event *event); +alias int function(SDL_Event *event) SDL_EventFilter; /* If the filter returns 1, then the event will be added to the internal queue. If it returns 0, then the event will be dropped from the queue, but the --- a/import/SDL_mixer.d +++ b/import/SDL_mixer.d @@ -104,10 +104,10 @@ /* Load a wave file or a music (.mod .s3m .it .xm) file */ Mix_Chunk * Mix_LoadWAV_RW(SDL_RWops *src, int freesrc); - Mix_Chunk * Mix_LoadWAV(char *file) { + Mix_Chunk * Mix_LoadWAV(const(char) *file) { return Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1); } - Mix_Music * Mix_LoadMUS(char *file); + Mix_Music * Mix_LoadMUS(const(char) *file); /* Load a wave file of the mixer format from a memory buffer */ Mix_Chunk * Mix_QuickLoad_WAV(Uint8 *mem); @@ -128,19 +128,17 @@ This can be used to provide real-time visual display of the audio stream or add a custom mixer filter for the stream data. */ - void Mix_SetPostMix(void (*mix_func) - (void *udata, Uint8 *stream, int len), void *arg); + void Mix_SetPostMix(void function(void *udata, Uint8 *stream, int len) mix_func, void *arg); /* Add your own music player or additional mixer function. If 'mix_func' is NULL, the default music player is re-enabled. */ - void Mix_HookMusic(void (*mix_func) - (void *udata, Uint8 *stream, int len), void *arg); + void Mix_HookMusic(void function(void *udata, Uint8 *stream, int len) mix_func, void *arg); /* Add your own callback when the music has finished playing. This callback is only called if the music finishes naturally. */ - void Mix_HookMusicFinished(void (*music_finished)()); + void Mix_HookMusicFinished(void function() music_finished); /* Get a pointer to the user data for the current music hook */ void * Mix_GetMusicHookData(); @@ -153,7 +151,7 @@ * inside the audio callback, or SDL_mixer will explicitly lock the audio * before calling your callback. */ - void Mix_ChannelFinished(void (*channel_finished)(int channel)); + void Mix_ChannelFinished(void function(int channel) channel_finished); /* Special Effects API by ryan c. gordon. (icculus@linuxgames.com) */ @@ -177,7 +175,7 @@ * * DO NOT EVER call SDL_LockAudio() from your callback function! */ - typedef void (*Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata); + alias void function(int chan, void *stream, int len, void *udata) Mix_EffectFunc_t; /* * This is a callback that signifies that a channel has finished all its @@ -188,7 +186,7 @@ * * DO NOT EVER call SDL_LockAudio() from your callback function! */ - typedef void (*Mix_EffectDone_t)(int chan, void *udata); + alias void function(int chan, void *udata) Mix_EffectDone_t; /* Register a special effect function. At mixing time, the channel data is @@ -510,7 +508,7 @@ int Mix_PlayingMusic(); /* Stop music and set external music playback command */ - int Mix_SetMusicCMD(char *command); + int Mix_SetMusicCMD(const(char) *command); /* Synchro value is set by MikMod from modules while playing */ int Mix_SetSynchroValue(int value); --- a/import/SDL_quit.d +++ b/import/SDL_quit.d @@ -40,8 +40,8 @@ */ /* There are no functions directly affecting the quit event */ -bit SDL_QuitRequested() +bool SDL_QuitRequested() { SDL_PumpEvents(); - return cast(bit)SDL_PeepEvents(null, 0, SDL_PEEKEVENT, SDL_QUITMASK); + return 0 != SDL_PeepEvents(null, 0, SDL_PEEKEVENT, SDL_QUITMASK); } --- a/import/SDL_rwops.d +++ b/import/SDL_rwops.d @@ -28,11 +28,6 @@ extern(C): -typedef int (*_seek_func_t)(SDL_RWops *context, int offset, int whence); -typedef int (*_read_func_t)(SDL_RWops *context, void *ptr, int size, int maxnum); -typedef int (*_write_func_t)(SDL_RWops *context, void *ptr, int size, int num); -typedef int (*_close_func_t)(SDL_RWops *context); - /* This is the read/write operation structure -- very basic */ struct SDL_RWops { @@ -40,26 +35,22 @@ SEEK_SET, SEEK_CUR, SEEK_END Returns the final offset in the data source. */ - _seek_func_t seek; -// int (*seek)(SDL_RWops *context, int offset, int whence); + int function(SDL_RWops *context, int offset, int whence) seek; /* Read up to 'num' objects each of size 'objsize' from the data source to the area pointed at by 'ptr'. Returns the number of objects read, or -1 if the read failed. */ - _read_func_t read; -// int (*read)(SDL_RWops *context, void *ptr, int size, int maxnum); + int function(SDL_RWops *context, void *ptr, int size, int maxnum) read; /* Write exactly 'num' objects each of size 'objsize' from the area pointed at by 'ptr' to data source. Returns 'num', or -1 if the write failed. */ - _write_func_t write; -// int (*write)(SDL_RWops *context, void *ptr, int size, int num); + int function(SDL_RWops *context, void *ptr, int size, int num) write; /* Close and free an allocated SDL_FSops structure */ - _close_func_t close; -// int (*close)(SDL_RWops *context); + int function(SDL_RWops *context) close; Uint32 type; union { @@ -81,7 +72,7 @@ /* Functions to create SDL_RWops structures from various data sources */ -SDL_RWops * SDL_RWFromFile(char *file, char *mode); +SDL_RWops * SDL_RWFromFile(const(char)* file, const(char)* mode); SDL_RWops * SDL_RWFromFP(void *fp, int autoclose); @@ -93,40 +84,25 @@ /* Macros to easily read and write from an SDL_RWops structure */ int SDL_RWseek(SDL_RWops *ctx, int offset, int whence) { - _seek_func_t seek; -// int (*seek)(SDL_RWops *context, int offset, int whence); - seek = ctx.seek; - return (*seek)(ctx, offset, whence); + return ctx.seek(ctx, offset, whence); } int SDL_RWtell(SDL_RWops *ctx) { - _seek_func_t seek; -// int (*seek)(SDL_RWops *context, int offset, int whence); - seek = ctx.seek; - return (*seek)(ctx, 0, 1); + return ctx.seek(ctx, 0, 1); } int SDL_RWread(SDL_RWops *ctx, void* ptr, int size, int n) { - _read_func_t read; -// int (*read)(SDL_RWops *context, void *ptr, int size, int maxnum); - read = ctx.read; - return (*read)(ctx, ptr, size, n); + return ctx.read(ctx, ptr, size, n); } int SDL_RWwrite(SDL_RWops *ctx, void* ptr, int size, int n) { - _write_func_t write; -// int (*write)(SDL_RWops *context, void *ptr, int size, int num); - write = ctx.write; - return (*write)(ctx, ptr, size, n); + return ctx.write(ctx, ptr, size, n); } int SDL_RWclose(SDL_RWops *ctx) { - _close_func_t close; -// int (*close)(SDL_RWops *context); - close = ctx.close; - return (*close)(ctx); + return ctx.close(ctx); } --- a/import/SDL_thread.d +++ b/import/SDL_thread.d @@ -34,7 +34,7 @@ struct SDL_Thread { } /* Create a thread */ -SDL_Thread * SDL_CreateThread(int (*fn)(void *), void *data); +SDL_Thread * SDL_CreateThread(int function(void *) fn, void *data); /* Get the 32-bit thread identifier for the current thread */ Uint32 SDL_ThreadID(); --- a/import/SDL_timer.d +++ b/import/SDL_timer.d @@ -39,7 +39,7 @@ void SDL_Delay(Uint32 ms); /* Function prototype for the timer callback function */ -alias Uint32 (*SDL_TimerCallback)(Uint32 interval); +alias Uint32 function(Uint32 interval) SDL_TimerCallback; /* Set a callback to run after the specified number of milliseconds has * elapsed. The callback function is passed the current timer interval @@ -79,7 +79,7 @@ * passed in, the periodic alarm continues, otherwise a new alarm is * scheduled. If the callback returns 0, the periodic alarm is cancelled. */ -alias Uint32 (*SDL_NewTimerCallback)(Uint32 interval, void *param); +alias Uint32 function(Uint32 interval, void *param) SDL_NewTimerCallback; /* Definition of the timer ID type */ alias void *SDL_TimerID; --- a/import/SDL_types.d +++ b/import/SDL_types.d @@ -33,7 +33,7 @@ alias ushort Uint16; alias short Sint16; alias uint Uint32; -alias int Sint32; +alias int Sint32; alias ulong Uint64; alias long Sint64; --- a/import/SDL_version_.d +++ b/import/SDL_version_.d @@ -63,7 +63,7 @@ SDL_PATCHLEVEL; /* This macro will evaluate to true if compiled with SDL at least X.Y.Z */ -bit SDL_VERSION_ATLEAST(Uint8 X, Uint8 Y, Uint8 Z) +bool SDL_VERSION_ATLEAST(Uint8 X, Uint8 Y, Uint8 Z) { return (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)); } --- a/import/SDL_video.d +++ b/import/SDL_video.d @@ -74,9 +74,9 @@ Uint8 alpha; } -/* typedef for private surface blitting functions */ -typedef int (*SDL_blit)(SDL_Surface *src, SDL_Rect *srcrect, - SDL_Surface *dst, SDL_Rect *dstrect); +/* alias for private surface blitting functions */ +alias int function(SDL_Surface *src, SDL_Rect *srcrect, + SDL_Surface *dst, SDL_Rect *dstrect) SDL_blit; /* This structure should be treated as read-only, except for 'pixels', which, if not NULL, contains the raw pixel data for the surface. @@ -132,7 +132,7 @@ const uint SDL_PREALLOC = 0x01000000; /* Surface uses preallocated memory */ /* Evaluates to true if the surface needs to be locked before access */ -bit SDL_MUSTLOCK(SDL_Surface *surface) +bool SDL_MUSTLOCK(SDL_Surface *surface) { return surface.offset || ((surface.flags & (SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_RLEACCEL)) != 0); @@ -186,7 +186,7 @@ /* Special flags */ union { - bit hw_overlay; + bool hw_overlay; Uint32 _dummy; } // Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */ @@ -540,7 +540,7 @@ SDL_Surface * SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); /* Convenience macro -- load a surface from a file */ -SDL_Surface * SDL_LoadBMP(char* file) +SDL_Surface * SDL_LoadBMP(const(char)* file) { return SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1); } @@ -554,7 +554,7 @@ (SDL_Surface *surface, SDL_RWops *dst, int freedst); /* Convenience macro -- save a surface to a file */ -int SDL_SaveBMP(SDL_Surface *surface, char* file) +int SDL_SaveBMP(SDL_Surface *surface, const(char)* file) { return SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1); } @@ -837,7 +837,7 @@ /* * Sets/Gets the title and icon text of the display window */ -void SDL_WM_SetCaption(char *title, char *icon); +void SDL_WM_SetCaption(const(char) *title, char *icon); void SDL_WM_GetCaption(char **title, char **icon); /* --- a/import/opengl.d +++ b/import/opengl.d @@ -1,10 +1,4 @@ -version (Win32) { - private import std.c.windows.windows; - extern(Windows): -} -version (linux) { - extern(C): -} +extern(System): alias uint GLenum; alias ubyte GLboolean; @@ -165,6 +159,7 @@ const uint GL_3_BYTES = 0x1408; const uint GL_4_BYTES = 0x1409; const uint GL_DOUBLE = 0x140A; +const uint GL_UNSIGNED_INT_8_8_8_8_REV = 0x8367; /* DepthFunction */ /* GL_NEVER */ @@ -1116,7 +1111,7 @@ /*************************************************************/ void /*APIENTRY*/glAccum (GLenum op, GLfloat value); -void /*APIENTRY*/glAlphaFunc (GLenum func, GLclampf ref); +void /*APIENTRY*/glAlphaFunc (GLenum func, GLclampf ref_); GLboolean /*APIENTRY*/glAreTexturesResident (GLsizei n, GLuint *textures, GLboolean *residences); void /*APIENTRY*/glArrayElement (GLint i); void /*APIENTRY*/glBegin (GLenum mode); @@ -1369,7 +1364,7 @@ void /*APIENTRY*/glScissor (GLint x, GLint y, GLsizei width, GLsizei height); void /*APIENTRY*/glSelectBuffer (GLsizei size, GLuint *buffer); void /*APIENTRY*/glShadeModel (GLenum mode); -void /*APIENTRY*/glStencilFunc (GLenum func, GLint ref, GLuint mask); +void /*APIENTRY*/glStencilFunc (GLenum func, GLint ref_, GLuint mask); void /*APIENTRY*/glStencilMask (GLuint mask); void /*APIENTRY*/glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); void /*APIENTRY*/glTexCoord1d (GLdouble s); @@ -1454,35 +1449,30 @@ /* EXT_vertex_array */ -typedef void (* PFNGLARRAYELEMENTEXTPROC) (GLint i); -typedef void (* PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count); -typedef void (* PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer); -typedef void (* PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer); -typedef void (* PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer); -typedef void (* PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer); -typedef void (* PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer); -typedef void (* PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, GLboolean *pointer); -typedef void (* PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params); -typedef void (* PFNGLARRAYELEMENTARRAYEXTPROC)(GLenum mode, GLsizei count, GLvoid* pi); +alias void function(GLint i) PFNGLARRAYELEMENTEXTPROC; +alias void function(GLenum mode, GLint first, GLsizei count) PFNGLDRAWARRAYSEXTPROC; +alias void function(GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer) PFNGLVERTEXPOINTEREXTPROC; +alias void function(GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer) PFNGLNORMALPOINTEREXTPROC; +alias void function(GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer) PFNGLCOLORPOINTEREXTPROC; +alias void function(GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer) PFNGLINDEXPOINTEREXTPROC; +alias void function(GLint size, GLenum type, GLsizei stride, GLsizei count, GLvoid *pointer) PFNGLTEXCOORDPOINTEREXTPROC; +alias void function(GLsizei stride, GLsizei count, GLboolean *pointer) PFNGLEDGEFLAGPOINTEREXTPROC; +alias void function(GLenum pname, GLvoid* *params) PFNGLGETPOINTERVEXTPROC; +alias void function(GLenum mode, GLsizei count, GLvoid* pi) PFNGLARRAYELEMENTARRAYEXTPROC; /* WIN_draw_range_elements */ -typedef void (* PFNGLDRAWRANGEELEMENTSWINPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLvoid *indices); +alias void function(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLvoid *indices) PFNGLDRAWRANGEELEMENTSWINPROC; /* WIN_swap_hint */ -typedef void (* PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +alias void function(GLint x, GLint y, GLsizei width, GLsizei height) PFNGLADDSWAPHINTRECTWINPROC; /* EXT_paletted_texture */ -typedef void (* PFNGLCOLORTABLEEXTPROC) - (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, - GLenum type, GLvoid *data); -typedef void (* PFNGLCOLORSUBTABLEEXTPROC) - (GLenum target, GLsizei start, GLsizei count, GLenum format, - GLenum type, GLvoid *data); -typedef void (* PFNGLGETCOLORTABLEEXTPROC) - (GLenum target, GLenum format, GLenum type, GLvoid *data); -typedef void (* PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) - (GLenum target, GLenum pname, GLint *params); -typedef void (* PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) - (GLenum target, GLenum pname, GLfloat *params); +alias void function(GLenum target, GLenum internalFormat, GLsizei width, GLenum format, + GLenum type, GLvoid *data) PFNGLCOLORTABLEEXTPROC; +alias void function(GLenum target, GLsizei start, GLsizei count, GLenum format, + GLenum type, GLvoid *data) PFNGLCOLORSUBTABLEEXTPROC; +alias void function(GLenum target, GLenum format, GLenum type, GLvoid *data) PFNGLGETCOLORTABLEEXTPROC; +alias void function(GLenum target, GLenum pname, GLint *params) PFNGLGETCOLORTABLEPARAMETERIVEXTPROC; +alias void function(GLenum target, GLenum pname, GLfloat *params) PFNGLGETCOLORTABLEPARAMETERFVEXTPROC; //import openglu; --- a/import/openglu.d +++ b/import/openglu.d @@ -1,11 +1,6 @@ import opengl; -version (Win32) { - extern(Windows): -} -version (linux) { - extern(C): -} +extern(System): GLubyte* gluErrorString ( GLenum errCode); @@ -33,7 +28,7 @@ GLdouble y, GLdouble width, GLdouble height, - GLint[4] viewport); + ref GLint[4] viewport); void gluLookAt ( GLdouble eyex, @@ -50,9 +45,9 @@ GLdouble objx, GLdouble objy, GLdouble objz, - GLdouble[16] modelMatrix, - GLdouble[16] projMatrix, - GLint[4] viewport, + ref GLdouble[16] modelMatrix, + ref GLdouble[16] projMatrix, + ref GLint[4] viewport, GLdouble *winx, GLdouble *winy, GLdouble *winz); @@ -61,8 +56,8 @@ GLdouble winx, GLdouble winy, GLdouble winz, - GLdouble[16] modelMatrix, - GLdouble[16] projMatrix, + ref GLdouble[16] modelMatrix, + ref GLdouble[16] projMatrix, GLint[4] viewport, GLdouble *objx, GLdouble *objy, @@ -162,7 +157,7 @@ void gluQuadricCallback ( GLUquadric *qobj, GLenum which, - void (* fn)()); + void function() fn); GLUtesselator* gluNewTess( ); @@ -179,7 +174,7 @@ void gluTessVertex( GLUtesselator *tess, - GLdouble[3] coords, + ref GLdouble[3] coords, void *data ); void gluTessEndContour( @@ -202,7 +197,7 @@ void gluTessCallback( GLUtesselator *tess, GLenum which, - void ( *fn)()); + void function() fn); void gluGetTessProperty( GLUtesselator *tess, @@ -265,9 +260,9 @@ void gluLoadSamplingMatrices ( GLUnurbs *nobj, - GLfloat[16] modelMatrix, - GLfloat[16] projMatrix, - GLint[4] viewport ); + ref GLfloat[16] modelMatrix, + ref GLfloat[16] projMatrix, + ref GLint[4] viewport ); void gluNurbsProperty ( @@ -285,37 +280,37 @@ gluNurbsCallback ( GLUnurbs *nobj, GLenum which, - void (* fn)() ); + void function() fn ); /**** function prototypes ****/ /* gluQuadricCallback */ -typedef void (* GLUquadricErrorProc) (GLenum); +alias void function(GLenum) GLUquadricErrorProc; /* gluTessCallback */ -typedef void (* GLUtessBeginProc) (GLenum); -typedef void (* GLUtessEdgeFlagProc) (GLboolean); -typedef void (* GLUtessVertexProc) (void *); -typedef void (* GLUtessEndProc) (); -typedef void (* GLUtessErrorProc) (GLenum); -typedef void (* GLUtessCombineProc) (GLdouble[3], - void*[4], - GLfloat[4], - void** ); -typedef void (* GLUtessBeginDataProc) (GLenum, void *); -typedef void (* GLUtessEdgeFlagDataProc) (GLboolean, void *); -typedef void (* GLUtessVertexDataProc) (void *, void *); -typedef void (* GLUtessEndDataProc) (void *); -typedef void (* GLUtessErrorDataProc) (GLenum, void *); -typedef void (* GLUtessCombineDataProc) (GLdouble[3], - void*[4], - GLfloat[4], - void**, - void* ); +alias void function(GLenum) GLUtessBeginProc; +alias void function(GLboolean) GLUtessEdgeFlagProc; +alias void function(void *) GLUtessVertexProc; +alias void function() GLUtessEndProc; +alias void function(GLenum) GLUtessErrorProc; +alias void function(ref GLdouble[3], + ref void*[4], + ref GLfloat[4], + void**) GLUtessCombineProc; +alias void function(GLenum, void *) GLUtessBeginDataProc; +alias void function(GLboolean, void *) GLUtessEdgeFlagDataProc; +alias void function(void *, void *) GLUtessVertexDataProc; +alias void function(void *) GLUtessEndDataProc; +alias void function(GLenum, void *) GLUtessErrorDataProc; +alias void function(ref GLdouble[3], + ref void*[4], + ref GLfloat[4], + void**, + void*) GLUtessCombineDataProc; /* gluNurbsCallback */ -typedef void (* GLUnurbsErrorProc) (GLenum); +alias void function(GLenum) GLUnurbsErrorProc; /**** Generic constants ****/ --- a/import/SDL_Keysym.d +++ /dev/null @@ -1,308 +0,0 @@ -/* - SDL - Simple DirectMedia Layer - Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - Sam Lantinga - slouken@devolution.com -*/ - -/* What we really want is a mapping of every raw key on the keyboard. - To support international keyboards, we use the range 0xA1 - 0xFF - as international virtual keycodes. We'll follow in the footsteps of X11... - The names of the keys - */ - -alias int SDLKey; -enum { - /* The keyboard syms have been cleverly chosen to map to ASCII */ - SDLK_UNKNOWN = 0, - SDLK_FIRST = 0, - SDLK_BACKSPACE = 8, - SDLK_TAB = 9, - SDLK_CLEAR = 12, - SDLK_RETURN = 13, - SDLK_PAUSE = 19, - SDLK_ESCAPE = 27, - SDLK_SPACE = 32, - SDLK_EXCLAIM = 33, - SDLK_QUOTEDBL = 34, - SDLK_HASH = 35, - SDLK_DOLLAR = 36, - SDLK_AMPERSAND = 38, - SDLK_QUOTE = 39, - SDLK_LEFTPAREN = 40, - SDLK_RIGHTPAREN = 41, - SDLK_ASTERISK = 42, - SDLK_PLUS = 43, - SDLK_COMMA = 44, - SDLK_MINUS = 45, - SDLK_PERIOD = 46, - SDLK_SLASH = 47, - SDLK_0 = 48, - SDLK_1 = 49, - SDLK_2 = 50, - SDLK_3 = 51, - SDLK_4 = 52, - SDLK_5 = 53, - SDLK_6 = 54, - SDLK_7 = 55, - SDLK_8 = 56, - SDLK_9 = 57, - SDLK_COLON = 58, - SDLK_SEMICOLON = 59, - SDLK_LESS = 60, - SDLK_EQUALS = 61, - SDLK_GREATER = 62, - SDLK_QUESTION = 63, - SDLK_AT = 64, - /* - Skip uppercase letters - */ - SDLK_LEFTBRACKET = 91, - SDLK_BACKSLASH = 92, - SDLK_RIGHTBRACKET = 93, - SDLK_CARET = 94, - SDLK_UNDERSCORE = 95, - SDLK_BACKQUOTE = 96, - SDLK_a = 97, - SDLK_b = 98, - SDLK_c = 99, - SDLK_d = 100, - SDLK_e = 101, - SDLK_f = 102, - SDLK_g = 103, - SDLK_h = 104, - SDLK_i = 105, - SDLK_j = 106, - SDLK_k = 107, - SDLK_l = 108, - SDLK_m = 109, - SDLK_n = 110, - SDLK_o = 111, - SDLK_p = 112, - SDLK_q = 113, - SDLK_r = 114, - SDLK_s = 115, - SDLK_t = 116, - SDLK_u = 117, - SDLK_v = 118, - SDLK_w = 119, - SDLK_x = 120, - SDLK_y = 121, - SDLK_z = 122, - SDLK_DELETE = 127, - /* End of ASCII mapped keysyms */ - - /* International keyboard syms */ - SDLK_WORLD_0 = 160, /* 0xA0 */ - SDLK_WORLD_1 = 161, - SDLK_WORLD_2 = 162, - SDLK_WORLD_3 = 163, - SDLK_WORLD_4 = 164, - SDLK_WORLD_5 = 165, - SDLK_WORLD_6 = 166, - SDLK_WORLD_7 = 167, - SDLK_WORLD_8 = 168, - SDLK_WORLD_9 = 169, - SDLK_WORLD_10 = 170, - SDLK_WORLD_11 = 171, - SDLK_WORLD_12 = 172, - SDLK_WORLD_13 = 173, - SDLK_WORLD_14 = 174, - SDLK_WORLD_15 = 175, - SDLK_WORLD_16 = 176, - SDLK_WORLD_17 = 177, - SDLK_WORLD_18 = 178, - SDLK_WORLD_19 = 179, - SDLK_WORLD_20 = 180, - SDLK_WORLD_21 = 181, - SDLK_WORLD_22 = 182, - SDLK_WORLD_23 = 183, - SDLK_WORLD_24 = 184, - SDLK_WORLD_25 = 185, - SDLK_WORLD_26 = 186, - SDLK_WORLD_27 = 187, - SDLK_WORLD_28 = 188, - SDLK_WORLD_29 = 189, - SDLK_WORLD_30 = 190, - SDLK_WORLD_31 = 191, - SDLK_WORLD_32 = 192, - SDLK_WORLD_33 = 193, - SDLK_WORLD_34 = 194, - SDLK_WORLD_35 = 195, - SDLK_WORLD_36 = 196, - SDLK_WORLD_37 = 197, - SDLK_WORLD_38 = 198, - SDLK_WORLD_39 = 199, - SDLK_WORLD_40 = 200, - SDLK_WORLD_41 = 201, - SDLK_WORLD_42 = 202, - SDLK_WORLD_43 = 203, - SDLK_WORLD_44 = 204, - SDLK_WORLD_45 = 205, - SDLK_WORLD_46 = 206, - SDLK_WORLD_47 = 207, - SDLK_WORLD_48 = 208, - SDLK_WORLD_49 = 209, - SDLK_WORLD_50 = 210, - SDLK_WORLD_51 = 211, - SDLK_WORLD_52 = 212, - SDLK_WORLD_53 = 213, - SDLK_WORLD_54 = 214, - SDLK_WORLD_55 = 215, - SDLK_WORLD_56 = 216, - SDLK_WORLD_57 = 217, - SDLK_WORLD_58 = 218, - SDLK_WORLD_59 = 219, - SDLK_WORLD_60 = 220, - SDLK_WORLD_61 = 221, - SDLK_WORLD_62 = 222, - SDLK_WORLD_63 = 223, - SDLK_WORLD_64 = 224, - SDLK_WORLD_65 = 225, - SDLK_WORLD_66 = 226, - SDLK_WORLD_67 = 227, - SDLK_WORLD_68 = 228, - SDLK_WORLD_69 = 229, - SDLK_WORLD_70 = 230, - SDLK_WORLD_71 = 231, - SDLK_WORLD_72 = 232, - SDLK_WORLD_73 = 233, - SDLK_WORLD_74 = 234, - SDLK_WORLD_75 = 235, - SDLK_WORLD_76 = 236, - SDLK_WORLD_77 = 237, - SDLK_WORLD_78 = 238, - SDLK_WORLD_79 = 239, - SDLK_WORLD_80 = 240, - SDLK_WORLD_81 = 241, - SDLK_WORLD_82 = 242, - SDLK_WORLD_83 = 243, - SDLK_WORLD_84 = 244, - SDLK_WORLD_85 = 245, - SDLK_WORLD_86 = 246, - SDLK_WORLD_87 = 247, - SDLK_WORLD_88 = 248, - SDLK_WORLD_89 = 249, - SDLK_WORLD_90 = 250, - SDLK_WORLD_91 = 251, - SDLK_WORLD_92 = 252, - SDLK_WORLD_93 = 253, - SDLK_WORLD_94 = 254, - SDLK_WORLD_95 = 255, /* 0xFF */ - - /* Numeric keypad */ - SDLK_KP0 = 256, - SDLK_KP1 = 257, - SDLK_KP2 = 258, - SDLK_KP3 = 259, - SDLK_KP4 = 260, - SDLK_KP5 = 261, - SDLK_KP6 = 262, - SDLK_KP7 = 263, - SDLK_KP8 = 264, - SDLK_KP9 = 265, - SDLK_KP_PERIOD = 266, - SDLK_KP_DIVIDE = 267, - SDLK_KP_MULTIPLY = 268, - SDLK_KP_MINUS = 269, - SDLK_KP_PLUS = 270, - SDLK_KP_ENTER = 271, - SDLK_KP_EQUALS = 272, - - /* Arrows + Home/End pad */ - SDLK_UP = 273, - SDLK_DOWN = 274, - SDLK_RIGHT = 275, - SDLK_LEFT = 276, - SDLK_INSERT = 277, - SDLK_HOME = 278, - SDLK_END = 279, - SDLK_PAGEUP = 280, - SDLK_PAGEDOWN = 281, - - /* Function keys */ - SDLK_F1 = 282, - SDLK_F2 = 283, - SDLK_F3 = 284, - SDLK_F4 = 285, - SDLK_F5 = 286, - SDLK_F6 = 287, - SDLK_F7 = 288, - SDLK_F8 = 289, - SDLK_F9 = 290, - SDLK_F10 = 291, - SDLK_F11 = 292, - SDLK_F12 = 293, - SDLK_F13 = 294, - SDLK_F14 = 295, - SDLK_F15 = 296, - - /* Key state modifier keys */ - SDLK_NUMLOCK = 300, - SDLK_CAPSLOCK = 301, - SDLK_SCROLLOCK = 302, - SDLK_RSHIFT = 303, - SDLK_LSHIFT = 304, - SDLK_RCTRL = 305, - SDLK_LCTRL = 306, - SDLK_RALT = 307, - SDLK_LALT = 308, - SDLK_RMETA = 309, - SDLK_LMETA = 310, - SDLK_LSUPER = 311, /* Left "Windows" key */ - SDLK_RSUPER = 312, /* Right "Windows" key */ - SDLK_MODE = 313, /* "Alt Gr" key */ - SDLK_COMPOSE = 314, /* Multi-key compose key */ - - /* Miscellaneous function keys */ - SDLK_HELP = 315, - SDLK_PRINT = 316, - SDLK_SYSREQ = 317, - SDLK_BREAK = 318, - SDLK_MENU = 319, - SDLK_POWER = 320, /* Power Macintosh power key */ - SDLK_EURO = 321, /* Some european keyboards */ - SDLK_UNDO = 322, /* Atari keyboard has Undo */ - - /* Add any other keys here */ - - SDLK_LAST -} - -/* Enumeration of valid key mods (possibly OR'd together) */ -alias int SDLMod; -enum { - KMOD_NONE = 0x0000, - KMOD_LSHIFT= 0x0001, - KMOD_RSHIFT= 0x0002, - KMOD_LCTRL = 0x0040, - KMOD_RCTRL = 0x0080, - KMOD_LALT = 0x0100, - KMOD_RALT = 0x0200, - KMOD_LMETA = 0x0400, - KMOD_RMETA = 0x0800, - KMOD_NUM = 0x1000, - KMOD_CAPS = 0x2000, - KMOD_MODE = 0x4000, - KMOD_RESERVED = 0x8000 -} - -const uint KMOD_CTRL = (KMOD_LCTRL|KMOD_RCTRL); -const uint KMOD_SHIFT = (KMOD_LSHIFT|KMOD_RSHIFT); -const uint KMOD_ALT = (KMOD_LALT|KMOD_RALT); -const uint KMOD_META = (KMOD_LMETA|KMOD_RMETA); debian/titanion.desktop0000644000000000000000000000024012164042423012400 0ustar [Desktop Entry] Type=Application Name=Titanion GenericName= Comment=Kenta Cho's Titanion Icon=titanion Exec=titanion Terminal=false Categories=Game;ArcadeGame; debian/titanion.xpm0000644000000000000000000000762112164042423011545 0ustar /* XPM */ static char *dummy[]={ "32 32 110 2", "Qt c #000000", "#s c #010101", "#e c #040404", ".g c #050505", ".U c #060606", ".Z c #0a0a0a", "#t c #0b0b0b", ".i c #0d0d0d", ".W c #0e0e0e", "#K c #0f0f0f", "#w c #141414", ".a c #191919", "#p c #1f1f1f", "#L c #202020", "#N c #242424", "#m c #252525", "#h c #282828", ".F c #2b2b2b", "#M c #2e2e2e", ".q c #313131", ".z c #353535", ".L c #363636", "#J c #373737", "#k c #3c3c3c", ".C c #3d3d3d", ".w c #404040", ".G c #414141", ".h c #424242", ".0 c #434343", "#G c #444444", ".2 c #454545", ".f c #484848", ".T c #4b4b4b", ".# c #4f4f4f", ".j c #515151", ".p c #535353", ".s c #555555", ".v c #565656", "#a c #575757", "#B c #595959", "#b c #5b5b5b", "#n c #5c5c5c", "#c c #5f5f5f", "#z c #606060", ".8 c #616161", "#y c #626262", "#o c #656565", "#F c #666666", ".J c #696969", ".6 c #6c6c6c", ".k c #6e6e6e", "#I c #707070", ".H c #737373", ".4 c #757575", ".t c #797979", ".V c #7a7a7a", "#f c #7b7b7b", ".Q c #808080", ".B c #828282", ".N c #848484", ".b c #868686", "## c #8e8e8e", ".o c #929292", ".y c #999999", "#. c #9a9a9a", ".I c #9c9c9c", "#H c #9d9d9d", ".S c #9e9e9e", ".1 c #a0a0a0", ".r c #a4a4a4", "#R c #a8a8a8", ".l c #aaaaaa", ".K c #aeaeae", ".x c #afafaf", "#j c #b3b3b3", "#C c #b4b4b4", ".O c #b6b6b6", "#D c #b8b8b8", "#E c #b9b9b9", ".m c #bababa", ".n c #bbbbbb", ".c c #bcbcbc", ".d c #bebebe", "#q c #c3c3c3", "#O c #c5c5c5", ".X c #c8c8c8", ".7 c #c9c9c9", "#l c #cacaca", "#r c #d0d0d0", "#u c #d2d2d2", "#A c #d3d3d3", ".u c #d5d5d5", "#g c #d6d6d6", "#P c #dcdcdc", ".R c #dfdfdf", ".5 c #e7e7e7", ".P c #ebebeb", "#Q c #ededed", ".9 c #efefef", "#x c #f0f0f0", ".Y c #f1f1f1", "#v c #f4f4f4", "#i c #f5f5f5", ".A c #f6f6f6", ".D c #f8f8f8", ".3 c #f9f9f9", ".M c #fafafa", ".E c #fbfbfb", "#d c #fdfdfd", ".e c #ffffff", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQt.#.aQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQt.b.c.d.e.fQtQtQt.g.f.hQtQtQtQtQtQtQtQtQtQtQt", "QtQtQtQtQtQtQt.i.j.k.l.m.n.o.p.j.j.q.r.e.sQtQtQtQtQtQtQtQtQtQtQt", "QtQtQtQtQt.g.t.u.e.l.vQtQt.w.e.e.e.x.y.e.#QtQtQtQtQtQtQtQtQtQtQt", "QtQtQtQt.z.A.e.B.C.D.e.E.b.F.G.H.I.J.K.e.sQtQtQtQtQtQtQtQtQtQtQt", "QtQtQt.L.M.e.NQt.O.e.e.e.e.P.Q.R.SQt.T.j.aQtQtQtQtQtQtQtQtQtQtQt", "QtQtQt.U.b.VQt.W.X.e.e.e.e.e.Y.Z.t.0.1QtQtQtQtQtQtQtQtQtQtQtQtQt", "QtQtQtQtQt.C.2.X.e.e.e.e.e.e.3.UQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", "QtQtQt.4.4.5.6.7.e.e.e.e.e.e.3.UQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", "QtQt.8.6.9#.###a.e.e.e.e.e.e.3.UQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", "Qt.i#b.q.6#c#d#e#f.e.e.e.e.e.3.UQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", "Qt#g.e.A#h.0#i.UQt.N.e.e.e.e.3.UQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", "Qt#j.A.Y#k#l#mQtQtQt#f.e.e.e.3.UQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", "QtQt.0.y#n#o#pQtQtQtQt.N.M.e.e.UQtQt#q#r#r#r#r#r#r#r#r#r#r#r#qQt", "QtQtQt#s#tQtQtQtQtQtQtQt.Z#u#u#eQtQt#v.e.e.e.e.e.e.e.e.e.e.e#vQt", "QtQtQtQtQtQtQtQtQtQtQtQtQt#w#wQtQtQt#x.e.e.e.e.e.e.e.e.e.e.e#xQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#n#y#y#z.S.e.e.e#A#y.8#y#nQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#B.e.e.e#CQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#y.e.e.e#DQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#y.e.e.e#DQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#y.e.e.e#DQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#y.e.e.e#DQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#y.e.e.e#DQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#y.e.e.e#DQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#y.e.e.e#EQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#F.e.e.e.nQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#G#H#I#a#JQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#s#K#L#M#NQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt#G#O#P#Q#RQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt", "QtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQtQt"};