a7xpg/ 0000755 0000000 0000000 00000000000 10664106061 010602 5 ustar root root a7xpg/readme.txt 0000666 0000000 0000000 00000007446 07733320446 012627 0 ustar root root A7Xpg readme.txt
for Windows98/2000/XP(要OpenGL)
ver. 0.11
(C) Kenta Cho
追いかけアクション、A7Xpg。
○ インストール方法
a7xpg0_11.zipを適当なフォルダに展開してください。
その後、'a7xpg.exe'を実行してください。
(マシンの速度が遅い場合は、'a7xpg_lowres.bat'を実行してください。
A7Xpgを低解像度で立ち上げます。)
○ 遊び方
- 移動 矢印, テンキー / ジョイステック
- ブースト [Z][X][左Ctrl][左Alt] / トリガ 1-4
- ポーズ [P]
- 終了 [ESC]
自機を操作して、金塊を集めてください。
自機はブーストボタンを押している間加速します。
ブーストパワーは約1.5秒で尽きるため、速度を保つためには
再度ブーストボタンを押す必要があります。
右下のゲージはパワーゲージです。
パワーは金塊を高速で取得すると貯まります。
パワーゲージがフルになると、自機は一定時間無敵になります。
敵に体当たりして、ボーナス得点を狙ってください。
自機は敵に触れると破壊されます。
一定数の金塊を集めると、次のステージに進みます。
右上のタイマーがなくなった場合も、自機を失います。
自機がすべて破壊されると、ゲームオーバーです。
自機は20,000点および50,000点ごとに1機増えます。
ゲームオーバー時にスコアが100,000点を越えていれば、
コンティニューをすることができます。
以下のオプションが指定できます。
-brightness n 画面の明るさを指定します(n = 0 - 100, デフォルト100)
-luminous n 発光エフェクトの強さを指定します(n = 0 - 100, デフォルト50)
-nosound 音を出力しません。
-window ウィンドウモードで起動します。
-lowres 低解像度モードを利用します。
○ ご意見、ご感想
コメントなどは、cs8k-cyu@asahi-net.or.jp までお願いします。
○ ウェブページ
A7Xpg webpage:
http://www.asahi-net.or.jp/~cs8k-cyu/windows/a7xpg.html
○ 謝辞
A7XpgはD言語で書かれています。
D Programming Language
http://www.digitalmars.com/d/index.html
画面の出力にはSimple DirectMedia Layerを利用しています。
Simple DirectMedia Layer
http://www.libsdl.org/
BGMとSEの出力にSDL_mixerとOgg Vorbis CODECを利用しています。
SDL_mixer 1.2
http://www.libsdl.org/projects/SDL_mixer/
Vorbis.com
http://www.vorbis.com/
DedicateDのD言語用OpenGL, SDLヘッダファイルおよび
D - portingのSDL_mixerヘッダファイルを利用しています。
DedicateD
http://int19h.tamb.ru/files.html
D - porting
http://user.ecc.u-tokyo.ac.jp/~s31552/wp/d/porting.html
○ ヒストリ
2003 9/20 ver. 0.11
テキストコンソールが開くのを抑止。
luminousオプションの追加。
2003 9/20 ver. 0.1
初公開版。
○ ライセンス
A7XpgはBSDスタイルライセンスのもと配布されます。
License
-------
Copyright 2003 Kenta Cho. All rights reserved.
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.
a7xpg/lib/ 0000777 0000000 0000000 00000000000 10664106061 011354 5 ustar root root a7xpg/src/ 0000777 0000000 0000000 00000000000 07733320532 011401 5 ustar root root a7xpg/src/abagames/ 0000777 0000000 0000000 00000000000 07733320532 013141 5 ustar root root a7xpg/src/abagames/util/ 0000777 0000000 0000000 00000000000 07733320532 014116 5 ustar root root a7xpg/src/abagames/util/Rand.d 0000666 0000000 0000000 00000001124 07732713606 015154 0 ustar root root /*
* $Id: Rand.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.Rand;
import random;
import date;
/**
* Random number generator.
*/
public class Rand {
public this() {
d_time timer = getUTCtime();
rand_seed(timer, 0);
}
public int nextInt(int n) {
return random.rand() % n;
}
public int nextSignedInt(int n) {
return random.rand() % (n * 2) - n;
}
public float nextFloat(float n) {
return ((float)(random.rand() % (n * 10000))) / 10000;
}
}
a7xpg/src/abagames/util/PrefManager.d 0000666 0000000 0000000 00000000533 07732713606 016462 0 ustar root root /*
* $Id: PrefManager.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.PrefManager;
/**
* Save/load the game preference(ex) high-score).
*/
//public interface PrefManager {
public abstract class PrefManager {
public void save();
public void load();
}
a7xpg/src/abagames/util/Actor.d 0000666 0000000 0000000 00000000736 07732713606 015350 0 ustar root root /*
* $Id: Actor.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.Actor;
import abagames.util.ActorInitializer;
/**
* Actor in the game that has the interface to move and draw.
*/
public class Actor {
public:
bool isExist;
public abstract Actor newActor();
public abstract void init(ActorInitializer ini);
public abstract void move();
public abstract void draw();
}
a7xpg/src/abagames/util/ActorInitializer.d 0000666 0000000 0000000 00000000470 07732713606 017547 0 ustar root root /*
* $Id: ActorInitializer.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.ActorInitializer;
/**
* Pass initial parameters to the actor.
*/
//public interface ActorInitializer {
public abstract class ActorInitializer {
}
a7xpg/src/abagames/util/sdl/ 0000777 0000000 0000000 00000000000 07733320532 014700 5 ustar root root a7xpg/src/abagames/util/sdl/Input.d 0000666 0000000 0000000 00000004617 07732713606 016163 0 ustar root root /*
* $Id: Input.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.sdl.Input;
import string;
import SDL;
import abagames.util.sdl.SDLInitFailedException;
/**
* Joystick and keyboard input.
*/
public class Input {
public:
static const int PAD_UP = 1;
static const int PAD_DOWN = 2;
static const int PAD_LEFT = 4;
static const int PAD_RIGHT = 8;
static const int PAD_BUTTON1 = 16;
static const int PAD_BUTTON2 = 32;
Uint8 *keys;
bool buttonReversed = false;
private:
SDL_Joystick *stick = null;
const int JOYSTICK_AXIS = 16384;
public void openJoystick() {
if (SDL_InitSubSystem(SDL_INIT_JOYSTICK) < 0) {
throw new SDLInitFailedException(
"Unable to init SDL joystick: " ~ string.toString(SDL_GetError()));
}
stick = SDL_JoystickOpen(0);
}
public void handleEvent(SDL_Event *event) {
keys = SDL_GetKeyState(null);
}
// Joystick and keyboard handler.
public int getPadState() {
int x = 0, y = 0;
int pad = 0;
if (stick) {
x = SDL_JoystickGetAxis(stick, 0);
y = SDL_JoystickGetAxis(stick, 1);
}
if (keys[SDLK_RIGHT] == SDL_PRESSED || keys[SDLK_KP6] == SDL_PRESSED || x > JOYSTICK_AXIS) {
pad |= PAD_RIGHT;
}
if (keys[SDLK_LEFT] == SDL_PRESSED || keys[SDLK_KP4] == SDL_PRESSED || x < -JOYSTICK_AXIS) {
pad |= PAD_LEFT;
}
if (keys[SDLK_DOWN] == SDL_PRESSED || keys[SDLK_KP2] == SDL_PRESSED || y > JOYSTICK_AXIS) {
pad |= PAD_DOWN;
}
if (keys[SDLK_UP] == SDL_PRESSED || keys[SDLK_KP8] == SDL_PRESSED || y < -JOYSTICK_AXIS) {
pad |= PAD_UP;
}
return pad;
}
public int getButtonState() {
int btn = 0;
int btn1 = 0, btn2 = 0, btn3 = 0, btn4 = 0;
if (stick) {
btn1 = SDL_JoystickGetButton(stick, 0);
btn2 = SDL_JoystickGetButton(stick, 1);
btn3 = SDL_JoystickGetButton(stick, 2);
btn4 = SDL_JoystickGetButton(stick, 3);
}
if (keys[SDLK_z] == SDL_PRESSED || keys[SDLK_LCTRL] == SDL_PRESSED || btn1 || btn4) {
if (!buttonReversed)
btn |= PAD_BUTTON1;
else
btn |= PAD_BUTTON2;
}
if (keys[SDLK_x] == SDL_PRESSED || keys[SDLK_LALT] == SDL_PRESSED || btn2 || btn3) {
if (!buttonReversed)
btn |= PAD_BUTTON2;
else
btn |= PAD_BUTTON1;
}
return btn;
}
}
a7xpg/src/abagames/util/sdl/Screen.d 0000666 0000000 0000000 00000000560 07732713606 016274 0 ustar root root /*
* $Id: Screen.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.sdl.Screen;
/**
* SDL screen handler interface.
*/
//public interface Screen {
public abstract class Screen {
public void initSDL();
public void closeSDL();
public void flip();
public void clear();
}
a7xpg/src/abagames/util/sdl/SDLInitFailedException.d 0000666 0000000 0000000 00000000515 07732713606 021307 0 ustar root root /*
* $Id: SDLInitFailedException.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.sdl.SDLInitFailedException;
/**
* SDL initialize failed.
*/
public class SDLInitFailedException: Exception {
public this(char[] msg) {
super(msg);
}
}
a7xpg/src/abagames/util/sdl/Texture.d 0000666 0000000 0000000 00000002567 07732713606 016526 0 ustar root root /*
* $Id: Texture.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.sdl.Texture;
import string;
import opengl;
import SDL;
import abagames.util.sdl.SDLInitFailedException;
/**
* Manage OpenGL textures;
*/
public class Texture {
public:
static char[] imagesDir = "images/";
private:
GLuint num;
public this(char[] name) {
char[] fileName = imagesDir ~ name;
SDL_Surface *surface;
surface = SDL_LoadBMP(string.toStringz(fileName));
if (!surface) {
throw new SDLInitFailedException("Unable to load: " ~ fileName);
}
glGenTextures(1, &num);
glBindTexture(GL_TEXTURE_2D, num);
glTexImage2D(GL_TEXTURE_2D, 0, 3, surface.w, surface.h, 0,
GL_RGB, GL_UNSIGNED_BYTE, surface.pixels);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
/*gluBuild2DMipmaps(GL_TEXTURE_2D, 3, surface.w, surface.h,
GL_RGB, GL_UNSIGNED_BYTE, surface.pixels);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);*/
}
public void deleteTexture() {
glDeleteTextures(1, &num);
}
public void bind() {
glBindTexture(GL_TEXTURE_2D, num);
}
}
a7xpg/src/abagames/util/sdl/Screen3D.d 0000666 0000000 0000000 00000005076 07733320450 016462 0 ustar root root /*
* $Id: Screen3D.d,v 1.2 2003/09/21 04:01:27 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.sdl.Screen3D;
import string;
import c.stdlib;
import SDL;
import opengl;
import abagames.util.Logger;
import abagames.util.sdl.Screen;
import abagames.util.sdl.SDLInitFailedException;
/**
* SDL screen handler(3D, OpenGL).
*/
public class Screen3D: Screen {
public:
static int width = 640;
static int height = 480;
bool lowres = false;
bool windowMode = false;
float nearPlane = 0.1;
float farPlane = 1000;
private:
protected abstract void init();
protected abstract void close();
public void initSDL() {
if (lowres) {
width /= 2;
height /= 2;
}
// Initialize SDL.
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
throw new SDLInitFailedException(
"Unable to initialize SDL: " ~ string.toString(SDL_GetError()));
}
// Create an OpenGL screen.
Uint32 videoFlags;
if (windowMode) {
videoFlags = SDL_OPENGL | SDL_RESIZABLE;
} else {
videoFlags = SDL_OPENGL | SDL_FULLSCREEN;
}
if (SDL_SetVideoMode(width, height, 0, videoFlags) == null) {
throw new SDLInitFailedException
("Unable to create SDL screen: " ~ string.toString(SDL_GetError()));
}
glViewport(0, 0, width, height);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
resized(width, height);
SDL_ShowCursor(SDL_DISABLE);
init();
}
// Reset viewport when the screen is resized.
public void screenResized() {
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
//gluPerspective(45.0f, (GLfloat)width/(GLfloat)height, nearPlane, farPlane);
glFrustum(-nearPlane,
nearPlane,
-nearPlane * (GLfloat)height / (GLfloat)width,
nearPlane * (GLfloat)height / (GLfloat)width,
0.1f, farPlane);
glMatrixMode(GL_MODELVIEW);
}
public void resized(int width, int height) {
this.width = width; this.height = height;
screenResized();
}
public void closeSDL() {
close();
SDL_ShowCursor(SDL_ENABLE);
}
public void flip() {
handleError();
SDL_GL_SwapBuffers();
}
public void clear() {
glClear(GL_COLOR_BUFFER_BIT);
}
public void handleError() {
GLenum error = glGetError();
if (error == GL_NO_ERROR) return;
Logger.error("OpenGL error");
closeSDL();
exit(EXIT_FAILURE);
}
protected void setCaption(char[] name) {
SDL_WM_SetCaption(string.toStringz(name), null);
}
}
a7xpg/src/abagames/util/sdl/MainLoop.d 0000666 0000000 0000000 00000005114 07732713606 016573 0 ustar root root /*
* $Id: MainLoop.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.sdl.MainLoop;
import string;
import c.stdlib;
import SDL;
import abagames.util.Logger;
import abagames.util.Rand;
import abagames.util.GameManager;
import abagames.util.PrefManager;
import abagames.util.sdl.Screen;
import abagames.util.sdl.Input;
import abagames.util.sdl.Sound;
import abagames.util.sdl.SDLInitFailedException;
/**
* SDL main loop.
*/
public class MainLoop {
public:
const int INTERVAL_BASE = 16;
int interval = INTERVAL_BASE;
int accframe = 0;
int maxSkipFrame = 5;
SDL_Event event;
private:
Screen screen;
Input input;
GameManager gameManager;
PrefManager prefManager;
public this(Screen screen, Input input,
GameManager gameManager, PrefManager prefManager) {
this.screen = screen;
this.input = input;
gameManager.setMainLoop(this);
gameManager.setUIs(screen, input);
gameManager.setPrefManager(prefManager);
this.gameManager = gameManager;
this.prefManager = prefManager;
}
// Initialize and load preference.
private void initFirst() {
prefManager.load();
try {
Sound.init();
} catch (SDLInitFailedException e) {
Logger.error(e);
}
gameManager.init();
}
// Quit and save preference.
private void quitLast() {
gameManager.close();
Sound.close();
prefManager.save();
screen.closeSDL();
SDL_Quit();
}
public void loop() {
int done = 0;
long prvTickCount = 0;
int i;
long nowTick;
int frame;
try {
screen.initSDL();
} catch (SDLInitFailedException e) {
Logger.error(e);
exit(EXIT_FAILURE);
}
initFirst();
gameManager.start();
while (!done) {
SDL_PollEvent(&event);
input.handleEvent(&event);
if (input.keys[SDLK_ESCAPE] == SDL_PRESSED || event.type == SDL_QUIT)
done = 1;
nowTick = SDL_GetTicks();
frame = (int) (nowTick-prvTickCount) / interval;
if (frame <= 0) {
frame = 1;
SDL_Delay(prvTickCount+interval-nowTick);
if (accframe) {
prvTickCount = SDL_GetTicks();
} else {
prvTickCount += interval;
}
} else if (frame > maxSkipFrame) {
frame = maxSkipFrame;
prvTickCount = nowTick;
} else {
prvTickCount += frame * interval;
}
for (i = 0; i < frame; i++) {
gameManager.move();
}
screen.clear();
gameManager.draw();
screen.flip();
}
quitLast();
}
}
a7xpg/src/abagames/util/sdl/Sound.d 0000666 0000000 0000000 00000005664 07732713606 016157 0 ustar root root /*
* $Id: Sound.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.sdl.Sound;
import string;
import SDL;
import SDL_mixer;
import abagames.util.sdl.SDLInitFailedException;
/**
* BGM/SE.
*/
public class Sound {
public:
static bool noSound = false;
static int fadeOutSpeed = 1280;
static char[] soundsDir = "sounds/";
static char[] chunksDir = "sounds/";
public static void init() {
if (noSound) return;
int audio_rate;
Uint16 audio_format;
int audio_channels;
int audio_buffers;
if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) {
noSound = 1;
throw new SDLInitFailedException
("Unable to initialize SDL_AUDIO: " ~ string.toString(SDL_GetError()));
}
audio_rate = 44100;
audio_format = AUDIO_S16;
audio_channels = 1;
audio_buffers = 4096;
if (Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers) < 0) {
noSound = 1;
throw new SDLInitFailedException
("Couldn't open audio: " ~ string.toString(SDL_GetError()));
}
Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels);
}
public static void close() {
if (noSound) return;
if (Mix_PlayingMusic()) {
Mix_HaltMusic();
}
Mix_CloseAudio();
}
protected:
Mix_Music* music;
Mix_Chunk* chunk;
int chunkChannel;
private:
// Load a sound or a chunk.
public void loadSound(char[] name) {
if (noSound) return;
char[] fileName = soundsDir ~ name;
music = Mix_LoadMUS(string.toStringz(fileName));
if (!music) {
noSound = true;
throw new SDLInitFailedException("Couldn't load: " ~ fileName ~
" (" ~ string.toString(Mix_GetError()) ~ ")");
}
}
public void loadChunk(char[] name, int ch) {
if (noSound) return;
char[] fileName = chunksDir ~ name;
chunk = Mix_LoadWAV(string.toStringz(fileName));
if (!chunk) {
noSound = true;
throw new SDLInitFailedException("Couldn't load: " ~ fileName ~
" (" ~ string.toString(Mix_GetError()) ~ ")");
}
chunkChannel = ch;
}
// Free a music or a chunk.
public void free() {
if (music) {
stopMusic();
Mix_FreeMusic(music);
}
if (chunk) {
haltChunk();
Mix_FreeChunk(chunk);
}
}
// Play/Stop the music/chunk.
public void playMusic() {
if (noSound) return;
Mix_PlayMusic(music, -1);
}
public static void fadeMusic() {
if (noSound) return;
Mix_FadeOutMusic(fadeOutSpeed);
}
public static void stopMusic() {
if (noSound) return;
if ( Mix_PlayingMusic() ) {
Mix_HaltMusic();
}
}
public void playChunk() {
if (noSound) return;
Mix_PlayChannel(chunkChannel, chunk, 0);
}
public void haltChunk() {
if (noSound) return;
Mix_HaltChannel(chunkChannel);
}
}
a7xpg/src/abagames/util/ActorPool.d 0000666 0000000 0000000 00000002517 07732713606 016201 0 ustar root root /*
* $Id: ActorPool.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.ActorPool;
import abagames.util.Actor;
/**
* Object pooling for actors.
*/
public class ActorPool {
public:
Actor[] actor;
protected:
int actorIdx;
public this(int n, Actor act, ActorInitializer ini) {
actor = new Actor[n];
for (int i = 0; i < actor.length; i++) {
actor[i] = act.newActor();
actor[i].isExist = false;
actor[i].init(ini);
}
actorIdx = n;
}
public Actor getInstance() {
for (int i = 0; i < actor.length; i++) {
actorIdx--;
if (actorIdx < 0)
actorIdx = actor.length - 1;
if (!actor[actorIdx].isExist)
return actor[actorIdx];
}
return null;
}
public Actor getInstanceForced() {
actorIdx--;
if (actorIdx < 0)
actorIdx = actor.length - 1;
return actor[actorIdx];
}
public void move() {
for (int i = 0; i < actor.length; i++) {
if (actor[i].isExist)
actor[i].move();
}
}
public void draw() {
for (int i = 0; i < actor.length; i++) {
if (actor[i].isExist)
actor[i].draw();
}
}
public void clear() {
for (int i = 0; i < actor.length; i++) {
actor[i].isExist = false;
}
}
}
a7xpg/src/abagames/util/Vector.d 0000666 0000000 0000000 00000003202 07732713606 015531 0 ustar root root /*
* $Id: Vector.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.Vector;
import math;
/**
* Vector.
*/
public class Vector {
public:
float x, y;
private:
public this() {}
public this(float x, float y) {
this.x = x; this.y = y;
}
public float innerProduct(Vector v) {
return x * v.x + y * v.y;
}
public Vector getElement(Vector v) {
Vector rsl;
float ll = v.x * v.x + v.y * v.y;
if (ll != 0) {
float mag = innerProduct(v);
rsl.x = mag * v.x / ll;
rsl.y = mag * v.y / ll;
} else {
rsl.x = rsl.y = 0;
}
return rsl;
}
public void add(Vector v) {
x += v.x;
y += v.y;
}
public void sub(Vector v) {
x -= v.x;
y -= v.y;
}
public void mul(float a) {
x *= a;
y *= a;
}
public void div(float a) {
x /= a;
y /= a;
}
public int checkSide(Vector pos1, Vector pos2) {
int xo = pos2.x - pos1.x;
int yo = pos2.y - pos1.y;
if (xo == 0) {
if (yo == 0)
return 0;
return x - pos1.x;
} else if (yo == 0) {
return pos1.y - y;
} else {
if (xo * yo > 0) {
return (x - pos1.x) / xo - (y - pos1.y) / yo;
} else {
return -(x - pos1.x) / xo + (y - pos1.y) / yo;
}
}
}
public float size() {
return sqrt(x * x + y * y);
}
public float dist(Vector v) {
float ax = fabs(x - v.x);
float ay = fabs(y - v.y);
if ( ax > ay ) {
return ax + ay / 2;
} else {
return ay + ax / 2;
}
}
}
a7xpg/src/abagames/util/GameManager.d 0000666 0000000 0000000 00000001736 07732713606 016445 0 ustar root root /*
* $Id: GameManager.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.GameManager;
import abagames.util.PrefManager;
import abagames.util.sdl.MainLoop;
import abagames.util.sdl.Screen;
import abagames.util.sdl.Input;
/**
* Manage the lifecycle of the game.
*/
public class GameManager {
public:
int status;
protected:
MainLoop mainLoop;
Screen abstScreen;
Input input;
PrefManager abstPrefManager;
private:
public void setMainLoop(MainLoop mainLoop) {
this.mainLoop = mainLoop;
}
public void setUIs(Screen screen, Input input) {
abstScreen = screen;
this.input = input;
}
public void setPrefManager(PrefManager prefManager) {
abstPrefManager = prefManager;
}
public abstract void init();
public abstract void start();
public abstract void close();
public abstract void move();
public abstract void draw();
}
a7xpg/src/abagames/util/Logger.d 0000666 0000000 0000000 00000001457 07733050106 015506 0 ustar root root /*
* $Id: Logger.d,v 1.2 2003/09/20 04:04:06 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.util.Logger;
import stream;
/**
* Logger(error/info).
*/
public class Logger {
public static void info(char[] msg) {
stderr.writeLine("Info: " ~ msg);
}
public static void error(char[] msg) {
//stderr.writeLine("Error: " ~ msg);
throw new Exception("Error: " ~ msg ~ "\0");
}
public static void error(Exception e) {
//stderr.writeLine("Error: " ~ e.toString());
throw new Exception("Error: " ~ e.toString() ~ "\0");
}
public static void error(Error e) {
//stderr.writeLine("Error: " ~ e.toString());
//if (e.next)
// error(e.next);
throw new Exception("Error: " ~ e.toString() ~ "\0");
}
}
a7xpg/src/abagames/a7xpg/ 0000777 0000000 0000000 00000000000 07733320532 014167 5 ustar root root a7xpg/src/abagames/a7xpg/Gold.d 0000666 0000000 0000000 00000007032 07733320450 015222 0 ustar root root /*
* $Id: Gold.d,v 1.2 2003/09/21 04:01:27 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.Gold;
import math;
import opengl;
import abagames.util.Vector;
import abagames.util.Rand;
import abagames.util.ActorInitializer;
import abagames.a7xpg.LuminousActor;
import abagames.a7xpg.Ship;
import abagames.a7xpg.Field;
import abagames.a7xpg.A7xGameManager;
import abagames.a7xpg.A7xScreen;
/**
* Gold items.
*/
public class Gold: LuminousActor {
public:
static const float SIZE = 1;
static int displayListIdx;
private:
Ship ship;
Field field;
Rand rand;
A7xGameManager manager;
Vector pos;
int cnt;
static const float ROLL_DEG = 1.0;
public override Actor newActor() {
return new Gold;
}
public override void init(ActorInitializer ini) {
GoldInitializer gi = (GoldInitializer) ini;
ship = gi.ship;
field = gi.field;
rand = gi.rand;
manager = gi.manager;
pos = new Vector;
}
public void set() {
for (int i = 0; i < 8 ; i++) {
pos.x = rand.nextFloat((field.size.x - SIZE) * 2) - field.size.x + SIZE;
pos.y = rand.nextFloat((field.size.y - SIZE) * 2) - field.size.y + SIZE;
if (pos.dist(ship.pos) > 8)
break;
if (i == 7) {
pos.x = 0;
pos.y = -field.size.y / 2;
}
}
cnt = 0;
isExist = true;
}
public override void move() {
cnt++;
if (ship.checkHit(pos.x, pos.y - SIZE, pos.x, pos.y + SIZE) ||
ship.checkHit(pos.x - SIZE, pos.y, pos.x + SIZE, pos.y)) {
isExist = false;
for (int i = 0; i < 16; i++) {
manager.addParticle(pos, rand.nextFloat(math.PI * 2), 0.5, 0,5, 0.8, 0);
}
manager.getGold();
}
}
public override void draw() {
glPushMatrix();
glTranslatef(pos.x, pos.y, 0.5);
glRotatef(ROLL_DEG * cnt, 0, 0, 1);
glCallList(displayListIdx);
glCallList(displayListIdx + 1);
glTranslatef(0, 0, -0.5);
glScalef(1, 1, -1);
glCallList(displayListIdx);
glPopMatrix();
}
public override void drawLuminous() {
glPushMatrix();
glTranslatef(pos.x, pos.y, 0.5);
glRotatef(ROLL_DEG * cnt, 0, 0, 1);
glCallList(displayListIdx + 1);
glPopMatrix();
}
// Create display lists.
public static void createDisplayLists() {
displayListIdx = glGenLists(2);
glNewList(displayListIdx, GL_COMPILE);
drawGold(1);
glEndList();
glNewList(displayListIdx + 1, GL_COMPILE);
drawGoldLine(1);
glEndList();
}
public static void deleteDisplayLists() {
glDeleteLists(displayListIdx, 2);
}
private static void drawGold(float alpha) {
glBegin(GL_TRIANGLE_FAN);
A7xScreen.setColor(1, 1, 0.3, 0.9 * alpha);
glVertex3f(0, 0, 1);
A7xScreen.setColor(0.2, 0.5, 0.4, 0.8 * alpha);
glVertex3f(1, 0, 0);
glVertex3f(0, 1, 0);
glVertex3f(-1, 0, 0);
glVertex3f(0, -1, 0);
glEnd();
}
private static void drawGoldLine(float alpha) {
glBegin(GL_LINE_STRIP);
A7xScreen.setColor(1, 1, 0.3, 0.9 * alpha);
glVertex3f(1, 0, 0);
glVertex3f(0, 1, 0);
glVertex3f(-1, 0, 0);
glVertex3f(0, -1, 0);
glVertex3f(1, 0, 0);
glEnd();
}
}
public class GoldInitializer: ActorInitializer {
public:
Ship ship;
Field field;
Rand rand;
A7xGameManager manager;
public this(Ship ship, Field field, Rand rand, A7xGameManager manager) {
this.ship = ship;
this.field = field;
this.rand = rand;
this.manager = manager;
}
}
a7xpg/src/abagames/a7xpg/A7xPrefManager.d 0000666 0000000 0000000 00000001661 07732713606 017116 0 ustar root root /*
* $Id: A7xPrefManager.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.A7xPrefManager;
import stream;
import abagames.util.PrefManager;
/**
* Save/Load a high score.
*/
public class A7xPrefManager: PrefManager {
public:
static const int VERSION_NUM = 10;
static const char[] PREF_FILE = "a7xpg.prf";
int hiScore;
private void init() {
hiScore = 0;
}
public void load() {
auto File fd = new File;
try {
int ver;
fd.open(PREF_FILE);
fd.read(ver);
if (ver != VERSION_NUM)
throw new Error("Wrong version num");
fd.read(hiScore);
} catch (Error e) {
init();
} finally {
fd.close();
}
}
public void save() {
auto File fd = new File;
fd.create(PREF_FILE);
fd.write(VERSION_NUM);
fd.write(hiScore);
fd.close();
}
}
a7xpg/src/abagames/a7xpg/LuminousActorPool.d 0000666 0000000 0000000 00000001236 07732713606 020003 0 ustar root root /*
* $Id: LuminousActorPool.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.LuminousActorPool;
import abagames.util.Actor;
import abagames.util.ActorPool;
import abagames.util.ActorInitializer;
import abagames.a7xpg.LuminousActor;
/**
* Actor pool for the LuminousActor.
*/
public class LuminousActorPool: ActorPool {
public this(int n, Actor act, ActorInitializer ini) {
super(n, act, ini);
}
public void drawLuminous() {
for (int i = 0; i < actor.length; i++) {
if (actor[i].isExist)
((LuminousActor) actor[i]).drawLuminous();
}
}
}
a7xpg/src/abagames/a7xpg/Particle.d 0000666 0000000 0000000 00000005065 07733320450 016104 0 ustar root root /*
* $Id: Particle.d,v 1.2 2003/09/21 04:01:27 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.Particle;
import math;
import opengl;
import abagames.util.Vector;
import abagames.util.Rand;
import abagames.util.ActorInitializer;
import abagames.a7xpg.LuminousActor;
import abagames.a7xpg.Field;
import abagames.a7xpg.A7xScreen;
/**
* Particles.
*/
public class Particle: LuminousActor {
private:
static const float GRAVITY = 0.2;
Field field;
Rand rand;
Vector pos, ppos;
Vector vel;
float z, mz, pz;
float r, g, b;
float lumAlp;
int cnt;
public override Actor newActor() {
return new Particle;
}
public override void init(ActorInitializer ini) {
ParticleInitializer pi = (ParticleInitializer) ini;
field = pi.field;
rand = pi.rand;
pos = new Vector;
ppos = new Vector;
vel = new Vector;
}
public void set(Vector p, float d, float ofs, float speed, float r, float g, float b) {
pos.x = p.x + sin(d) * ofs;
pos.y = p.y + cos(d) * ofs;
z = 0.5;
float sb = rand.nextFloat(0.5) + 0.75;
vel.x = sin(d) * speed * sb;
vel.y = cos(d) * speed * sb;
mz = rand.nextFloat(1);
this.r = r; this.g = g; this.b = b;
cnt = 12 + rand.nextInt(48);
lumAlp = 0.8 + rand.nextFloat(0.2);
isExist = true;
}
public override void move() {
cnt--;
if (cnt < 0) {
isExist = false;
return;
}
ppos.x = pos.x; ppos.y = pos.y; pz = z;
pos.add(vel);
vel.mul(0.98);
if (pos.x < -field.size.x || pos.x > field.size.x) {
vel.x *= -0.9;
pos.x += vel.x * 2;
}
if (pos.y < -field.size.y || pos.y > field.size.y) {
vel.y *= -0.9;
pos.y += vel.y * 2;
}
z += mz;
mz -= GRAVITY;
if (z < 0) {
mz *= -0.5;
vel.mul(0.8);
z += mz * 2;
}
lumAlp *= 0.98;
}
public override void draw() {
A7xScreen.setColor(r, g, b, 1);
glVertex3f(ppos.x, ppos.y, pz);
glVertex3f(pos.x, pos.y, z);
A7xScreen.setColor(r, g, b, 0.7);
glVertex3f(ppos.x, ppos.y, -pz);
glVertex3f(pos.x, pos.y, -z);
}
public override void drawLuminous() {
if (lumAlp < 0.2) return;
A7xScreen.setColor(r, g, b, lumAlp);
glVertex3f(ppos.x, ppos.y, pz);
glVertex3f(pos.x, pos.y, z);
}
}
public class ParticleInitializer: ActorInitializer {
public:
Field field;
Rand rand;
public this(Field field, Rand rand) {
this.field = field;
this.rand = rand;
}
}
a7xpg/src/abagames/a7xpg/A7xScreen.d 0000666 0000000 0000000 00000010354 07733320450 016135 0 ustar root root /*
* $Id: A7xScreen.d,v 1.3 2003/09/21 04:01:27 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.A7xScreen;
import opengl;
import abagames.util.sdl.Screen3D;
/**
* Initialize an OpenGL and set the caption.
*/
public class A7xScreen: Screen3D {
public:
static const char[] CAPTION = "A7Xpg";
static float brightness = 1;
static float luminous = 0.5;
protected override void init() {
setCaption(CAPTION);
glLineWidth(1);
glEnable(GL_LINE_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glEnable(GL_BLEND);
glDisable(GL_LIGHTING);
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
glDisable(GL_COLOR_MATERIAL);
}
protected override void close() {
glDeleteTextures(1, &luminousTexture);
}
// Draw the luminous effect texture.
private:
GLuint luminousTexture;
const int LUMINOUS_TEXTURE_WIDTH_MAX = 128;
const int LUMINOUS_TEXTURE_HEIGHT_MAX = 128;
GLuint td[LUMINOUS_TEXTURE_WIDTH_MAX * LUMINOUS_TEXTURE_HEIGHT_MAX * 4 * uint.size];
int luminousTextureWidth = 128, luminousTextureHeight = 128;
public void makeLuminousTexture() {
uint *data = td;
int i;
memset(data, 0, luminousTextureWidth * luminousTextureHeight * 4 * uint.size);
glGenTextures(1, &luminousTexture);
glBindTexture(GL_TEXTURE_2D, luminousTexture);
glTexImage2D(GL_TEXTURE_2D, 0, 4, luminousTextureWidth, luminousTextureHeight, 0,
GL_RGBA, GL_UNSIGNED_BYTE, data);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
public void startRenderToTexture() {
glViewport(0, 0, luminousTextureWidth, luminousTextureHeight);
}
public void endRenderToTexture() {
glBindTexture(GL_TEXTURE_2D, luminousTexture);
glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
0, 0, luminousTextureWidth, luminousTextureHeight, 0);
glViewport(0, 0, width, height);
}
public void viewOrtho() {
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, width, height, 0, -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
}
public void viewOrthoFixed() {
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho(0, 640, 480, 0, -1, 1);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
}
public void viewPerspective() {
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glPopMatrix();
}
private int lmOfs[5][2] = [[0, 0], [1, 0], [-1, 0], [0, 1], [0, -1]];
private const float lmOfsBs = 5;
public void drawLuminous() {
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, luminousTexture);
viewOrtho();
glColor4f(1, 0.8, 0.9, luminous);
glBegin(GL_QUADS);
for (int i = 0; i < 5; i++) {
glTexCoord2f(0, 1);
glVertex2f(0 + lmOfs[i][0] * lmOfsBs, 0 + lmOfs[i][1] * lmOfsBs);
glTexCoord2f(0, 0);
glVertex2f(0 + lmOfs[i][0] * lmOfsBs, height + lmOfs[i][1] * lmOfsBs);
glTexCoord2f(1, 0);
glVertex2f(width + lmOfs[i][0] * lmOfsBs, height + lmOfs[i][0] * lmOfsBs);
glTexCoord2f(1, 1);
glVertex2f(width + lmOfs[i][0] * lmOfsBs, 0 + lmOfs[i][0] * lmOfsBs);
}
glEnd();
viewPerspective();
glDisable(GL_TEXTURE_2D);
}
public static void drawBoxSolid(float x, float y, float width, float height) {
glPushMatrix();
glTranslatef(x, y, 0);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(0, 0, 0);
glVertex3f(width, 0, 0);
glVertex3f(width, height, 0);
glVertex3f(0, height, 0);
glEnd();
glPopMatrix();
}
public static void drawBoxLine(float x, float y, float width, float height) {
glPushMatrix();
glTranslatef(x, y, 0);
glBegin(GL_LINE_LOOP);
glVertex3f(0, 0, 0);
glVertex3f(width, 0, 0);
glVertex3f(width, height, 0);
glVertex3f(0, height, 0);
glEnd();
glPopMatrix();
}
public static void setColor(float r, float g, float b, float a) {
glColor4f(r * brightness, g * brightness, b * brightness, a);
}
}
a7xpg/src/abagames/a7xpg/A7xBoot.d 0000666 0000000 0000000 00000005255 07733320446 015632 0 ustar root root /*
* $Id: A7xBoot.d,v 1.3 2003/09/21 04:01:26 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.A7xBoot;
import string;
import abagames.a7xpg.A7xScreen;
import abagames.a7xpg.A7xGameManager;
import abagames.a7xpg.A7xPrefManager;
import abagames.util.Logger;
import abagames.util.sdl.Input;
import abagames.util.sdl.MainLoop;
/**
* Boot A7Xpg.
*/
private:
A7xScreen screen;
Input input;
A7xGameManager gameManager;
A7xPrefManager prefManager;
MainLoop mainLoop;
private void usage() {
Logger.error
("Usage: a7xpg [-brightness [0-100]] [-luminous [0-100]] [-nosound] [-window] [-lowres]");
}
private void parseArgs(char[][] args) {
//for (int i = 1; i < argv.length; i++) {
for (int i = 0; i < args.length; i++) {
switch (args[i]) {
case "-brightness":
if (i >= args.length - 1) {
usage();
exit(EXIT_FAILURE);
}
i++;
float b = (float) atoi(args[i]) / 100;
if (b < 0 || b > 1) {
usage();
exit(EXIT_FAILURE);
}
A7xScreen.brightness = b;
break;
case "-luminous":
if (i >= args.length - 1) {
usage();
exit(EXIT_FAILURE);
}
i++;
float l = (float) atoi(args[i]) / 100;
if (l < 0 || l > 1) {
usage();
exit(EXIT_FAILURE);
}
A7xScreen.luminous = l;
break;
case "-nosound":
Sound.noSound = true;
break;
case "-window":
screen.windowMode = true;
break;
case "-accframe":
mainLoop.accframe = 1;
break;
case "-lowres":
screen.lowres = true;
break;
default:
usage();
exit(EXIT_FAILURE);
}
}
}
//public int main(char[][] argc) {
private int boot(char[] argl) {
char[][] args = split(argl);
screen = new A7xScreen;
input = new Input;
try {
input.openJoystick();
} catch (Exception e) {}
gameManager = new A7xGameManager;
prefManager = new A7xPrefManager;
mainLoop = new MainLoop(screen, input, gameManager, prefManager);
parseArgs(args);
mainLoop.loop();
return EXIT_SUCCESS;
}
// Boot as the windows executable.
import windows;
extern (C) void gc_init();
extern (C) void gc_term();
extern (C) void _minit();
extern (C) void _moduleCtor();
extern (Windows)
int WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow) {
int result;
gc_init();
_minit();
try {
_moduleCtor();
result = boot(string.toString(lpCmdLine));
} catch (Object o) {
MessageBoxA(null, (char *)o.toString(), "Error",
MB_OK | MB_ICONEXCLAMATION);
result = 0;
}
gc_term();
return result;
}
a7xpg/src/abagames/a7xpg/LuminousActor.d 0000666 0000000 0000000 00000000510 07732713606 017143 0 ustar root root /*
* $Id: LuminousActor.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.LuminousActor;
import abagames.util.Actor;
/**
* Actor with the luminous effect.
*/
public class LuminousActor: Actor {
public abstract void drawLuminous();
}
a7xpg/src/abagames/a7xpg/Field.d 0000666 0000000 0000000 00000005600 07733320450 015357 0 ustar root root /*
* $Id: Field.d,v 1.2 2003/09/21 04:01:27 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.Field;
import opengl;
import abagames.util.Vector;
import abagames.a7xpg.A7xScreen;
/**
* Stage field.
*/
public class Field {
public:
Vector size;
float eyeZ;
float eyeZa;
float alpha;
private:
const float HEIGHT = 1;
const float HEIGHT_OFFSET = 8;
float z;
float r, g, b;
float lr, lg, lb;
public void init() {
size = new Vector;
eyeZ = 0;
alpha = 1;
}
private const float[][] COLOR =
[[0.4, 0.8, 1], [0.4, 1, 0.8], [1, 0.8, 0.4]];
private const float[][] LUMINOUS_COLOR =
[[0.2, 0.2, 1], [0.2, 0.6, 0.7], [0.6, 0.2, 0.7]];
public void start(int colorType) {
if (size.x > size.y)
eyeZa = size.x * 1.3;
else
eyeZa = size.y * 1.3 / 480 * 640;
z = 0;
r = COLOR[colorType % 3][0];
g = COLOR[colorType % 3][1];
b = COLOR[colorType % 3][2];
lr = LUMINOUS_COLOR[colorType % 3][0];
lg = LUMINOUS_COLOR[colorType % 3][1];
lb = LUMINOUS_COLOR[colorType % 3][2];
}
public void addSpeed(float s) {
z -= s;
if (z < 0)
z += HEIGHT_OFFSET;
}
public void move() {
eyeZ += (eyeZa - eyeZ) * 0.06;
}
public void draw() {
glBegin(GL_TRIANGLE_STRIP);
A7xScreen.setColor(r, g, b, 0.4);
glVertex3f(-size.x, -size.y, 0);
A7xScreen.setColor(r, g, b, 0.8);
glVertex3f(-size.x, -size.y, HEIGHT);
A7xScreen.setColor(r, g, b, 0.4);
glVertex3f(size.x, -size.y, 0);
A7xScreen.setColor(r, g, b, 0.8);
glVertex3f(size.x, -size.y, HEIGHT);
A7xScreen.setColor(r, g, b, 0.4);
glVertex3f(size.x, size.y, 0);
A7xScreen.setColor(r, g, b, 0.8);
glVertex3f(size.x, size.y, HEIGHT);
A7xScreen.setColor(r, g, b, 0.4);
glVertex3f(-size.x, size.y, 0);
A7xScreen.setColor(r, g, b, 0.8);
glVertex3f(-size.x, size.y, HEIGHT);
A7xScreen.setColor(r, g, b, 0.4);
glVertex3f(-size.x, -size.y, 0);
A7xScreen.setColor(r, g, b, 0.8);
glVertex3f(-size.x, -size.y, HEIGHT);
glEnd();
}
public void drawLuminous() {
A7xScreen.setColor(lr, lg, lb, 0.9 * alpha);
glBegin(GL_LINE_STRIP);
glVertex3f(-size.x, -size.y, HEIGHT);
glVertex3f(size.x, -size.y, HEIGHT);
glVertex3f(size.x, size.y, HEIGHT);
glVertex3f(-size.x, size.y, HEIGHT);
glVertex3f(-size.x, -size.y, HEIGHT);
glEnd();
float hz = HEIGHT_OFFSET - z;
for (int i = 0; i < 8; i++) {
A7xScreen.setColor(lr, lg, lb, (0.8 - i * 0.05) * alpha);
glBegin(GL_LINE_STRIP);
glVertex3f(-size.x, -size.y, hz);
glVertex3f(size.x, -size.y, hz);
glVertex3f(size.x, size.y, hz);
glVertex3f(-size.x, size.y, hz);
glVertex3f(-size.x, -size.y, hz);
glEnd();
hz -= HEIGHT_OFFSET;
}
}
}
a7xpg/src/abagames/a7xpg/A7xGameManager.d 0000666 0000000 0000000 00000046466 07732722654 017112 0 ustar root root /*
* $Id: A7xGameManager.d,v 1.2 2003/09/19 15:56:11 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.A7xGameManager;
import math;
import opengl;
import SDL;
import abagames.util.Rand;
import abagames.util.GameManager;
import abagames.util.ActorPool;
import abagames.util.sdl.Screen3D;
import abagames.util.sdl.Texture;
import abagames.util.sdl.Input;
import abagames.util.sdl.Sound;
import abagames.a7xpg.LuminousActorPool;
import abagames.a7xpg.A7xPrefManager;
import abagames.a7xpg.A7xScreen;
import abagames.a7xpg.Ship;
import abagames.a7xpg.Field;
import abagames.a7xpg.Gold;
import abagames.a7xpg.Enemy;
import abagames.a7xpg.Particle;
import abagames.a7xpg.Bonus;
import abagames.a7xpg.LetterRender;
/**
* Manage the game status and actor pools.
*/
public class A7xGameManager: GameManager {
public:
private:
const int ENEMY_MAX = 32;
A7xPrefManager prefManager;
A7xScreen screen;
Rand rand;
Field field;
Ship ship;
LuminousActorPool golds;
LuminousActorPool enemies;
LuminousActorPool particles;
ActorPool bonuses;
const int FIRST_EXTEND = 20000;
const int EVERY_EXTEND = 50000;
const int LEFT_MAX = 9;
int stage, lap;
int left;
int score, extendScore;
int leftGold, appGold;
int enemyAppInterval;
int enemyTimer;
int stageTimer;
enum {
TITLE, IN_GAME, STAGE_CLEAR, GAMEOVER, PAUSE
};
int state;
int cnt;
int timeBonus;
const int CONTINUE_ENABLE_SCORE = 100000;
bool continueEnable;
int contCy;
int pauseCnt;
Sound[3] bgm;
Sound[12] se;
Texture titleTexture;
const int STAGE_NUM = 30;
float[][STAGE_NUM] stgData =
[
// width, height, time, #gold, #gold on field, interval enemy appearing, [enemy data]
// [enemy data] = #, type, size, speed
[24, 18, 40, 10, 1, 300, 4, 0, 1, 0.2],
[21, 21, 30, 12, 2, 280, 4, 1, 1, 0.25],
[25, 20, 35, 15, 2, 320, 5, 2, 1, 0.3],
[20, 22, 30, 12, 1, 300, 1, 1, 1, 0.2, 2, 0, 1, 0.25, 3, 1, 1, 0.3],
[24, 18, 45, 20, 2, 150, 1, 3, 2.5, 0.2, 5, 2, 1, 0.35],
[24, 18, 30, 10, 1, 200, 2, 0, 1, 0.4, 2, 1, 1, 0.3, 2, 2, 1, 0.3],
[25, 16, 40, 18, 3, 250, 6, 4, 5, 0.3],
[30, 12, 35, 12, 1, 50, 4, 1, 1.5, 0.28],
[18, 20, 45, 18, 2, 200, 3, 3, 1, 0.5, 1, 0, 1.5, 0.4, 3, 3, 1, 0.2],
[30, 28, 50, 22, 2, 100, 1, 4, 12, 0.2, 2, 0, 1.5, 0.2, 3, 1, 1.5, 0.3, 2, 3, 1.5, 0.4],
[24, 18, 40, 16, 2, 30, 6, 1, 1, 0.32],
[13, 13, 30, 12, 1, 100, 1, 0, 1, 0.3, 1, 1, 1, 0.3, 1, 2, 1, 0.3, 1, 3, 1, 0.3],
[25, 16, 45, 18, 2, 200, 2, 1, 3, 0.2, 2, 0, 3, 0.3],
[8, 22, 30, 15, 3, 180, 1, 4, 8, 0.2, 3, 2, 0.8, 0.3],
[22, 20, 60, 25, 2, 100, 1, 5, 2, 0.15, 2, 4, 5, 0.2, 4, 0, 1, 0.4],
[24, 18, 50, 22, 3, 150, 3, 0, 1, 0.35, 3, 4, 5, 0.4, 3, 0, 1, 0.35],
[16, 26, 40, 15, 2, 100, 7, 2, 1, 0.5],
[15, 15, 45, 20, 2, 160, 1, 4, 15, 0.1, 3, 5, 1, 0.2],
[28, 22, 20, 20, 10, 10, 1, 1, 0.5, 0.5, 4, 4, 10, 0.1],
[26, 26, 60, 25, 2, 100, 3, 0, 4, 0.15, 3, 3, 1, 0.4, 3, 4, 1.5, 0.6],
[24, 18, 45, 15, 2, 120, 2, 5, 1, 0.4, 3, 0, 1, 0.3, 3, 2, 1.5, 0.4],
[12, 12, 30, 10, 1, 50, 4, 0, 1, 0.27],
[20, 25, 50, 25, 4, 100, 8, 5, 0.6, 0.37],
[27, 18, 55, 20, 2, 150, 3, 4, 6, 0.5, 4, 3, 1, 0.5, 1, 1, 1, 0.5],
[20, 20, 60, 25, 3, 120, 1, 3, 7, 0.3, 2, 2, 1, 0.4, 3, 1, 1, 0.3, 4, 0, 1, 0.35],
[24, 18, 50, 20, 2, 75, 1, 0, 1, 0.4, 1, 0, 1.25, 0.35, 1, 0, 1.5, 0.3, 1, 0, 1.75, 0.25,
1, 0, 2, 0.2, 1, 0, 2.25, 0.15, 1, 0, 2.5, 0.1],
[29, 25, 60, 25, 3, 100, 1, 4, 15, 0.25, 1, 4, 10, 0.3,
1, 3, 2, 0.35, 1, 5, 1.5, 0.35, 1, 1, 2, 0.35, 4, 0, 1, 0.3],
[20, 24, 40, 15, 1, 120, 7, 4, 2, 0.6],
[22, 22, 60, 30, 5, 100, 4, 4, 8, 0.3, 4, 3, 2, 0.4],
[24, 18, 40, 10, 1, 20, 4, 0, 1, 0.2, 3, 1, 1, 0.25, 2, 2, 1, 0.3, 1, 3, 1, 0.3,
1, 4, 3, 0.3, 1, 5, 1, 0.2],
];
float[3][ENEMY_MAX] enemyTable;
int enemyTableIdx, enemyNum;
public override void init() {
prefManager = (A7xPrefManager) abstPrefManager;
screen = (A7xScreen) abstScreen;
screen.makeLuminousTexture();
rand = new Rand;
field = new Field;
field.init();
Ship.createDisplayLists();
ship = new Ship;
ship.init(input, field, this);
Gold.createDisplayLists();
auto Gold goldClass = new Gold;
auto GoldInitializer gi = new GoldInitializer(ship, field, rand, this);
golds = new LuminousActorPool(16, goldClass, gi);
Enemy.createDisplayLists();
auto Enemy enemyClass = new Enemy;
auto EnemyInitializer ei = new EnemyInitializer(ship, field, rand, this);
enemies = new LuminousActorPool(ENEMY_MAX, enemyClass, ei);
auto Particle particleClass = new Particle;
auto ParticleInitializer pi = new ParticleInitializer(field, rand);
particles = new LuminousActorPool(256, particleClass, pi);
auto Bonus bonusClass = new Bonus;
auto BonusInitializer bi = new BonusInitializer();
bonuses = new ActorPool(8, bonusClass, bi);
LetterRender.createDisplayLists();
for (int i = 0; i < bgm.length; i++)
bgm[i] = new Sound;
bgm[0].loadSound("bgm1.ogg");
bgm[1].loadSound("bgm2.ogg");
bgm[2].loadSound("bgm3.ogg");
for (int i = 0; i < se.length; i++)
se[i] = new Sound;
se[0].loadChunk("getgold.wav", 0);
se[1].loadChunk("boost.wav", 1);
se[2].loadChunk("miss.wav", 2);
se[3].loadChunk("invincible.wav", 3);
se[4].loadChunk("invfast.wav", 3);
se[5].loadChunk("enemyapp.wav", 4);
se[6].loadChunk("enemycrash.wav", 5);
se[7].loadChunk("extend.wav", 6);
se[8].loadChunk("stagestart.wav", 7);
se[9].loadChunk("stageend.wav", 7);
se[10].loadChunk("startinv.wav", 7);
se[11].loadChunk("accel.wav", 2);
titleTexture = new Texture("title.bmp");
}
public override void start() {
stage = 0;
startTitle();
}
public override void close() {
titleTexture.deleteTexture();
for (int i = 0; i < bgm.length; i++)
bgm[i].free();
for (int i = 0; i < se.length; i++)
se[i].free();
LetterRender.deleteDisplayLists();
Enemy.deleteDisplayLists();
Gold.deleteDisplayLists();
Ship.deleteDisplayLists();
}
public void playSe(int n) {
if (state != IN_GAME && state != STAGE_CLEAR)
return;
se[n].playChunk();
}
public void stopSe(int n) {
se[n].haltChunk();
}
public void addGold() {
Gold gold = (Gold) golds.getInstance();
assert(gold);
gold.set();
}
public void addScore(int sc) {
score += sc;
if (score > extendScore) {
if (left < LEFT_MAX) {
playSe(7);
left++;
}
if (extendScore <= FIRST_EXTEND)
extendScore = EVERY_EXTEND;
else
extendScore += (EVERY_EXTEND * (lap + 1));
}
}
public void addBonus(int sc, Vector pos, float size) {
addScore(sc);
Bonus bonus = (Bonus) bonuses.getInstanceForced();
assert(bonus);
bonus.set(sc, pos, size);
}
public void getGold() {
playSe(0);
addBonus(((int)(ship.speed / (ship.DEFAULT_SPEED / 2))) * 10, ship.pos, 0.7);
leftGold--;
if (leftGold - appGold >= 0)
addGold();
ship.addGauge();
if (leftGold <= 0)
startStageClear();
}
public void shipDestroyed() {
playSe(2);
left--;
if (left < 0)
startGameover();
}
public void addEnemy(int type, float size, float speed) {
playSe(5);
Enemy enemy = (Enemy) enemies.getInstance();
if (!enemy) return;
enemy.set(type, size, speed);
}
public void addParticle(Vector pos, float deg, float ofs, float speed,
float r, float g, float b) {
Particle pt = (Particle) particles.getInstanceForced();
assert(pt);
pt.set(pos, deg, ofs, speed, r, g, b);
}
private void startStage(bool cont) {
int st = stage % STAGE_NUM;
lap = stage / STAGE_NUM;
field.size.x = stgData[st][0];
field.size.y = stgData[st][1];
field.eyeZ = 300;
field.alpha = 1;
stageTimer = stgData[st][2] * 60;
leftGold = stgData[st][3];
appGold = stgData[st][4];
enemyAppInterval = stgData[st][5];
int ei = 0;
for (int i = 6; i < stgData[st].length;) {
int n = stgData[st][i]; i++;
int tp = stgData[st][i]; i++;
float sz = stgData[st][i]; i++;
float sp = stgData[st][i]; i++;
for (int j = 0; j < n; j++) {
enemyTable[ei][0] = tp;
enemyTable[ei][1] = sz;
enemyTable[ei][2] = sp;
ei++;
}
}
restartStage();
enemyTimer = 0;
enemyNum = ei;
field.start(st / 5);
ship.startRound();
ship.start();
enemies.clear();
bonuses.clear();
particles.clear();
golds.clear();
for (int i = 0; i < appGold; i++) {
addGold();
}
cnt = 0;
if (st % 5 == 0 || cont) {
bgm[(st / 5) % bgm.length].playMusic();
}
playSe(8);
}
public void restartStage() {
enemyTimer = 120;
enemyTableIdx = 0;
enemies.clear();
}
private void initShipState() {
left = 2;
score = 0;
extendScore = FIRST_EXTEND;
}
private void startInGameContinue() {
state = IN_GAME;
initShipState();
startStage(true);
}
private void startInGame() {
state = IN_GAME;
initShipState();
stage = 0;
startStage(false);
}
private void startStageClear() {
playSe(9);
state = STAGE_CLEAR;
field.eyeZa = 300;
ship.speed = ship.DEFAULT_SPEED;
cnt = 0;
if (stageTimer > 0)
timeBonus = (stageTimer * 17 / 100) * 10;
else
timeBonus = 0;
if (stage % 5 == 4)
Sound.fadeMusic();
}
private void gotoNextStage() {
state = IN_GAME;
stage++;
startStage(false);
}
private void startTitle() {
state = TITLE;
startStage(false);
cnt = 0;
field.eyeZ = field.eyeZa;
Sound.stopMusic();
}
private void startGameover() {
state = GAMEOVER;
cnt = 0;
if (score > prefManager.hiScore)
prefManager.hiScore = score;
if (score > CONTINUE_ENABLE_SCORE && stage < STAGE_NUM) {
continueEnable = true;
contCy = 0;
} else {
continueEnable = false;
}
Sound.fadeMusic();
}
private void startPause() {
state = PAUSE;
pauseCnt = 0;
}
private void resumePause() {
state = IN_GAME;
}
private void stageMove() {
enemyTimer--;
if (enemyTimer < 0) {
if (enemyTableIdx == 0 && lap >= 1) {
int ei = enemyNum - 1;
for (int i = 0; i < lap * 2; i++) {
addEnemy(enemyTable[ei][0],
enemyTable[ei][1] * (1 + lap * 0.1),
enemyTable[ei][2] * (1 + lap * 0.1));
ei--;
if (ei < 0)
ei = enemyNum - 1;
}
}
enemyTimer = enemyAppInterval;
addEnemy(enemyTable[enemyTableIdx][0],
enemyTable[enemyTableIdx][1],
enemyTable[enemyTableIdx][2]);
enemyTableIdx++;
if (enemyTableIdx >= enemyNum)
enemyTimer = 999999999;
}
if (ship.cnt > -ship.INVINCIBLE_CNT) {
stageTimer--;
if (stageTimer <= 0)
startStageClear();
}
}
private bool pPrsd = true;
private void inGameMove() {
stageMove();
field.move();
ship.move();
golds.move();
enemies.move();
particles.move();
bonuses.move();
if (input.keys[SDLK_p] == SDL_PRESSED) {
if (!pPrsd) {
pPrsd = true;
startPause();
}
} else {
pPrsd = false;
}
}
private bool btnPrsd, gotoNextState;
private void stageClearMove() {
if (cnt <= 64) {
btnPrsd = true;
gotoNextState = false;
} else {
if (input.getButtonState() & (Input.PAD_BUTTON1 | Input.PAD_BUTTON2)) {
if (!btnPrsd)
gotoNextState = true;
} else {
btnPrsd = false;
}
}
if (cnt == 64) {
addScore(timeBonus);
} else if ((cnt > 64 && gotoNextState) || cnt > 300) {
if (stageTimer > 0) {
gotoNextStage();
} else {
left--;
if (left < 0) {
ship.start();
startGameover();
} else {
gotoNextStage();
}
}
}
field.move();
field.alpha *= 0.96;
particles.move();
bonuses.move();
}
private void titleMove() {
if (cnt <= 8) {
btnPrsd = true;
} else {
if (input.getButtonState() & (Input.PAD_BUTTON1 | Input.PAD_BUTTON2)) {
if (!btnPrsd)
startInGame();
} else {
btnPrsd = false;
}
}
stageMove();
field.addSpeed(ship.DEFAULT_SPEED / 2);
field.move();
enemies.move();
particles.move();
}
private void gameoverMove() {
if (cnt <= 64) {
btnPrsd = true;
gotoNextState = false;
} else {
if (input.getButtonState() & (Input.PAD_BUTTON1 | Input.PAD_BUTTON2)) {
if (!btnPrsd)
gotoNextState = true;
} else {
btnPrsd = false;
}
if (continueEnable) {
int pad = input.getPadState();
if (pad & Input.PAD_UP) {
contCy = 0;
cnt = 65;
} else if (pad & Input.PAD_DOWN) {
contCy = 1;
cnt = 65;
}
}
}
if (cnt > 64 && gotoNextState) {
if (continueEnable && contCy == 0)
startInGameContinue();
else
startTitle();
} else if (cnt > 500) {
startTitle();
}
field.addSpeed(ship.DEFAULT_SPEED / 2);
field.move();
enemies.move();
particles.move();
}
private void pauseMove() {
pauseCnt++;
if (input.keys[SDLK_p] == SDL_PRESSED) {
if (!pPrsd) {
pPrsd = true;
resumePause();
}
} else {
pPrsd = false;
}
}
public override void move() {
switch (state) {
case IN_GAME:
inGameMove();
break;
case STAGE_CLEAR:
stageClearMove();
break;
case TITLE:
titleMove();
break;
case GAMEOVER:
gameoverMove();
break;
case PAUSE:
pauseMove();
break;
default:
}
cnt++;
}
private void inGameDraw() {
bonuses.draw();
field.draw();
golds.draw();
glBegin(GL_LINES);
particles.draw();
glEnd();
ship.draw();
enemies.draw();
}
private void stageClearDraw() {
if (cnt < 32)
field.draw();
glBegin(GL_LINES);
particles.draw();
glEnd();
}
private void titleDraw() {
glBegin(GL_LINES);
particles.draw();
glEnd();
enemies.draw();
}
private void gameoverDraw() {
field.draw();
glBegin(GL_LINES);
particles.draw();
glEnd();
enemies.draw();
}
private void inGameDrawLuminous() {
field.drawLuminous();
golds.drawLuminous();
glLineWidth(2);
glBegin(GL_LINES);
particles.drawLuminous();
glEnd();
glLineWidth(1);
ship.drawLuminous();
enemies.drawLuminous();
}
private void stageClearDrawLuminous() {
if (cnt < 32)
field.drawLuminous();
glBegin(GL_LINES);
particles.drawLuminous();
glEnd();
}
private void titleDrawLuminous() {
field.drawLuminous();
glBegin(GL_LINES);
particles.drawLuminous();
glEnd();
enemies.drawLuminous();
}
private void gameoverDrawLuminous() {
field.drawLuminous();
glBegin(GL_LINES);
particles.drawLuminous();
glEnd();
enemies.drawLuminous();
}
private void drawScore() {
LetterRender.drawNum(score, 300, 20, 10);
}
private void drawHiScore() {
LetterRender.drawNum(prefManager.hiScore, 620, 20, 10);
}
private void drawStageTimer() {
LetterRender.drawTime(stageTimer * 17, 620, 20, 10);
}
private void inGameDrawStatus() {
if (state == IN_GAME && cnt < 120) {
LetterRender.drawString("STAGE", 200, 180, 22);
LetterRender.drawNum(stage + 1, 440, 180, 22);
}
drawScore();
if (state == STAGE_CLEAR || cnt > 120)
drawStageTimer();
LetterRender.drawNum(left, 80, 460, 10);
glPushMatrix();
glTranslatef(30, 460, 0);
glScalef(11, -11, 1);
glCallList(Ship.displayListIdx);
glCallList(Ship.displayListIdx + 1);
glPopMatrix();
if (state == IN_GAME) {
ship.drawGauge();
LetterRender.drawNum(leftGold, 80, 430, 10);
glPushMatrix();
glTranslatef(30, 430, 0);
glScalef(11, -11, 1);
glCallList(Gold.displayListIdx);
glCallList(Gold.displayListIdx + 1);
glPopMatrix();
}
}
private void stageClearDrawStatus() {
if (stageTimer > 0) {
LetterRender.drawString("STAGE CLEAR", 100, 150, 24);
if (cnt > 32)
LetterRender.drawString("TIME BONUS", 80, 240, 15);
if (cnt > 64)
LetterRender.drawNum(timeBonus, 550, 290, 15);
} else {
LetterRender.drawString("TIME OVER", 124, 150, 24);
}
}
private void titleDrawStatus() {
if ((cnt % 120) < 60)
LetterRender.drawString("PUSH BUTTON TO START", 320, 400, 8);
drawScore();
drawHiScore();
glEnable(GL_TEXTURE_2D);
titleTexture.bind();
A7xScreen.setColor(1, 1, 1, 1);
glBegin(GL_TRIANGLE_FAN);
glTexCoord2f(0, 0);
glVertex3f(80, 50, 0);
glTexCoord2f(1, 0);
glVertex3f(180, 50, 0);
glTexCoord2f(1, 1);
glVertex3f(180, 150, 0);
glTexCoord2f(0, 1);
glVertex3f(80, 150, 0);
glEnd();
glDisable(GL_TEXTURE_2D);
}
private void gameoverDrawStatus() {
if (cnt > 64) {
LetterRender.drawString("GAME OVER", 220, 200, 15);
if (continueEnable) {
LetterRender.drawString("CONTINUE", 250, 270, 9);
if (contCy == 0) {
LetterRender.drawString("YES", 380, 260, 10);
LetterRender.drawString("NO", 395, 280, 5);
} else {
LetterRender.drawString("YES", 395, 260, 5);
LetterRender.drawString("NO", 395, 280, 10);
}
}
}
drawScore();
drawHiScore();
}
private void pauseDrawStatus() {
if ((pauseCnt % 60) < 30)
LetterRender.drawString("PAUSE", 280, 220, 12);
}
private void setEyepos() {
glTranslatef(0, 0, -field.eyeZ);
}
public override void draw() {
SDL_Event e = mainLoop.event;
if (e.type == SDL_VIDEORESIZE) {
SDL_ResizeEvent re = e.resize;
screen.resized(re.w, re.h);
}
screen.startRenderToTexture();
glPushMatrix();
setEyepos();
switch (state) {
case IN_GAME:
case PAUSE:
inGameDrawLuminous();
break;
case STAGE_CLEAR:
stageClearDrawLuminous();
break;
case TITLE:
titleDrawLuminous();
break;
case GAMEOVER:
gameoverDrawLuminous();
break;
default:
}
glPopMatrix();
screen.endRenderToTexture();
screen.clear();
glPushMatrix();
setEyepos();
switch (state) {
case IN_GAME:
case PAUSE:
inGameDraw();
break;
case STAGE_CLEAR:
stageClearDraw();
break;
case TITLE:
titleDraw();
break;
case GAMEOVER:
gameoverDraw();
break;
default:
}
glPopMatrix();
screen.drawLuminous();
screen.viewOrthoFixed();
switch (state) {
case IN_GAME:
inGameDrawStatus();
break;
case STAGE_CLEAR:
inGameDrawStatus();
stageClearDrawStatus();
break;
case TITLE:
titleDrawStatus();
break;
case GAMEOVER:
gameoverDrawStatus();
break;
case PAUSE:
pauseDrawStatus();
break;
default:
}
screen.viewPerspective();
}
}
a7xpg/src/abagames/a7xpg/LetterRender.d 0000666 0000000 0000000 00000027531 07732713606 016752 0 ustar root root /*
* $Id: LetterRender.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.LetterRender;
import opengl;
import abagames.a7xpg.A7xScreen;
/**
* Letters renderer.
*/
public class LetterRender {
public:
static int displayListIdx;
private static void drawLetter(int n, float x, float y, float s) {
glPushMatrix();
glTranslatef(x, y, 0);
glScalef(s, s, s);
glCallList(displayListIdx + n);
glPopMatrix();
}
private static void drawLetterReverse(int n, float x, float y, float s) {
glPushMatrix();
glTranslatef(x, y, 0);
glScalef(s, -s, s);
glCallList(displayListIdx + n);
glPopMatrix();
}
public static void drawString(char[] str, float lx, float y, float s) {
float x = lx;
int c;
int idx;
for (int i = 0; i < str.length; i++) {
c = str[i];
if (c != ' ') {
if (c >= '0' && c <='9') {
idx = c - '0';
} else if (c >= 'A' && c <= 'Z') {
idx = c - 'A' + 10;
} else if (c >= 'a' && c <= 'z') {
idx = c - 'a' + 10;
} else if (c == '.') {
idx = 36;
} else if (c == '-') {
idx = 38;
} else if (c == '+') {
idx = 39;
} else {
idx = 37;
}
drawLetter(idx, x, y, s);
}
x += s * 1.7f;
}
}
public static void drawNum(int num, float lx ,float y, float s) {
int n = num;
float x = lx;
for (;;) {
drawLetter(n % 10, x, y, s);
x -= s * 1.7f;
n /= 10;
if (n <= 0) break;
}
}
public static void drawNumReverse(int num, float lx ,float y, float s) {
int n = num;
float x = lx;
for (;;) {
drawLetterReverse(n % 10, x, y, s);
x -= s * 1.7f;
n /= 10;
if (n <= 0) break;
}
}
public static void drawTime(int time, float lx ,float y, float s) {
int n = time;
float x = lx;
for (int i = 0; i < 7; i++) {
if (i != 4) {
drawLetter(n % 10, x, y, s);
n /= 10;
} else {
drawLetter(n % 6, x, y, s);
n /= 6;
}
if ((i & 1) == 1 || i == 0) {
switch (i) {
case 3:
drawLetter(41, x + s * 1.16f, y, s);
break;
case 5:
drawLetter(40, x + s * 1.16f, y, s);
break;
default:
break;
}
x -= s * 1.7f;
} else {
x -= s * 2.2f;
}
if (n <= 0) break;
}
}
private static void drawBox(float x, float y, float width, float height) {
A7xScreen.setColor(1, 1, 1, 0.5);
A7xScreen.drawBoxSolid(x - width, y - height, width * 2, height * 2);
A7xScreen.setColor(1, 1, 1, 1);
A7xScreen.drawBoxLine(x - width, y - height, width * 2, height * 2);
}
private static void drawLetter(int idx) {
int i;
float x, y, length, size, t;
int deg;
for ( i=0 ; ; i++ ) {
deg = (int) spData[idx][i][4];
if (deg > 99990) break;
x = -spData[idx][i][0];
y = -spData[idx][i][1];
size = spData[idx][i][2];
length = spData[idx][i][3];
size *= 0.66f;
length *= 0.6f;
x = -x;
y = y;
deg %= 180;
if (deg <= 45 || deg > 135)
drawBox(x, y, size, length);
else
drawBox(x, y, length, size);
}
}
public static void createDisplayLists() {
displayListIdx = glGenLists(42);
for (int i = 0; i < 42; i++) {
glNewList(displayListIdx + i, GL_COMPILE);
drawLetter(i);
glEndList();
}
}
public static void deleteDisplayLists() {
glDeleteLists(displayListIdx, 39);
}
private static float[5][16][] spData =
[[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.6f, 0.55f, 0.65f, 0.3f, 90], [0.6f, 0.55f, 0.65f, 0.3f, 90],
[-0.6f, -0.55f, 0.65f, 0.3f, 90], [0.6f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[0, 0.55f, 0.65f, 0.3f, 90],
[0, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[0.65f, 0.55f, 0.65f, 0.3f, 90],
[0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
//A
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[-0.1f, 1.15f, 0.45f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.45f, 0.55f, 0.65f, 0.3f, 90],
[-0.1f, 0, 0.45f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90],
[-0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[-0.1f, 1.15f, 0.45f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.45f, 0.4f, 0.65f, 0.3f, 90],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[// F
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90],
[0.25f, 0, 0.25f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[0, 0.55f, 0.65f, 0.3f, 90],
[0, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[-0.65f, 0.55f, 0.65f, 0.3f, 90],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.75f, 0.25f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[//K
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.45f, 0.55f, 0.65f, 0.3f, 90],
[-0.1f, 0, 0.45f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[-0.65f, 0.55f, 0.65f, 0.3f, 90],
[-0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[-0.3f, 1.15f, 0.25f, 0.3f, 0], [0.3f, 1.15f, 0.25f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, 0.55f, 0.65f, 0.3f, 90],
[0, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[//P
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0.2f, -0.6f, 0.45f, 0.3f, 360-300],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[-0.1f, 0, 0.45f, 0.3f, 0],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.45f, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[-0.65f, 0.55f, 0.65f, 0.3f, 90],
[0, 0, 0.65f, 0.3f, 0],
[0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[-0.4f, 1.15f, 0.45f, 0.3f, 0], [0.4f, 1.15f, 0.45f, 0.3f, 0],
[0, 0.55f, 0.65f, 0.3f, 90],
[0, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[//U
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[-0.5f, -0.55f, 0.65f, 0.3f, 90], [0.5f, -0.55f, 0.65f, 0.3f, 90],
[0, -1.15f, 0.45f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[
[-0.65f, 0.55f, 0.65f, 0.3f, 90], [0.65f, 0.55f, 0.65f, 0.3f, 90],
[-0.65f, -0.55f, 0.65f, 0.3f, 90], [0.65f, -0.55f, 0.65f, 0.3f, 90],
[-0.3f, -1.15f, 0.25f, 0.3f, 0], [0.3f, -1.15f, 0.25f, 0.3f, 0],
[0, 0.55f, 0.65f, 0.3f, 90],
[0, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[-0.4f, 0.6f, 0.85f, 0.3f, 360-120],
[0.4f, 0.6f, 0.85f, 0.3f, 360-60],
[-0.4f, -0.6f, 0.85f, 0.3f, 360-240],
[0.4f, -0.6f, 0.85f, 0.3f, 360-300],
[0, 0, 0, 0, 99999],
],[
[-0.4f, 0.6f, 0.85f, 0.3f, 360-120],
[0.4f, 0.6f, 0.85f, 0.3f, 360-60],
[0, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[
[0, 1.15f, 0.65f, 0.3f, 0],
[0.35f, 0.5f, 0.65f, 0.3f, 360-60],
[-0.35f, -0.5f, 0.65f, 0.3f, 360-240],
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[// .
[0, -1.15f, 0.05f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[// _
[0, -1.15f, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[// -
[0, 0, 0.65f, 0.3f, 0],
[0, 0, 0, 0, 99999],
],[//+
[-0.4f, 0, 0.45f, 0.3f, 0], [0.4f, 0, 0.45f, 0.3f, 0],
[0, 0.55f, 0.65f, 0.3f, 90],
[0, -0.55f, 0.65f, 0.3f, 90],
[0, 0, 0, 0, 99999],
],[//'
[0, 1.0f, 0.4f, 0.2f, 90],
[0, 0, 0, 0, 99999],
],[//''
[-0.19f, 1.0f, 0.4f, 0.2f, 90],
[0.2f, 1.0f, 0.4f, 0.2f, 90],
[0, 0, 0, 0, 99999],
]];
}
a7xpg/src/abagames/a7xpg/Enemy.d 0000666 0000000 0000000 00000060547 07733320450 015424 0 ustar root root /*
* $Id: Enemy.d,v 1.2 2003/09/21 04:01:27 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.Enemy;
import math;
import opengl;
import abagames.util.Vector;
import abagames.util.Rand;
import abagames.util.ActorInitializer;
import abagames.a7xpg.LuminousActor;
import abagames.a7xpg.Ship;
import abagames.a7xpg.A7xGameManager;
import abagames.a7xpg.A7xScreen;
/**
* Enemies.
*/
public class Enemy: LuminousActor {
private:
static int displayListIdx;
Ship ship;
Field field;
Rand rand;
A7xGameManager manager;
Vector pos, ppos;
int type;
float size, speed;
float deg;
int cnt;
float turnDist;
bool hitWall;
int hitWallType;
int chaseType;
Vector vel, blowedVel;
float armDeg, armDegMv;
static const int POSITION_HISTORY_LENGTH = 180;
Vector[] posHst;
float[] degHst;
int posHstIdx;
const int APPEAR_CNT = 60;
const int DESTROYED_CNT = 120;
public override Actor newActor() {
return new Enemy;
}
public override void init(ActorInitializer ini) {
EnemyInitializer ei = (EnemyInitializer) ini;
ship = ei.ship;
field = ei.field;
rand = ei.rand;
manager = ei.manager;
pos = new Vector;
ppos = new Vector;
vel = new Vector;
blowedVel = new Vector;
posHst = new Vector[POSITION_HISTORY_LENGTH];
degHst = new float[POSITION_HISTORY_LENGTH];
for (int i = 0; i < POSITION_HISTORY_LENGTH; i++) {
posHst[i] = new Vector;
}
}
public void set(int type, float size, float speed) {
this.type = type;
this.size = size;
this.speed = speed;
set();
}
private void set() {
for (int i = 0; i < 8 ; i++) {
pos.x = rand.nextFloat((field.size.x - size) * 2) - field.size.x + size;
pos.y = rand.nextFloat((field.size.y - size) * 2) - field.size.y + size;
if (pos.dist(ship.pos) > 8)
break;
if (i == 7) {
pos.x = 0;
pos.y = 0;
}
}
ppos.x = pos.x; ppos.y = pos.y;
blowedVel.x = blowedVel.y = 0;
cnt = 0;
turnDist = 0;
isExist = true;
switch (type) {
case 0:
deg = math.PI / 2 * rand.nextInt(4);
break;
case 1:
deg = math.PI / 4 * rand.nextInt(8);
break;
case 2:
chaseType = 0;
deg = math.PI / 2 * rand.nextInt(4);
break;
case 3:
vel.x = vel.y = 0;
deg = rand.nextFloat(math.PI * 2);
break;
case 4:
deg = rand.nextFloat(math.PI * 2);
vel.x = sin(deg) * speed;
vel.y = cos(deg) * speed;
armDeg = rand.nextFloat(math.PI * 2);
if (rand.nextInt(2) == 0)
armDegMv = rand.nextFloat(0.01) + 0.02;
else
armDegMv = -rand.nextFloat(0.01) - 0.02;
break;
case 5:
posHstIdx = POSITION_HISTORY_LENGTH;
deg = math.PI / 2 * rand.nextInt(4);
for (int i = 0; i < POSITION_HISTORY_LENGTH; i++) {
posHst[i].x = pos.x;
posHst[i].y = pos.y;
degHst[i] = deg;
}
break;
default:
break;
}
}
private float[][] enemyColor =
[
[0.9, 0.2, 0.2],
[0.7, 0.3, 0.6],
[0.6, 0.7, 0.2],
[0.8, 0.2, 0.4],
[0.5, 0.7, 0.3],
[0.6, 0.3, 0.8],
];
private void hitShip() {
if (ship.invincible) {
manager.playSe(6);
for (int i = 0; i < 60; i++) {
manager.addParticle(pos, rand.nextFloat(math.PI * 2), size, rand.nextFloat(0.5),
enemyColor[type][0], enemyColor[type][1], enemyColor[type][2]);
}
ship.destroyEnemy();
set();
cnt = -DESTROYED_CNT;
} else if (!ship.restart) {
for (int i = 0; i < 100; i++) {
manager.addParticle(pos, rand.nextFloat(math.PI * 2), size, rand.nextFloat(1),
0.3, 1, 0.2);
}
ship.miss();
manager.restartStage();
}
}
private void moveType0() {
turnDist -= speed;
if (hitWall) {
turnDist = (rand.nextInt(60) + 60) * 0.2;
if (deg < math.PI / 4 * 1 || (deg > math.PI / 4 * 3 && deg < math.PI / 4 * 5)) {
if (ship.pos.x < pos.x)
deg = math.PI / 4 * 6;
else
deg = math.PI / 4 * 2;
} else {
if (ship.pos.y < pos.y)
deg = math.PI / 4 * 4;
else
deg = math.PI / 4 * 0;
}
}
if (cnt < APPEAR_CNT)
return;
if (turnDist <= 0) {
turnDist = (rand.nextInt(90) + 60) * 0.2;
float od = atan2(ship.pos.x - pos.x, ship.pos.y - pos.y);
if (od < -math.PI / 4 * 3)
deg = math.PI / 4 * 4;
else if (od < -math.PI / 4 * 1)
deg = math.PI / 4 * 6;
else if (od < math.PI / 4 * 1)
deg = math.PI / 4 * 0;
else
deg = math.PI / 4 * 2;
}
if (rand.nextInt(9) == 0) {
manager.addParticle(pos, deg + math.PI + math.PI / 7 + rand.nextFloat(0.2) - 0.1,
size, speed * 2, 0.9, 0.3, 0.3);
}
if (rand.nextInt(9) == 0) {
manager.addParticle(pos, deg + math.PI - math.PI / 7 + rand.nextFloat(0.2) - 0.1,
size, speed * 2, 0.9, 0.3, 0.3);
}
if (ship.checkHit(pos.x, pos.y - size * 0.8, pos.x, pos.y + size * 0.8) ||
ship.checkHit(pos.x - size * 0.8, pos.y, pos.x + size * 0.8, pos.y)) {
hitShip();
}
}
private void moveType1() {
turnDist -= speed;
if (hitWall) {
deg += math.PI;
if (deg >= math.PI * 2)
deg -= math.PI * 2;
}
if (cnt < APPEAR_CNT)
return;
if (!hitWall && turnDist <= 0) {
turnDist = (rand.nextInt(40) + 8) * 0.2;
float od = atan2(ship.pos.x - pos.x, ship.pos.y - pos.y);
if (od < 0)
od += math.PI * 2;
od -= deg;
if (od > -math.PI / 8 && od < math.PI / 8) {
} else if (od < -math.PI / 8 * 15 || od > math.PI / 8 * 15) {
} else if ((od > -math.PI && od < 0) || od > math.PI) {
deg -= math.PI / 4;
if (deg < 0)
deg += math.PI * 2;
} else {
deg += math.PI / 4;
if (deg >= math.PI * 2)
deg -= math.PI * 2;
}
}
if (rand.nextInt(4) == 0) {
manager.addParticle(pos, deg + math.PI + rand.nextFloat(0.2) - 0.1,
size, speed * 2.5, 0.8, 0.4, 0.5);
}
if (ship.checkHit(pos.x, pos.y - size * 0.8, pos.x, pos.y + size * 0.8) ||
ship.checkHit(pos.x - size * 0.8, pos.y, pos.x + size * 0.8, pos.y)) {
hitShip();
}
}
private void moveType2() {
if (hitWall) {
if ((hitWallType & 1) == 1) {
float od = atan2(ship.pos.x - pos.x, ship.pos.y - pos.y);
if (od > -math.PI / 2 && od <= math.PI / 2) {
if (chaseType > 0)
deg = 0;
else
deg = math.PI / 2 * 2;
chaseType++;
} else {
if (chaseType > 0)
deg = math.PI / 2 * 2;
else
deg = 0;
chaseType++;
}
}
if ((hitWallType & 2) == 2) {
float od = atan2(ship.pos.x - pos.x, ship.pos.y - pos.y);
if (od < 0) {
if (chaseType > 0)
deg = math.PI / 2 * 3;
else
deg = math.PI / 2;
chaseType++;
} else {
if (chaseType > 0)
deg = math.PI / 2;
else
deg = math.PI / 2 * 3;
chaseType++;
}
}
} else if (chaseType > 1) {
if (deg < 0.1) {
if (ship.pos.y <= pos.y) {
if (ship.pos.x < pos.x)
deg = math.PI / 2 * 3;
else
deg = math.PI / 2;
chaseType = 0;
}
} else if (deg > math.PI / 2 - 0.1 && deg < math.PI / 2 + 0.1) {
if (ship.pos.x <= pos.x) {
if (ship.pos.y < pos.y)
deg = math.PI / 2 * 2;
else
deg = 0;
chaseType = 0;
}
} else if (deg > math.PI / 2 * 2 - 0.1 && deg < math.PI / 2 * 2 + 0.1) {
if (ship.pos.y >= pos.y) {
if (ship.pos.x < pos.x)
deg = math.PI / 2 * 3;
else
deg = math.PI / 2;
chaseType = 0;
}
} else if (deg > math.PI / 2 * 3 - 0.1 && deg < math.PI / 2 * 3 + 0.1) {
if (ship.pos.x >= pos.x) {
if (ship.pos.y < pos.y)
deg = math.PI / 2 * 2;
else
deg = 0;
chaseType = 0;
}
}
}
if (cnt < APPEAR_CNT)
return;
if (rand.nextInt(9) == 0) {
manager.addParticle(pos, deg + math.PI + math.PI / 12 + rand.nextFloat(0.2) - 0.1,
size, speed * 2, 0.3, 0.9, 0.3);
}
if (rand.nextInt(9) == 0) {
manager.addParticle(pos, deg + math.PI - math.PI / 12 + rand.nextFloat(0.2) - 0.1,
size, speed * 2, 0.3, 0.9, 0.3);
}
if (ship.checkHit(pos.x, pos.y - size * 0.8, pos.x, pos.y + size * 0.8) ||
ship.checkHit(pos.x - size * 0.8, pos.y, pos.x + size * 0.8, pos.y)) {
hitShip();
}
}
private void moveType3() {
if (hitWall) {
if ((hitWallType & 1) == 1) {
vel.x *= -0.8;
}
if ((hitWallType & 2) == 2) {
vel.y *= -0.8;
}
} else {
if (ship.pos.x < pos.x) {
vel.x -= 0.01;
} else {
vel.x += 0.01;
}
if (ship.pos.y < pos.y) {
vel.y -= 0.01;
} else {
vel.y += 0.01;
}
}
vel.mul(0.99);
deg += 0.1;
if (cnt < APPEAR_CNT)
return;
if (rand.nextInt(4) == 0) {
manager.addParticle(pos, rand.nextFloat(math.PI * 2),
size, speed, 0.9, 0.3, 0.6);
}
if (ship.checkHit(pos.x, pos.y - size * 0.8, pos.x, pos.y + size * 0.8) ||
ship.checkHit(pos.x - size * 0.8, pos.y, pos.x + size * 0.8, pos.y)) {
hitShip();
}
}
private void moveType4() {
float width = size * sin(armDeg);
float height = size * cos(armDeg);
if (width < 0)
width *= -1;
if (height < 0)
height *= -1;
if (pos.x < -field.size.x + width && vel.x < 0) {
vel.x *= -1;
pos.x = ppos.x; pos.y = ppos.y;
} else if (pos.x > field.size.x - width && vel.x > 0) {
vel.x *= -1;
pos.x = ppos.x; pos.y = ppos.y;
}
if (pos.y < -field.size.y + height && vel.y < 0) {
vel.y *= -1;
pos.x = ppos.x; pos.y = ppos.y;
} else if (pos.y > field.size.y - height && vel.y > 0) {
vel.y *= -1;
pos.x = ppos.x; pos.y = ppos.y;
}
armDeg += armDegMv;
if (cnt < APPEAR_CNT)
return;
if (rand.nextInt(7) == 0) {
manager.addParticle(pos, armDeg + rand.nextFloat(0.2) - 0.1,
1, speed * 2, 0.5, 0.9, 0.3);
}
if (rand.nextInt(7) == 0) {
manager.addParticle(pos, armDeg + math.PI + rand.nextFloat(0.2) - 0.1,
1, speed * 2, 0.5, 0.9, 0.3);
}
float ax = size * sin(armDeg) * 0.9;
float ay = size * cos(armDeg) * 0.9;
if (ship.checkHit(pos.x - ax, pos.y - ay, pos.x + ax, pos.y + ay)) {
hitShip();
}
}
private void moveType5() {
turnDist -= speed;
if (hitWall) {
deg += math.PI;
if (deg >= math.PI * 2)
deg -= math.PI * 2;
}
if (cnt < APPEAR_CNT)
return;
if (!hitWall && turnDist <= 0) {
turnDist = (rand.nextInt(24) + 16) * 0.2;
float od = atan2(ship.pos.x - pos.x, ship.pos.y - pos.y);
if (od < 0)
od += math.PI * 2;
od -= deg;
if (od > -math.PI / 8 && od < math.PI / 8) {
} else if (od < -math.PI / 8 * 15 || od > math.PI / 8 * 15) {
} else if ((od > -math.PI && od < 0) || od > math.PI) {
deg -= math.PI / 2;
if (deg < 0)
deg += math.PI * 2;
} else {
deg += math.PI / 2;
if (deg >= math.PI * 2)
deg -= math.PI * 2;
}
}
if (rand.nextInt(4) == 0) {
manager.addParticle(pos, deg + math.PI + rand.nextFloat(0.2) - 0.1,
0, speed * 5, 0.5, 0.3, 0.9);
}
int hi = posHstIdx;
for (int i = 0; i < 5; i++) {
float cx = posHst[hi].x;
float cy = posHst[hi].y;
float cd = degHst[hi];
float ax = size * sin(cd);
float ay = size * cos(cd);
if (ship.checkHit(cx - ax, cy - ay, cx + ax, cy + ay)) {
hitShip();
}
hi += size * 2 / speed;
if (hi >= POSITION_HISTORY_LENGTH)
hi -= POSITION_HISTORY_LENGTH;
}
}
public override void move() {
cnt++;
if (cnt < 0)
return;
ppos.x = pos.x; ppos.y = pos.y;
switch (type) {
default:
pos.x += sin(deg) * speed;
pos.y += cos(deg) * speed;
break;
case 3:
case 4:
pos.x += vel.x * speed;
pos.y += vel.y * speed;
break;
}
if (type < 4) {
ship.addBlowedForce(pos, blowedVel, size);
pos.x += blowedVel.x;
pos.y += blowedVel.y;
blowedVel.mul(0.94);
}
if (type == 5) {
posHstIdx--;
if (posHstIdx < 0)
posHstIdx = POSITION_HISTORY_LENGTH - 1;
posHst[posHstIdx].x = pos.x;
posHst[posHstIdx].y = pos.y;
degHst[posHstIdx] = deg;
}
hitWallType = 0;
if (pos.x < -field.size.x + size || pos.x > field.size.x - size ) {
hitWall = true;
hitWallType |= 1;
}
if (pos.y < -field.size.y + size || pos.y > field.size.y - size) {
hitWall = true;
hitWallType |= 2;
}
if (hitWall) {
if (type < 4) {
blowedVel.mul(-0.7);
}
if (type != 4) {
pos.x = ppos.x; pos.y = ppos.y;
}
}
switch (type) {
case 0:
moveType0();
break;
case 1:
moveType1();
break;
case 2:
moveType2();
break;
case 3:
moveType3();
break;
case 4:
moveType4();
break;
case 5:
moveType5();
break;
default:
break;
}
hitWall = false;
}
private void drawType0() {
float sz;
if (cnt < 0)
return;
else if (cnt < APPEAR_CNT)
sz = size * cnt / APPEAR_CNT;
else
sz = size;
glPushMatrix();
glTranslatef(pos.x, pos.y, 0.5);
glRotatef(-deg * 180 / math.PI, 0, 0, 1);
glScalef(sz, sz, sz);
glCallList(displayListIdx + type * 3);
glCallList(displayListIdx + type * 3 + 1);
glTranslatef(0, 0, -0.5);
glScalef(1, 1, -1);
glCallList(displayListIdx + type * 3 + 2);
glPopMatrix();
}
private void drawType4() {
if (cnt < 0)
return;
glPushMatrix();
glTranslatef(pos.x, pos.y, 0.5);
glCallList(displayListIdx + type * 3);
glCallList(displayListIdx + type * 3 + 1);
glTranslatef(0, 0, -0.5);
glScalef(1, 1, -1);
glCallList(displayListIdx + type * 3 + 2);
glPopMatrix();
}
private void drawArm() {
float sz;
if (cnt < 0)
return;
else if (cnt < APPEAR_CNT)
sz = size * cnt / APPEAR_CNT;
else
sz = size;
glPushMatrix();
glTranslatef(pos.x, pos.y, 0.5);
glRotatef(-armDeg * 180 / math.PI, 0, 0, 1);
glBegin(GL_TRIANGLE_FAN);
A7xScreen.setColor(0.7, 0.9, 0.3, 0.3);
glVertex3f(0, 0, 0.5);
A7xScreen.setColor(0.7, 0.9, 0.3, 0.9);
glVertex3f(-0.5, 0, 0.5);
glVertex3f(0, sz, 0.5);
glVertex3f(0.5, 0, 0.5);
glVertex3f(0, -sz, 0.5);
glEnd();
glTranslatef(0, 0, -0.5);
glScalef(1, 1, -1);
glBegin(GL_TRIANGLE_FAN);
A7xScreen.setColor(0.7, 0.9, 0.3, 0.1);
glVertex3f(0, 0, 0.5);
A7xScreen.setColor(0.7, 0.9, 0.3, 0.5);
glVertex3f(-0.5, 0, 0.5);
glVertex3f(0, sz, 0.5);
glVertex3f(0.5, 0, 0.5);
glVertex3f(0, -sz, 0.5);
glEnd();
glPopMatrix();
}
private void drawType5() {
float sz;
if (cnt < 0)
return;
else if (cnt < APPEAR_CNT)
sz = size * cnt / APPEAR_CNT;
else
sz = size;
int hi = posHstIdx;
for (int i = 0; i < 5; i++) {
glPushMatrix();
glTranslatef(posHst[hi].x, posHst[hi].y, 0.5);
glRotatef(-degHst[hi] * 180 / math.PI, 0, 0, 1);
glScalef(sz, sz, sz);
glCallList(displayListIdx + 5 * 3);
glCallList(displayListIdx + 5 * 3 + 1);
glTranslatef(0, 0, -0.5);
glScalef(1, 1, -1);
glCallList(displayListIdx + 5 * 3 + 2);
glPopMatrix();
hi += size * 2 / speed;
if (hi >= POSITION_HISTORY_LENGTH)
hi -= POSITION_HISTORY_LENGTH;
}
}
public override void draw() {
switch (type) {
case 4:
drawType4();
drawArm();
break;
case 5:
drawType5();
break;
default:
drawType0();
break;
}
}
private void drawType0Luminous() {
glPushMatrix();
glTranslatef(pos.x, pos.y, 0.5);
glRotatef(-deg * 180 / math.PI, 0, 0, 1);
glScalef(size, size, size);
glCallList(displayListIdx + type * 3 + 1);
glPopMatrix();
}
private void drawType4Luminous() {
glPushMatrix();
glTranslatef(pos.x, pos.y, 0.5);
glCallList(displayListIdx + type * 3 + 1);
glPopMatrix();
}
private void drawArmLuminous() {
glPushMatrix();
glTranslatef(pos.x, pos.y, 0.5);
glRotatef(-armDeg * 180 / math.PI, 0, 0, 1);
glBegin(GL_LINE_STRIP);
A7xScreen.setColor(0.5, 0.9, 0.3, 0.9);
glVertex3f(-0.5, 0, 0.5);
glVertex3f(0, size, 0.5);
glVertex3f(0.5, 0, 0.5);
glVertex3f(0, -size, 0.5);
glVertex3f(-0.5, 0, 0.5);
glEnd();
glPopMatrix();
}
private void drawType5Luminous() {
}
public override void drawLuminous() {
if (cnt < APPEAR_CNT)
return;
switch (type) {
case 4:
drawType4Luminous();
drawArmLuminous();
break;
case 5:
drawType5Luminous();
break;
default:
drawType0Luminous();
break;
}
}
// Create display lists.
public static void createDisplayLists() {
displayListIdx = glGenLists(18);
glNewList(displayListIdx, GL_COMPILE);
drawEnemyType0(1);
glEndList();
glNewList(displayListIdx + 1, GL_COMPILE);
drawEnemyType0Line(1);
glEndList();
glNewList(displayListIdx + 2, GL_COMPILE);
drawEnemyType0(0.6);
glEndList();
glNewList(displayListIdx + 3, GL_COMPILE);
drawEnemyType1(1);
glEndList();
glNewList(displayListIdx + 4, GL_COMPILE);
drawEnemyType1Line(1);
glEndList();
glNewList(displayListIdx + 5, GL_COMPILE);
drawEnemyType1(0.6);
glEndList();
glNewList(displayListIdx + 6, GL_COMPILE);
drawEnemyType2(1);
glEndList();
glNewList(displayListIdx + 7, GL_COMPILE);
drawEnemyType2Line(1);
glEndList();
glNewList(displayListIdx + 8, GL_COMPILE);
drawEnemyType2(0.6);
glEndList();
glNewList(displayListIdx + 9, GL_COMPILE);
drawEnemyType3(1);
glEndList();
glNewList(displayListIdx + 10, GL_COMPILE);
drawEnemyType3Line(1);
glEndList();
glNewList(displayListIdx + 11, GL_COMPILE);
drawEnemyType3(0.6);
glEndList();
glNewList(displayListIdx + 12, GL_COMPILE);
drawEnemyType4(1);
glEndList();
glNewList(displayListIdx + 13, GL_COMPILE);
drawEnemyType4Line(1);
glEndList();
glNewList(displayListIdx + 14, GL_COMPILE);
drawEnemyType4(0.6);
glEndList();
glNewList(displayListIdx + 15, GL_COMPILE);
drawEnemyType5(1);
glEndList();
glNewList(displayListIdx + 16, GL_COMPILE);
drawEnemyType5Line(1);
glEndList();
glNewList(displayListIdx + 17, GL_COMPILE);
drawEnemyType5(0.6);
glEndList();
}
public static void deleteDisplayLists() {
glDeleteLists(displayListIdx, 18);
}
private static void drawEnemyType0(float alpha) {
glBegin(GL_TRIANGLE_FAN);
A7xScreen.setColor(0.9, 0.7, 0.4, 0.9 * alpha);
glVertex3f(0.8, 1, 0.2);
A7xScreen.setColor(1, 0.2, 0.4, 0.9 * alpha);
glVertex3f(1, -1, 0);
glVertex3f(0.7, -0.8, 0.8);
glVertex3f(0, 1, 0.2);
glEnd();
glBegin(GL_TRIANGLE_FAN);
A7xScreen.setColor(0.9, 0.7, 0.4, 0.9 * alpha);
glVertex3f(-0.8, 1, 0.2);
A7xScreen.setColor(1, 0.2, 0.4, 0.9 * alpha);
glVertex3f(-1, -1, 0);
glVertex3f(-0.7, -0.8, 0.8);
glVertex3f(0, 1, 0.2);
glEnd();
}
private static void drawEnemyType0Line(float alpha) {
glBegin(GL_LINE_STRIP);
A7xScreen.setColor(0.9, 0.2, 0.2, 1 * alpha);
glVertex3f(0.7, -0.8, 0.8);
glVertex3f(0.8, 1, 0.2);
glVertex3f(-0.8, 1, 0.2);
glVertex3f(-0.7, -0.8, 0.8);
glEnd();
}
private static void drawEnemyType1(float alpha) {
glBegin(GL_TRIANGLE_FAN);
A7xScreen.setColor(0.7, 0.3, 0.6, 1.0 * alpha);
glVertex3f(0, 1, 0.5);
A7xScreen.setColor(0.5, 0.2, 0.7, 0.8 * alpha);
glVertex3f(-0.5, -1, 0.2);
glVertex3f(-0.8, -0.6, 0.6);
glVertex3f(0, -0.3, 1);
glVertex3f(0.8, -0.6, 0.6);
glVertex3f(0.5, -1, 0.2);
glEnd();
}
private static void drawEnemyType1Line(float alpha) {
glBegin(GL_LINE_STRIP);
A7xScreen.setColor(0.4, 0.2, 0.7, 1.0 * alpha);
glVertex3f(-0.5, -1, 0.2);
glVertex3f(-0.8, -0.6, 0.6);
glVertex3f(0, -0.3, 1);
glVertex3f(0.8, -0.6, 0.6);
glVertex3f(0.5, -1, 0.2);
glEnd();
}
private static void drawEnemyType2(float alpha) {
glBegin(GL_TRIANGLE_STRIP);
A7xScreen.setColor(0.6, 0.8, 0.2, 1.0 * alpha);
glVertex3f(-0.3, -0.6, 1);
A7xScreen.setColor(0.5, 0.8, 0.2, 0.5 * alpha);
glVertex3f(0, 0.6, 0.7);
glVertex3f(-0.9, 0.8, 0.4);
A7xScreen.setColor(0.6, 0.8, 0.5, 1.0 * alpha);
glVertex3f(-0.2, 0, 0);
glEnd();
glBegin(GL_TRIANGLE_STRIP);
A7xScreen.setColor(0.6, 0.8, 0.2, 1.0 * alpha);
glVertex3f(0.3, -0.6, 1);
A7xScreen.setColor(0.5, 0.8, 0.2, 0.5 * alpha);
glVertex3f(0, 0.6, 0.7);
glVertex3f(0.9, 0.8, 0.4);
A7xScreen.setColor(0.6, 0.8, 0.5, 1.0 * alpha);
glVertex3f(0.2, 0, 0);
glEnd();
}
private static void drawEnemyType2Line(float alpha) {
A7xScreen.setColor(0.5, 1, 0.2, 1.0 * alpha);
glBegin(GL_LINE_STRIP);
glVertex3f(-0.9, 0.8, 0.4);
glVertex3f(0, 0.6, 0.7);
glVertex3f(0.9, 0.8, 0.4);
glEnd();
}
private static void drawEnemyType3(float alpha) {
glBegin(GL_TRIANGLE_STRIP);
A7xScreen.setColor(0.8, 0.2, 0.4, 0.9 * alpha);
glVertex3f(0, 1, 0.7);
glVertex3f(0.8, 0.4, 0.7);
A7xScreen.setColor(0.8, 0.1, 0.6, 0.6 * alpha);
glVertex3f(0.6, 0.3, 0);
A7xScreen.setColor(0.8, 0.2, 0.4, 0.9 * alpha);
glVertex3f(0.8, -0.4, 0.7);
glEnd();
glBegin(GL_TRIANGLE_STRIP);
A7xScreen.setColor(0.8, 0.2, 0.4, 0.9 * alpha);
glVertex3f(0.8, -0.4, 0.7);
glVertex3f(0, -1, 0.7);
A7xScreen.setColor(0.8, 0.1, 0.6, 0.6 * alpha);
glVertex3f(0, -0.7, 0);
A7xScreen.setColor(0.8, 0.2, 0.4, 0.9 * alpha);
glVertex3f(-0.8, -0.4, 0.7);
glEnd();
glBegin(GL_TRIANGLE_STRIP);
A7xScreen.setColor(0.8, 0.2, 0.4, 0.9 * alpha);
glVertex3f(-0.8, -0.4, 0.7);
glVertex3f(-0.8, 0.4, 0.7);
A7xScreen.setColor(0.8, 0.1, 0.6, 0.6 * alpha);
glVertex3f(-0.6, 0.3, 0);
A7xScreen.setColor(0.8, 0.2, 0.4, 0.9 * alpha);
glVertex3f(0, 1, 0.7);
glEnd();
}
private static void drawEnemyType3Line(float alpha) {
A7xScreen.setColor(0.8, 0.2, 0.6, 0.9 * alpha);
glBegin(GL_LINE_STRIP);
glVertex3f(0, 1, 0.7);
glVertex3f(0.6, 0.3, 0);
glVertex3f(0.8, -0.4, 0.7);
glVertex3f(0, -0.7, 0);
glVertex3f(-0.8, -0.4, 0.7);
glVertex3f(-0.6, 0.3, 0);
glVertex3f(0, 1, 0.7);
glEnd();
}
private static void drawEnemyType4(float alpha) {
glBegin(GL_TRIANGLE_FAN);
A7xScreen.setColor(0.5, 0.7, 0.3, 0.9 * alpha);
glVertex3f(0, 0, 1);
A7xScreen.setColor(0.5, 0.9, 0.3, 0.5 * alpha);
glVertex3f(1, 0, 0.2);
glVertex3f(0, 1, 0.2);
glVertex3f(-1, 0, 0.2);
glVertex3f(0, -1, 0.2);
glVertex3f(1, 0, 0.2);
glEnd();
}
private static void drawEnemyType4Line(float alpha) {
A7xScreen.setColor(0.3, 0.8, 0.3, 0.9 * alpha);
glBegin(GL_LINE_STRIP);
glVertex3f(1, 0, 0.2);
glVertex3f(0, 1, 0.2);
glVertex3f(-1, 0, 0.2);
glVertex3f(0, -1, 0.2);
glVertex3f(1, 0, 0.2);
glEnd();
}
private static void drawEnemyType5(float alpha) {
glBegin(GL_TRIANGLE_FAN);
A7xScreen.setColor(0.6, 0.3, 0.8, 0.9 * alpha);
glVertex3f(0, 0.5, 1);
A7xScreen.setColor(0.4, 0.3, 0.9, 0.6 * alpha);
glVertex3f(-0.3, 1, 0.3);
glVertex3f(0.3, 1, 0.3);
glVertex3f(0.5, -1, 0.4);
glVertex3f(-0.5, -1, 0.4);
glVertex3f(-0.3, 1, 0.3);
glEnd();
}
private static void drawEnemyType5Line(float alpha) {
A7xScreen.setColor(0.4, 0.3, 0.9, 0.9 * alpha);
glBegin(GL_LINE_STRIP);
glVertex3f(-0.3, 1, 0.3);
glVertex3f(0.3, 1, 0.3);
glVertex3f(0.5, -1, 0.4);
glVertex3f(-0.5, -1, 0.4);
glVertex3f(-0.3, 1, 0.3);
glEnd();
}
}
public class EnemyInitializer: ActorInitializer {
public:
Ship ship;
Field field;
Rand rand;
A7xGameManager manager;
public this(Ship ship, Field field, Rand rand, A7xGameManager manager) {
this.ship = ship;
this.field = field;
this.rand = rand;
this.manager = manager;
}
}
a7xpg/src/abagames/a7xpg/Ship.d 0000666 0000000 0000000 00000026236 07732713606 015257 0 ustar root root /*
* $Id: Ship.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.Ship;
import math;
import opengl;
import abagames.util.Vector;
import abagames.util.Rand;
import abagames.util.sdl.Input;
import abagames.a7xpg.Field;
import abagames.a7xpg.A7xGameManager;
import abagames.a7xpg.A7xScreen;
/**
* My ship.
*/
public class Ship {
public:
static const float SIZE = 1;
static int displayListIdx;
Vector pos;
bool invincible;
bool restart;
float speed;
const float DEFAULT_SPEED = 0.2;
const int RESTART_CNT = 300;
const int INVINCIBLE_CNT = 180;
int cnt;
private:
Input input;
Field field;
A7xGameManager manager;
const float SPEED_UP = 0.005;
const int BOOST_TIME = 72;
Vector ppos;
float deg;
float aimSpeed;
int boost;
bool btnPrsd;
bool hitWall;
bool blow;
float a1x, a1y, a2x, a2y, a, b, c; // For checking a collision.
Rand rand;
const float GAUGE_DEC = 0.2;
const float GAUGE_MAX = 200;
float gauge;
int enemyDstCnt;
public void init(Input input, Field field, A7xGameManager manager) {
this.input = input;
this.field = field;
this.manager = manager;
pos = new Vector;
ppos = new Vector;
rand = new Rand;
}
public void start() {
ppos.x = pos.x = 0;
ppos.y = pos.y = -field.size.y / 2;
deg = 0;
speed = aimSpeed = DEFAULT_SPEED;
hitWall = false;
invincible = false;
restart = true;
cnt = -INVINCIBLE_CNT;
gauge = 0;
boost = 0;
btnPrsd = true;
blow = false;
}
public void miss() {
manager.shipDestroyed();
start();
cnt = -RESTART_CNT;
}
private const int[] ENEMY_SCORE_TABLE =
[100, 200, 400, 800, 1600, 3200, 4850, 5730, 7650, 8560];
public void destroyEnemy() {
manager.addBonus(ENEMY_SCORE_TABLE[enemyDstCnt], pos, 1 + enemyDstCnt * 0.2);
if (enemyDstCnt < ENEMY_SCORE_TABLE.length - 1)
enemyDstCnt++;
}
public void startRound() {
}
public void addGauge() {
if (invincible)
gauge += (speed - DEFAULT_SPEED) * 10;
else
gauge += (speed - DEFAULT_SPEED) * 80;
}
public void move() {
blow = false;
cnt++;
if (cnt < -INVINCIBLE_CNT) {
field.addSpeed(DEFAULT_SPEED / 2);
return;
}
if (cnt == 0)
restart = false;
field.addSpeed(speed);
int prtNum = 0;
float pSpeed = speed;
if (!hitWall) {
ppos.x = pos.x; ppos.y = pos.y;
} else {
ppos.x = pos.x - sin(deg) * DEFAULT_SPEED;
ppos.y = pos.y - cos(deg) * DEFAULT_SPEED;
}
int pad = input.getPadState();
if (pad & Input.PAD_UP) {
if (pad & Input.PAD_RIGHT)
deg = math.PI / 4;
else if (pad & Input.PAD_LEFT)
deg = math.PI / 4 * 7;
else
deg = 0;
} else if (pad & Input.PAD_DOWN) {
if (pad & Input.PAD_RIGHT)
deg = math.PI / 4 * 3;
else if (pad & Input.PAD_LEFT)
deg = math.PI / 4 * 5;
else
deg = math.PI / 4 * 4;
} else {
if (pad & Input.PAD_RIGHT)
deg = math.PI / 4 * 2;
else if (pad & Input.PAD_LEFT)
deg = math.PI / 4 * 6;
}
int btn = input.getButtonState();
if (btn & (Input.PAD_BUTTON1 | Input.PAD_BUTTON2)) {
if (!hitWall && boost > 0) {
if (!btnPrsd) {
manager.playSe(1);
manager.playSe(11);
blow = true;
btnPrsd = true;
aimSpeed = DEFAULT_SPEED * 2;
prtNum += 24;
} else {
boost--;
aimSpeed += SPEED_UP;
prtNum++;
}
} else {
aimSpeed *= 0.96;
if (aimSpeed < DEFAULT_SPEED)
aimSpeed = DEFAULT_SPEED;
}
} else {
manager.stopSe(11);
boost = BOOST_TIME;
btnPrsd = false;
aimSpeed *= 0.96;
if (aimSpeed < DEFAULT_SPEED)
aimSpeed = DEFAULT_SPEED;
hitWall = false;
}
if (invincible)
gauge -= GAUGE_DEC * 3;
else
gauge -= GAUGE_DEC / 5;
if (gauge < 0) {
gauge = 0;
invincible = false;
} else if (gauge > GAUGE_MAX) {
gauge = GAUGE_MAX;
if (!invincible) {
manager.playSe(10);
invincible = true;
enemyDstCnt = 0;
for (int i = 0; i < 50; i++) {
manager.addParticle(pos, rand.nextFloat(math.PI * 2), SIZE, rand.nextFloat(4),
0.9, 0.5, 0.5);
}
}
}
if (rand.nextInt(4) == 0)
prtNum++;
speed += (aimSpeed - speed) * 0.2;
pos.x += sin(deg) * speed;
pos.y += cos(deg) * speed;
if (pos.x < -field.size.x + SIZE) {
pos.x = -field.size.x + SIZE;
speed = aimSpeed = DEFAULT_SPEED;
hitWall = true;
} else if (pos.x > field.size.x - SIZE) {
pos.x = field.size.x - SIZE;
speed = aimSpeed = DEFAULT_SPEED;
hitWall = true;
}
if (pos.y < -field.size.y + SIZE) {
pos.y = -field.size.y + SIZE;
speed = aimSpeed = DEFAULT_SPEED;
hitWall = true;
} else if (pos.y > field.size.y - SIZE) {
pos.y = field.size.y - SIZE;
speed = aimSpeed = DEFAULT_SPEED;
hitWall = true;
}
if (pos.x < ppos.x) {
a1x = pos.x - SIZE; a2x = ppos.x + SIZE;
} else {
a1x = ppos.x - SIZE; a2x = pos.x + SIZE;
}
if (pos.y < ppos.y) {
a1y = pos.y - SIZE; a2y = ppos.y + SIZE;
} else {
a1y = ppos.y - SIZE; a2y = pos.y + SIZE;
}
a = pos.y - ppos.y;
b = ppos.x - pos.x;
c = ppos.x * pos.y - ppos.y * pos.x;
float ps = speed * 4;
if (prtNum > 8)
ps *= 2;
for (int i = 0; i < prtNum; i++) {
float pr, pg, pb;
if (invincible) {
pr = 0.3 + 0.6 * gauge / GAUGE_MAX;
pg = 0.4;
pb = 0.9 - 0.6 * gauge / GAUGE_MAX;
} else {
pr = 0.3; pg = 0.3; pb = 0.9;
}
manager.addParticle(pos, deg + math.PI + rand.nextFloat(0.5) - 0.25, SIZE, ps, pr, pg, pb);
}
if (hitWall && pSpeed > DEFAULT_SPEED * 1.1) {
int pn = pSpeed / (DEFAULT_SPEED / 4);
for (int i = 0; i < pn; i++) {
manager.addParticle(pos, deg + rand.nextFloat(1.2) - 0.6, SIZE, pSpeed * 3,
0.8, 0.6, 0.1);
}
}
if (invincible) {
if (gauge < GAUGE_MAX / 4) {
if ((cnt % 30) == 0)
manager.playSe(4);
} else {
if ((cnt % 40) == 0)
manager.playSe(3);
}
}
}
public void draw() {
if (cnt < -INVINCIBLE_CNT || (cnt < 0 && (-cnt % 32) < 16))
return;
glPushMatrix();
glTranslatef(pos.x, pos.y, 0.5);
glRotatef(-deg * 180 / math.PI, 0, 0, 1);
glCallList(displayListIdx);
glCallList(displayListIdx + 1);
glTranslatef(0, 0, -0.5);
glScalef(1, 1, -1);
glCallList(displayListIdx);
glPopMatrix();
}
public void drawLuminous() {
if (cnt < -INVINCIBLE_CNT || (cnt < 0 && (-cnt % 32) < 16))
return;
glPushMatrix();
glTranslatef(pos.x, pos.y, 0.5);
glRotatef(-deg * 180 / math.PI, 0, 0, 1);
if (invincible)
glCallList(displayListIdx + 2);
else
glCallList(displayListIdx + 1);
glPopMatrix();
}
public void drawGauge() {
if (invincible) {
if ((cnt % 2) == 1)
A7xScreen.setColor(1, 0.5, 0.5, 1);
else
A7xScreen.setColor(1, 1, 0.5, 1);
} else {
A7xScreen.setColor(1, 1, 1, 1);
}
A7xScreen.drawBoxLine(420, 455, GAUGE_MAX, 20);
A7xScreen.drawBoxLine(420, 455, gauge, 20);
if (invincible) {
if ((cnt % 2) == 1)
A7xScreen.setColor(1, 0.5, 0.5, 0.5);
else
A7xScreen.setColor(1, 1, 0.5, 0.5);
} else {
A7xScreen.setColor(1, 1, 1, 0.5);
}
A7xScreen.drawBoxSolid(420, 455, gauge, 20);
}
public bool checkHit(float x1, float y1, float x2, float y2) {
float b1x, b1y, b2x, b2y;
float d, e, f, dnm;
float x, y;
if (y2 < y1) {
b1y = y2 - SIZE; b2y = y1 + SIZE;
} else {
b1y = y1 - SIZE; b2y = y2 + SIZE;
}
if (a2y >= b1y && b2y >= a1y) {
if (x2 < x1) {
b1x = x2 - SIZE; b2x = x1 + SIZE;
} else {
b1x = x1 - SIZE; b2x = x2 + SIZE;
}
if (a2x >= b1x && b2x >= a1x) {
d = y2 - y1;
e = x1 - x2;
f = x1 * y2 - y1 * x2;
dnm = b * d - a * e;
if (dnm != 0) {
x = (b * f - c * e) / dnm;
y = (c * d - a * f) / dnm;
if (a1x <= x && x <= a2x && a1y <= y && y <= a2y &&
b1x <= x && x <= b2x && b1y <= y && y <= b2y ) {
return true;
}
}
}
}
return false;
}
public void addBlowedForce(Vector p, Vector v, float s) {
if (!blow) return;
float d = atan2(pos.x - p.x, pos.y - p.y);
float wd = d;
if (d < 0)
d += math.PI * 2;
d -= deg;
if (d < -math.PI)
d += math.PI * 2;
else if (d > math.PI)
d -= math.PI * 2;
if (d < 0)
d = -d;
if (d > math.PI / 4)
return;
d *= 2; d++;
float ds = pos.dist(p);
ds += 2;
v.x -= sin(wd) * 10 / d / ds;
v.y -= cos(wd) * 10 / d / ds;
}
// Create display lists.
public static void createDisplayLists() {
displayListIdx = glGenLists(3);
glNewList(displayListIdx, GL_COMPILE);
drawShip(1);
glEndList();
glNewList(displayListIdx + 1, GL_COMPILE);
drawShipLine(1);
glEndList();
glNewList(displayListIdx + 2, GL_COMPILE);
drawShipFireLine(1);
glEndList();
}
public static void deleteDisplayLists() {
glDeleteLists(displayListIdx, 3);
}
private static void drawShip(float alpha) {
glBegin(GL_TRIANGLE_FAN);
A7xScreen.setColor(0.3, 1, 0.2, 0.8 * alpha);
glVertex3f(0, 1, 0);
A7xScreen.setColor(0.2, 0.8, 0.2, 0.6 * alpha);
glVertex3f(-0.8, -1, 0);
A7xScreen.setColor(0.2, 0.8, 0.2, 0.4 * alpha);
glVertex3f(0, -0.8, 0.6);
A7xScreen.setColor(0.2, 0.8, 0.2, 0.6 * alpha);
glVertex3f(0.8, -1, 0);
glEnd();
glBegin(GL_TRIANGLES);
A7xScreen.setColor(0.2, 0.5, 0.8, 0.6 * alpha);
glVertex3f(-0.8, -1, 0);
A7xScreen.setColor(0.2, 0.5, 0.8, 0.9 * alpha);
glVertex3f(-1.2, 0.2, 1);
A7xScreen.setColor(0.2, 0.5, 0.8, 0.4 * alpha);
glVertex3f(0, -0.9, 0.2);
A7xScreen.setColor(0.2, 0.5, 0.8, 0.4 * alpha);
glVertex3f(0, -0.9, 0.2);
A7xScreen.setColor(0.2, 0.5, 0.8, 0.9 * alpha);
glVertex3f(1.2, 0.2, 1);
A7xScreen.setColor(0.2, 0.5, 0.8, 0.6 * alpha);
glVertex3f(0.8, -1, 0);
glEnd();
}
private static void drawShipLine(float alpha) {
glBegin(GL_LINE_STRIP);
A7xScreen.setColor(0.3, 1, 0.2, 1 * alpha);
glVertex3f(-0.8, -1, 0);
glVertex3f(0, 1, 0);
glVertex3f(0.8, -1, 0);
glEnd();
A7xScreen.setColor(0.2, 0.6, 0.8, 1 * alpha);
glBegin(GL_LINE_STRIP);
glVertex3f(-0.8, -1, 0);
glVertex3f(-1.2, 0.2, 1);
glVertex3f(0, -0.9, 0.2);
glEnd();
glBegin(GL_LINE_STRIP);
glVertex3f(0, -0.9, 0.2);
glVertex3f(1.2, 0.2, 1);
glVertex3f(0.8, -1, 0);
glEnd();
}
private static void drawShipFireLine(float alpha) {
glBegin(GL_LINE_STRIP);
A7xScreen.setColor(1, 0, 0, 1 * alpha);
glVertex3f(-0.8, -1, 0);
glVertex3f(0, 1, 0);
glVertex3f(0.8, -1, 0);
glEnd();
glBegin(GL_LINES);
glVertex3f(-0.8, -1, 0);
glVertex3f(0, -0.9, 0.2);
glVertex3f(0, -0.9, 0.2);
glVertex3f(0.8, -1, 0);
glEnd();
}
}
a7xpg/src/abagames/a7xpg/Bonus.d 0000666 0000000 0000000 00000002227 07732713606 015434 0 ustar root root /*
* $Id: Bonus.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
module abagames.a7xpg.Bonus;
import abagames.util.Vector;
import abagames.util.Actor;
import abagames.util.ActorInitializer;
import abagames.a7xpg.LetterRender;
/**
* Bonus score indicators.
*/
public class Bonus: Actor {
private:
Vector pos;
int cnt;
float size;
float my;
int num;
public override Actor newActor() {
return new Bonus;
}
public override void init(ActorInitializer ini) {
pos = new Vector;
}
public void set(int n, Vector p, float s) {
num = n;
int tn = n, dig;
for (dig = 0; tn > 0; dig++)
tn /= 10;
pos.x = p.x - s / 2 * tn; pos.y = p.y;
size = s;
cnt = 32 + s * 24;
my = 0.03 + s * 0.2;
isExist = true;
}
public override void move() {
cnt--;
if (cnt <= 0) {
isExist = false;
return;
}
pos.y += my;
my *= 0.95f;
}
public override void draw() {
LetterRender.drawNumReverse(num, pos.x, pos.y, size);
}
}
public class BonusInitializer: ActorInitializer {
}
a7xpg/build.xml 0000666 0000000 0000000 00000004523 07733302060 012433 0 ustar root root
a7xpg/a7xpg_lowres.bat 0000644 0000000 0000000 00000000015 07732713606 013722 0 ustar root root a7xpg -lowres a7xpg/import/ 0000777 0000000 0000000 00000000000 07733320532 012124 5 ustar root root a7xpg/import/SDL_thread.d 0000666 0000000 0000000 00000003447 07732713606 014261 0 ustar root root /*
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
*/
/* Header for the SDL thread management routines
These are independent of the other SDL routines.
*/
import SDL_types;
import SDL_mutex;
extern(C):
/* The SDL thread structure, defined in SDL_thread.c */
struct SDL_Thread { }
/* Create a thread */
SDL_Thread * SDL_CreateThread(int (*fn)(void *), void *data);
/* Get the 32-bit thread identifier for the current thread */
Uint32 SDL_ThreadID();
/* Get the 32-bit thread identifier for the specified thread,
equivalent to SDL_ThreadID() if the specified thread is NULL.
*/
Uint32 SDL_GetThreadID(SDL_Thread *thread);
/* Wait for a thread to finish.
The return code for the thread function is placed in the area
pointed to by 'status', if 'status' is not NULL.
*/
void SDL_WaitThread(SDL_Thread *thread, int *status);
/* Forcefully kill a thread without worrying about its state */
void SDL_KillThread(SDL_Thread *thread);
a7xpg/import/SDL_active.d 0000666 0000000 0000000 00000003103 07732713606 014252 0 ustar root root /*
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
*/
/* Include file for SDL application focus event handling */
import SDL_types;
extern(C):
/* The available application states */
const uint SDL_APPMOUSEFOCUS = 0x01; /* The app has mouse coverage */
const uint SDL_APPINPUTFOCUS = 0x02; /* The app has input focus */
const uint SDL_APPACTIVE = 0x04; /* The application is active */
/* Function prototypes */
/*
* This function returns the current state of the application, which is a
* bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and
* SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to
* see your application, otherwise it has been iconified or disabled.
*/
Uint8 SDL_GetAppState();
a7xpg/import/SDL.d 0000666 0000000 0000000 00000005715 07732713606 012732 0 ustar root root /*
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
*/
import SDL_types;
import SDL_getenv;
import SDL_error;
import SDL_rwops;
import SDL_timer;
import SDL_audio;
import SDL_cdrom;
import SDL_joystick;
import SDL_events;
import SDL_video;
import SDL_byteorder;
import SDL_version;
extern(C):
/* As of version 0.5, SDL is loaded dynamically into the application */
/* These are the flags which may be passed to SDL_Init() -- you should
specify the subsystems which you will be using in your application.
*/
const uint SDL_INIT_TIMER = 0x00000001;
const uint SDL_INIT_AUDIO = 0x00000010;
const uint SDL_INIT_VIDEO = 0x00000020;
const uint SDL_INIT_CDROM = 0x00000100;
const uint SDL_INIT_JOYSTICK = 0x00000200;
const uint SDL_INIT_NOPARACHUTE = 0x00100000; /* Don't catch fatal signals */
const uint SDL_INIT_EVENTTHREAD = 0x01000000; /* Not supported on all OS's */
const uint SDL_INIT_EVERYTHING = 0x0000FFFF;
/* This function loads the SDL dynamically linked library and initializes
* the subsystems specified by 'flags' (and those satisfying dependencies)
* Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
* signal handlers for some commonly ignored fatal signals (like SIGSEGV)
*/
int SDL_Init(Uint32 flags);
/* This function initializes specific SDL subsystems */
int SDL_InitSubSystem(Uint32 flags);
/* This function cleans up specific SDL subsystems */
void SDL_QuitSubSystem(Uint32 flags);
/* This function returns mask of the specified subsystems which have
been initialized.
If 'flags' is 0, it returns a mask of all initialized subsystems.
*/
Uint32 SDL_WasInit(Uint32 flags);
/* This function cleans up all initialized subsystems and unloads the
* dynamically linked library. You should call it upon all exit conditions.
*/
void SDL_Quit();
void SDL_SetModuleHandle(void *hInst);
extern(Windows) void* GetModuleHandle(char*);
static this()
{
/* Load SDL dynamic link library */
if (SDL_Init(SDL_INIT_NOPARACHUTE) < 0)
throw new Error("Error loading SDL");
SDL_SetModuleHandle(GetModuleHandle(null));
}
static ~this()
{
SDL_Quit();
} a7xpg/import/SDL_rwops.d 0000666 0000000 0000000 00000006553 07732713606 014165 0 ustar root root /*
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 file provides a general interface for SDL to read and write
data sources. It can easily be extended to files, memory, etc.
*/
import SDL_types;
extern(C):
/* This is the read/write operation structure -- very basic */
struct SDL_RWops {
/* Seek to 'offset' relative to whence, one of stdio's whence values:
SEEK_SET, SEEK_CUR, SEEK_END
Returns the final offset in the data source.
*/
int (*seek)(SDL_RWops *context, int offset, int whence);
/* 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.
*/
int (*read)(SDL_RWops *context, void *ptr, int size, int maxnum);
/* 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.
*/
int (*write)(SDL_RWops *context, void *ptr, int size, int num);
/* Close and free an allocated SDL_FSops structure */
int (*close)(SDL_RWops *context);
Uint32 type;
union {
struct {
int autoclose;
void *fp; // was FILE
} // stdio;
struct {
Uint8 *base;
Uint8 *here;
Uint8 *stop;
} // mem;
struct {
void *data1;
} // unknown;
} // hidden;
}
/* Functions to create SDL_RWops structures from various data sources */
SDL_RWops * SDL_RWFromFile(char *file, char *mode);
SDL_RWops * SDL_RWFromFP(void *fp, int autoclose);
SDL_RWops * SDL_RWFromMem(void *mem, int size);
SDL_RWops * SDL_AllocRW();
void SDL_FreeRW(SDL_RWops *area);
/* Macros to easily read and write from an SDL_RWops structure */
int SDL_RWseek(SDL_RWops *ctx, int offset, int whence)
{
int (*seek)(SDL_RWops *context, int offset, int whence);
seek = ctx.seek;
return (*seek)(ctx, offset, whence);
}
int SDL_RWtell(SDL_RWops *ctx)
{
int (*seek)(SDL_RWops *context, int offset, int whence);
seek = ctx.seek;
return (*seek)(ctx, 0, 1);
}
int SDL_RWread(SDL_RWops *ctx, void* ptr, int size, int n)
{
int (*read)(SDL_RWops *context, void *ptr, int size, int maxnum);
read = ctx.read;
return (*read)(ctx, ptr, size, n);
}
int SDL_RWwrite(SDL_RWops *ctx, void* ptr, int size, int n)
{
int (*write)(SDL_RWops *context, void *ptr, int size, int num);
write = ctx.write;
return (*write)(ctx, ptr, size, n);
}
int SDL_RWclose(SDL_RWops *ctx)
{
int (*close)(SDL_RWops *context);
close = ctx.close;
return (*close)(ctx);
}
a7xpg/import/SDL_events.d 0000666 0000000 0000000 00000026211 07732713606 014310 0 ustar root root /*
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
*/
/* Include file for SDL event handling */
import SDL_types;
import SDL_active;
import SDL_keyboard;
import SDL_mouse;
import SDL_joystick;
import SDL_syswm;
extern(C):
/* Event enumerations */
enum { SDL_NOEVENT = 0, /* Unused (do not remove) */
SDL_ACTIVEEVENT, /* Application loses/gains visibility */
SDL_KEYDOWN, /* Keys pressed */
SDL_KEYUP, /* Keys released */
SDL_MOUSEMOTION, /* Mouse moved */
SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */
SDL_MOUSEBUTTONUP, /* Mouse button released */
SDL_JOYAXISMOTION, /* Joystick axis motion */
SDL_JOYBALLMOTION, /* Joystick trackball motion */
SDL_JOYHATMOTION, /* Joystick hat position change */
SDL_JOYBUTTONDOWN, /* Joystick button pressed */
SDL_JOYBUTTONUP, /* Joystick button released */
SDL_QUIT, /* User-requested quit */
SDL_SYSWMEVENT, /* System specific event */
SDL_EVENT_RESERVEDA, /* Reserved for future use.. */
SDL_EVENT_RESERVEDB, /* Reserved for future use.. */
SDL_VIDEORESIZE, /* User resized video mode */
SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */
SDL_EVENT_RESERVED2, /* Reserved for future use.. */
SDL_EVENT_RESERVED3, /* Reserved for future use.. */
SDL_EVENT_RESERVED4, /* Reserved for future use.. */
SDL_EVENT_RESERVED5, /* Reserved for future use.. */
SDL_EVENT_RESERVED6, /* Reserved for future use.. */
SDL_EVENT_RESERVED7, /* Reserved for future use.. */
/* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
SDL_USEREVENT = 24,
/* This last event is only for bounding internal arrays
It is the number of bits in the event mask datatype -- Uint32
*/
SDL_NUMEVENTS = 32
}
/* Predefined event masks */
uint SDL_EVENTMASK(uint X) { return 1 << (X); }
enum {
SDL_ACTIVEEVENTMASK = 1 << SDL_ACTIVEEVENT,
SDL_KEYDOWNMASK = 1 << SDL_KEYDOWN,
SDL_KEYUPMASK = 1 << SDL_KEYUP,
SDL_MOUSEMOTIONMASK = 1 << SDL_MOUSEMOTION,
SDL_MOUSEBUTTONDOWNMASK = 1 << SDL_MOUSEBUTTONDOWN,
SDL_MOUSEBUTTONUPMASK = 1 << SDL_MOUSEBUTTONUP,
SDL_MOUSEEVENTMASK = (1 << SDL_MOUSEMOTION) |
(1 << SDL_MOUSEBUTTONDOWN)|
(1 << SDL_MOUSEBUTTONUP),
SDL_JOYAXISMOTIONMASK = (1 << SDL_JOYAXISMOTION),
SDL_JOYBALLMOTIONMASK = (1 << SDL_JOYBALLMOTION),
SDL_JOYHATMOTIONMASK = (1 << SDL_JOYHATMOTION),
SDL_JOYBUTTONDOWNMASK = (1 << SDL_JOYBUTTONDOWN),
SDL_JOYBUTTONUPMASK = 1 << SDL_JOYBUTTONUP,
SDL_JOYEVENTMASK = (1 << SDL_JOYAXISMOTION)|
(1 << SDL_JOYBALLMOTION)|
(1 << SDL_JOYHATMOTION)|
(1 << SDL_JOYBUTTONDOWN)|
(1 << SDL_JOYBUTTONUP),
SDL_VIDEORESIZEMASK = 1 << SDL_VIDEORESIZE,
SDL_VIDEOEXPOSEMASK = 1 << SDL_VIDEOEXPOSE,
SDL_QUITMASK = 1 << SDL_QUIT,
SDL_SYSWMEVENTMASK = 1 << SDL_SYSWMEVENT
}
const uint SDL_ALLEVENTS = 0xFFFFFFFF;
/* Application visibility event structure */
struct SDL_ActiveEvent {
Uint8 type; /* SDL_ACTIVEEVENT */
Uint8 gain; /* Whether given states were gained or lost (1/0) */
Uint8 state; /* A mask of the focus states */
}
/* Keyboard event structure */
struct SDL_KeyboardEvent {
Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */
Uint8 which; /* The keyboard device index */
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
SDL_keysym keysym;
}
/* Mouse motion event structure */
struct SDL_MouseMotionEvent {
Uint8 type; /* SDL_MOUSEMOTION */
Uint8 which; /* The mouse device index */
Uint8 state; /* The current button state */
Uint16 x, y; /* The X/Y coordinates of the mouse */
Sint16 xrel; /* The relative motion in the X direction */
Sint16 yrel; /* The relative motion in the Y direction */
}
/* Mouse button event structure */
struct SDL_MouseButtonEvent {
Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
Uint8 which; /* The mouse device index */
Uint8 button; /* The mouse button index */
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
Uint16 x, y; /* The X/Y coordinates of the mouse at press time */
}
/* Joystick axis motion event structure */
struct SDL_JoyAxisEvent {
Uint8 type; /* SDL_JOYAXISMOTION */
Uint8 which; /* The joystick device index */
Uint8 axis; /* The joystick axis index */
Sint16 value; /* The axis value (range: -32768 to 32767) */
}
/* Joystick trackball motion event structure */
struct SDL_JoyBallEvent {
Uint8 type; /* SDL_JOYBALLMOTION */
Uint8 which; /* The joystick device index */
Uint8 ball; /* The joystick trackball index */
Sint16 xrel; /* The relative motion in the X direction */
Sint16 yrel; /* The relative motion in the Y direction */
}
/* Joystick hat position change event structure */
struct SDL_JoyHatEvent {
Uint8 type; /* SDL_JOYHATMOTION */
Uint8 which; /* The joystick device index */
Uint8 hat; /* The joystick hat index */
Uint8 value; /* The hat position value:
8 1 2
7 0 3
6 5 4
Note that zero means the POV is centered.
*/
}
/* Joystick button event structure */
struct SDL_JoyButtonEvent {
Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
Uint8 which; /* The joystick device index */
Uint8 button; /* The joystick button index */
Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
}
/* The "window resized" event
When you get this event, you are responsible for setting a new video
mode with the new width and height.
*/
struct SDL_ResizeEvent {
Uint8 type; /* SDL_VIDEORESIZE */
int w; /* New width */
int h; /* New height */
}
/* The "screen redraw" event */
struct SDL_ExposeEvent {
Uint8 type; /* SDL_VIDEOEXPOSE */
}
/* The "quit requested" event */
struct SDL_QuitEvent {
Uint8 type; /* SDL_QUIT */
}
/* A user-defined event type */
struct SDL_UserEvent {
Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */
int code; /* User defined event code */
void *data1; /* User defined data pointer */
void *data2; /* User defined data pointer */
}
/* If you want to use this event, you should include SDL_syswm.h */
struct SDL_SysWMEvent {
Uint8 type;
SDL_SysWMmsg *msg;
}
/* General event structure */
union SDL_Event {
Uint8 type;
SDL_ActiveEvent active;
SDL_KeyboardEvent key;
SDL_MouseMotionEvent motion;
SDL_MouseButtonEvent button;
SDL_JoyAxisEvent jaxis;
SDL_JoyBallEvent jball;
SDL_JoyHatEvent jhat;
SDL_JoyButtonEvent jbutton;
SDL_ResizeEvent resize;
SDL_ExposeEvent expose;
SDL_QuitEvent quit;
SDL_UserEvent user;
SDL_SysWMEvent syswm;
}
/* Function prototypes */
/* Pumps the event loop, gathering events from the input devices.
This function updates the event queue and internal input device state.
This should only be run in the thread that sets the video mode.
*/
void SDL_PumpEvents();
/* Checks the event queue for messages and optionally returns them.
If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
the back of the event queue.
If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
of the event queue, matching 'mask', will be returned and will not
be removed from the queue.
If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
of the event queue, matching 'mask', will be returned and will be
removed from the queue.
This function returns the number of events actually stored, or -1
if there was an error. This function is thread-safe.
*/
alias int SDL_eventaction;
enum {
SDL_ADDEVENT,
SDL_PEEKEVENT,
SDL_GETEVENT
}
/* */
int SDL_PeepEvents(SDL_Event *events, int numevents,
SDL_eventaction action, Uint32 mask);
/* Polls for currently pending events, and returns 1 if there are any pending
events, or 0 if there are none available. If 'event' is not NULL, the next
event is removed from the queue and stored in that area.
*/
int SDL_PollEvent(SDL_Event *event);
/* Waits indefinitely for the next available event, returning 1, or 0 if there
was an error while waiting for events. If 'event' is not NULL, the next
event is removed from the queue and stored in that area.
*/
int SDL_WaitEvent(SDL_Event *event);
/* Add an event to the event queue.
This function returns 0, or -1 if the event couldn't be added to
the event queue. If the event queue is full, this function fails.
*/
int SDL_PushEvent(SDL_Event *event);
/*
This function sets up a filter to process all events before they
change internal state and are posted to the internal event queue.
The filter is protypted as:
*/
alias int (*SDL_EventFilter)(SDL_Event *event);
/*
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
internal state will still be updated. This allows selective filtering of
dynamically arriving events.
WARNING: Be very careful of what you do in the event filter function, as
it may run in a different thread!
There is one caveat when dealing with the SDL_QUITEVENT event type. The
event filter is only called when the window manager desires to close the
application window. If the event filter returns 1, then the window will
be closed, otherwise the window will remain open if possible.
If the quit event is generated by an interrupt signal, it will bypass the
internal queue and be delivered to the application at the next event poll.
*/
void SDL_SetEventFilter(SDL_EventFilter filter);
/*
Return the current event filter - can be used to "chain" filters.
If there is no event filter set, this function returns NULL.
*/
SDL_EventFilter SDL_GetEventFilter();
/*
This function allows you to set the state of processing certain events.
If 'state' is set to SDL_IGNORE, that event will be automatically dropped
from the event queue and will not event be filtered.
If 'state' is set to SDL_ENABLE, that event will be processed normally.
If 'state' is set to SDL_QUERY, SDL_EventState() will return the
current processing state of the specified event.
*/
const uint SDL_QUERY = -1;
const uint SDL_IGNORE = 0;
const uint SDL_DISABLE = 0;
const uint SDL_ENABLE = 1;
Uint8 SDL_EventState(Uint8 type, int state);
a7xpg/import/SDL_syswm.d 0000666 0000000 0000000 00000004352 07732713606 014170 0 ustar root root /*
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
*/
/* Include file for SDL custom system window manager hooks */
import SDL_version;
extern(C):
/* Your application has access to a special type of event 'SDL_SYSWMEVENT',
which contains window-manager specific information and arrives whenever
an unhandled window event occurs. This event is ignored by default, but
you can enable it with SDL_EventState()
*/
//!!!import windows;!!!
alias void* HWND;
alias uint UINT;
alias uint WPARAM;
alias uint LPARAM;
/* The windows custom event structure */
struct SDL_SysWMmsg {
SDL_version _version; // !!! "version" is a D keyword
HWND hwnd; /* The window for the message */
UINT msg; /* The type of message */
WPARAM wParam; /* WORD message parameter */
LPARAM lParam; /* LONG message parameter */
}
/* The windows custom window manager information structure */
struct SDL_SysWMinfo {
SDL_version _version; // !!! "version" is a D keyword
HWND window; /* The Win32 display window */
}
/* Function prototypes */
/*
* This function gives you custom hooks into the window manager information.
* It fills the structure pointed to by 'info' with custom information and
* returns 1 if the function is implemented. If it's not implemented, or
* the version member of the 'info' structure is invalid, it returns 0.
*/
int SDL_GetWMInfo(SDL_SysWMinfo *info);
a7xpg/import/SDL_mixer.d 0000666 0000000 0000000 00000054175 07732713606 014142 0 ustar root root /*
SDL_mixer: An audio mixer library based on the SDL library
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@libsdl.org
*/
// convert to D by shinichiro.h
/* $Id: SDL_mixer.d,v 1.1.1.1 2003/09/19 14:55:49 kenta Exp $ */
import SDL;
extern (C) {
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
*/
const int MIX_MAJOR_VERSION = 1;
const int MIX_MINOR_VERSION = 2;
const int MIX_PATCHLEVEL = 5;
/* This function gets the version of the dynamically linked SDL_mixer library.
it should NOT be used to fill a version structure, instead you should
use the MIX_VERSION() macro.
*/
SDL_version * Mix_Linked_Version();
/* The default mixer has 8 simultaneous mixing channels */
const int MIX_CHANNELS = 8;
/* Good default values for a PC soundcard */
const int MIX_DEFAULT_FREQUENCY = 22050;
version (LittleEndian) {
const int MIX_DEFAULT_FORMAT = AUDIO_S16LSB;
}
version (BigEndian) {
const int MIX_DEFAULT_FORMAT = AUDIO_S16MSB;
}
const int MIX_DEFAULT_CHANNELS = 2;
const int MIX_MAX_VOLUME = 128; /* Volume of a chunk */
/* The internal format for an audio chunk */
struct Mix_Chunk {
int allocated;
Uint8 *abuf;
Uint32 alen;
Uint8 volume; /* Per-sample volume, 0-128 */
}
/* The different fading types supported */
alias int Mix_Fading;
enum {
MIX_NO_FADING,
MIX_FADING_OUT,
MIX_FADING_IN
}
alias int Mix_MusicType;
enum {
MUS_NONE,
MUS_CMD,
MUS_WAV,
MUS_MOD,
MUS_MID,
MUS_OGG,
MUS_MP3
}
/* The internal format for a music chunk interpreted via mikmod */
/* it's mayby enough */
struct Mix_Music {}
/* Open the mixer with a certain audio format */
int Mix_OpenAudio(int frequency, Uint16 format, int channels,
int chunksize);
/* Dynamically change the number of channels managed by the mixer.
If decreasing the number of channels, the upper channels are
stopped.
This function returns the new number of allocated channels.
*/
int Mix_AllocateChannels(int numchans);
/* Find out what the actual audio device parameters are.
This function returns 1 if the audio has been opened, 0 otherwise.
*/
int Mix_QuerySpec(int *frequency,Uint16 *format,int *channels);
/* 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) {
return Mix_LoadWAV_RW(SDL_RWFromFile(file, "rb"), 1);
}
Mix_Music * Mix_LoadMUS(char *file);
/* Load a wave file of the mixer format from a memory buffer */
Mix_Chunk * Mix_QuickLoad_WAV(Uint8 *mem);
/* Load raw audio data of the mixer format from a memory buffer */
Mix_Chunk * Mix_QuickLoad_RAW(Uint8 *mem, Uint32 len);
/* Free an audio chunk previously loaded */
void Mix_FreeChunk(Mix_Chunk *chunk);
void Mix_FreeMusic(Mix_Music *music);
/* Find out the music format of a mixer music, or the currently playing
music, if 'music' is NULL.
*/
Mix_MusicType Mix_GetMusicType(Mix_Music *music);
/* Set a function that is called after all mixing is performed.
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);
/* 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);
/* 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)());
/* Get a pointer to the user data for the current music hook */
void * Mix_GetMusicHookData();
/*
* Add your own callback when a channel has finished playing. NULL
* to disable callback. The callback may be called from the mixer's audio
* callback or it could be called as a result of Mix_HaltChannel(), etc.
* do not call SDL_LockAudio() from this callback; you will either be
* inside the audio callback, or SDL_mixer will explicitly lock the audio
* before calling your callback.
*/
void Mix_ChannelFinished(void (*channel_finished)(int channel));
/* Special Effects API by ryan c. gordon. (icculus@linuxgames.com) */
const int MIX_CHANNEL_POST = -2;
/* This is the format of a special effect callback:
*
* myeffect(int chan, void *stream, int len, void *udata);
*
* (chan) is the channel number that your effect is affecting. (stream) is
* the buffer of data to work upon. (len) is the size of (stream), and
* (udata) is a user-defined bit of data, which you pass as the last arg of
* Mix_RegisterEffect(), and is passed back unmolested to your callback.
* Your effect changes the contents of (stream) based on whatever parameters
* are significant, or just leaves it be, if you prefer. You can do whatever
* you like to the buffer, though, and it will continue in its changed state
* down the mixing pipeline, through any other effect functions, then finally
* to be mixed with the rest of the channels and music for the final output
* stream.
*
* DO NOT EVER call SDL_LockAudio() from your callback function!
*/
typedef void (*Mix_EffectFunc_t)(int chan, void *stream, int len, void *udata);
/*
* This is a callback that signifies that a channel has finished all its
* loops and has completed playback. This gets called if the buffer
* plays out normally, or if you call Mix_HaltChannel(), implicitly stop
* a channel via Mix_AllocateChannels(), or unregister a callback while
* it's still playing.
*
* DO NOT EVER call SDL_LockAudio() from your callback function!
*/
typedef void (*Mix_EffectDone_t)(int chan, void *udata);
/* Register a special effect function. At mixing time, the channel data is
* copied into a buffer and passed through each registered effect function.
* After it passes through all the functions, it is mixed into the final
* output stream. The copy to buffer is performed once, then each effect
* function performs on the output of the previous effect. Understand that
* this extra copy to a buffer is not performed if there are no effects
* registered for a given chunk, which saves CPU cycles, and any given
* effect will be extra cycles, too, so it is crucial that your code run
* fast. Also note that the data that your function is given is in the
* format of the sound device, and not the format you gave to Mix_OpenAudio(),
* although they may in reality be the same. This is an unfortunate but
* necessary speed concern. Use Mix_QuerySpec() to determine if you can
* handle the data before you register your effect, and take appropriate
* actions.
* You may also specify a callback (Mix_EffectDone_t) that is called when
* the channel finishes playing. This gives you a more fine-grained control
* than Mix_ChannelFinished(), in case you need to free effect-specific
* resources, etc. If you don't need this, you can specify NULL.
* You may set the callbacks before or after calling Mix_PlayChannel().
* Things like Mix_SetPanning() are just internal special effect functions,
* so if you are using that, you've already incurred the overhead of a copy
* to a separate buffer, and that these effects will be in the queue with
* any functions you've registered. The list of registered effects for a
* channel is reset when a chunk finishes playing, so you need to explicitly
* set them with each call to Mix_PlayChannel*().
* You may also register a special effect function that is to be run after
* final mixing occurs. The rules for these callbacks are identical to those
* in Mix_RegisterEffect, but they are run after all the channels and the
* music have been mixed into a single stream, whereas channel-specific
* effects run on a given channel before any other mixing occurs. These
* global effect callbacks are call "posteffects". Posteffects only have
* their Mix_EffectDone_t function called when they are unregistered (since
* the main output stream is never "done" in the same sense as a channel).
* You must unregister them manually when you've had enough. Your callback
* will be told that the channel being mixed is (MIX_CHANNEL_POST) if the
* processing is considered a posteffect.
*
* After all these effects have finished processing, the callback registered
* through Mix_SetPostMix() runs, and then the stream goes to the audio
* device.
*
* DO NOT EVER call SDL_LockAudio() from your callback function!
*
* returns zero if error (no such channel), nonzero if added.
* Error messages can be retrieved from Mix_GetError().
*/
int Mix_RegisterEffect(int chan, Mix_EffectFunc_t f,
Mix_EffectDone_t d, void *arg);
/* You may not need to call this explicitly, unless you need to stop an
* effect from processing in the middle of a chunk's playback.
* Posteffects are never implicitly unregistered as they are for channels,
* but they may be explicitly unregistered through this function by
* specifying MIX_CHANNEL_POST for a channel.
* returns zero if error (no such channel or effect), nonzero if removed.
* Error messages can be retrieved from Mix_GetError().
*/
int Mix_UnregisterEffect(int channel, Mix_EffectFunc_t f);
/* You may not need to call this explicitly, unless you need to stop all
* effects from processing in the middle of a chunk's playback. Note that
* this will also shut off some internal effect processing, since
* Mix_SetPanning() and others may use this API under the hood. This is
* called internally when a channel completes playback.
* Posteffects are never implicitly unregistered as they are for channels,
* but they may be explicitly unregistered through this function by
* specifying MIX_CHANNEL_POST for a channel.
* returns zero if error (no such channel), nonzero if all effects removed.
* Error messages can be retrieved from Mix_GetError().
*/
int Mix_UnregisterAllEffects(int channel);
const char[] MIX_EFFECTSMAXSPEED = "MIX_EFFECTSMAXSPEED";
/*
* These are the internally-defined mixing effects. They use the same API that
* effects defined in the application use, but are provided here as a
* convenience. Some effects can reduce their quality or use more memory in
* the name of speed; to enable this, make sure the environment variable
* MIX_EFFECTSMAXSPEED (see above) is defined before you call
* Mix_OpenAudio().
*/
/* Set the panning of a channel. The left and right channels are specified
* as integers between 0 and 255, quietest to loudest, respectively.
*
* Technically, this is just individual volume control for a sample with
* two (stereo) channels, so it can be used for more than just panning.
* If you want real panning, call it like this:
*
* Mix_SetPanning(channel, left, 255 - left);
*
* ...which isn't so hard.
*
* Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and
* the panning will be done to the final mixed stream before passing it on
* to the audio device.
*
* This uses the Mix_RegisterEffect() API internally, and returns without
* registering the effect function if the audio device is not configured
* for stereo output. Setting both (left) and (right) to 255 causes this
* effect to be unregistered, since that is the data's normal state.
*
* returns zero if error (no such channel or Mix_RegisterEffect() fails),
* nonzero if panning effect enabled. Note that an audio device in mono
* mode is a no-op, but this call will return successful in that case.
* Error messages can be retrieved from Mix_GetError().
*/
int Mix_SetPanning(int channel, Uint8 left, Uint8 right);
/* Set the position of a channel. (angle) is an integer from 0 to 360, that
* specifies the location of the sound in relation to the listener. (angle)
* will be reduced as neccesary (540 becomes 180 degrees, -100 becomes 260).
* Angle 0 is due north, and rotates clockwise as the value increases.
* For efficiency, the precision of this effect may be limited (angles 1
* through 7 might all produce the same effect, 8 through 15 are equal, etc).
* (distance) is an integer between 0 and 255 that specifies the space
* between the sound and the listener. The larger the number, the further
* away the sound is. Using 255 does not guarantee that the channel will be
* culled from the mixing process or be completely silent. For efficiency,
* the precision of this effect may be limited (distance 0 through 5 might
* all produce the same effect, 6 through 10 are equal, etc). Setting (angle)
* and (distance) to 0 unregisters this effect, since the data would be
* unchanged.
*
* If you need more precise positional audio, consider using OpenAL for
* spatialized effects instead of SDL_mixer. This is only meant to be a
* basic effect for simple "3D" games.
*
* If the audio device is configured for mono output, then you won't get
* any effectiveness from the angle; however, distance attenuation on the
* channel will still occur. While this effect will function with stereo
* voices, it makes more sense to use voices with only one channel of sound,
* so when they are mixed through this effect, the positioning will sound
* correct. You can convert them to mono through SDL before giving them to
* the mixer in the first place if you like.
*
* Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and
* the positioning will be done to the final mixed stream before passing it
* on to the audio device.
*
* This is a convenience wrapper over Mix_SetDistance() and Mix_SetPanning().
*
* returns zero if error (no such channel or Mix_RegisterEffect() fails),
* nonzero if position effect is enabled.
* Error messages can be retrieved from Mix_GetError().
*/
int Mix_SetPosition(int channel, Sint16 angle, Uint8 distance);
/* Set the "distance" of a channel. (distance) is an integer from 0 to 255
* that specifies the location of the sound in relation to the listener.
* Distance 0 is overlapping the listener, and 255 is as far away as possible
* A distance of 255 does not guarantee silence; in such a case, you might
* want to try changing the chunk's volume, or just cull the sample from the
* mixing process with Mix_HaltChannel().
* For efficiency, the precision of this effect may be limited (distances 1
* through 7 might all produce the same effect, 8 through 15 are equal, etc).
* (distance) is an integer between 0 and 255 that specifies the space
* between the sound and the listener. The larger the number, the further
* away the sound is.
* Setting (distance) to 0 unregisters this effect, since the data would be
* unchanged.
* If you need more precise positional audio, consider using OpenAL for
* spatialized effects instead of SDL_mixer. This is only meant to be a
* basic effect for simple "3D" games.
*
* Setting (channel) to MIX_CHANNEL_POST registers this as a posteffect, and
* the distance attenuation will be done to the final mixed stream before
* passing it on to the audio device.
*
* This uses the Mix_RegisterEffect() API internally.
*
* returns zero if error (no such channel or Mix_RegisterEffect() fails),
* nonzero if position effect is enabled.
* Error messages can be retrieved from Mix_GetError().
*/
int Mix_SetDistance(int channel, Uint8 distance);
/* Causes a channel to reverse its stereo. This is handy if the user has his
* speakers hooked up backwards, or you would like to have a minor bit of
* psychedelia in your sound code. :) Calling this function with (flip)
* set to non-zero reverses the chunks's usual channels. If (flip) is zero,
* the effect is unregistered.
*
* This uses the Mix_RegisterEffect() API internally, and thus is probably
* more CPU intensive than having the user just plug in his speakers
* correctly. Mix_SetReverseStereo() returns without registering the effect
* function if the audio device is not configured for stereo output.
*
* If you specify MIX_CHANNEL_POST for (channel), then this the effect is used
* on the final mixed stream before sending it on to the audio device (a
* posteffect).
*
* returns zero if error (no such channel or Mix_RegisterEffect() fails),
* nonzero if reversing effect is enabled. Note that an audio device in mono
* mode is a no-op, but this call will return successful in that case.
* Error messages can be retrieved from Mix_GetError().
*/
int Mix_SetReverseStereo(int channel, int flip);
/* end of effects API. --ryan. */
/* Reserve the first channels (0 -> n-1) for the application, i.e. don't allocate
them dynamically to the next sample if requested with a -1 value below.
Returns the number of reserved channels.
*/
int Mix_ReserveChannels(int num);
/* Channel grouping functions */
/* Attach a tag to a channel. A tag can be assigned to several mixer
channels, to form groups of channels.
If 'tag' is -1, the tag is removed (actually -1 is the tag used to
represent the group of all the channels).
Returns true if everything was OK.
*/
int Mix_GroupChannel(int which, int tag);
/* Assign several consecutive channels to a group */
int Mix_GroupChannels(int from, int to, int tag);
/* Finds the first available channel in a group of channels,
returning -1 if none are available.
*/
int Mix_GroupAvailable(int tag);
/* Returns the number of channels in a group. This is also a subtle
way to get the total number of channels when 'tag' is -1
*/
int Mix_GroupCount(int tag);
/* Finds the "oldest" sample playing in a group of channels */
int Mix_GroupOldest(int tag);
/* Finds the "most recent" (i.e. last) sample playing in a group of channels */
int Mix_GroupNewer(int tag);
/* The same as above, but the sound is played at most 'ticks' milliseconds */
int Mix_PlayChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ticks);
/* Play an audio chunk on a specific channel.
If the specified channel is -1, play on the first free channel.
If 'loops' is greater than zero, loop the sound that many times.
If 'loops' is -1, loop inifinitely (~65000 times).
Returns which channel was used to play the sound.
*/
int Mix_PlayChannel(int channel, Mix_Chunk* chunk, int loops) {
return Mix_PlayChannelTimed(channel,chunk,loops,-1);
}
int Mix_PlayMusic(Mix_Music *music, int loops);
/* Fade in music or a channel over "ms" milliseconds, same semantics as the "Play" functions */
int Mix_FadeInMusic(Mix_Music *music, int loops, int ms);
int Mix_FadeInMusicPos(Mix_Music *music, int loops, int ms, double position);
int Mix_FadeInChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ms, int ticks);
int Mix_FadeInChannel(int channel, Mix_Chunk* chunk, int loops, int ms) {
return Mix_FadeInChannelTimed(channel,chunk,loops,ms,-1);
}
/* Set the volume in the range of 0-128 of a specific channel or chunk.
If the specified channel is -1, set volume for all channels.
Returns the original volume.
If the specified volume is -1, just return the current volume.
*/
int Mix_Volume(int channel, int volume);
int Mix_VolumeChunk(Mix_Chunk *chunk, int volume);
int Mix_VolumeMusic(int volume);
/* Halt playing of a particular channel */
int Mix_HaltChannel(int channel);
int Mix_HaltGroup(int tag);
int Mix_HaltMusic();
/* Change the expiration delay for a particular channel.
The sample will stop playing after the 'ticks' milliseconds have elapsed,
or remove the expiration if 'ticks' is -1
*/
int Mix_ExpireChannel(int channel, int ticks);
/* Halt a channel, fading it out progressively till it's silent
The ms parameter indicates the number of milliseconds the fading
will take.
*/
int Mix_FadeOutChannel(int which, int ms);
int Mix_FadeOutGroup(int tag, int ms);
int Mix_FadeOutMusic(int ms);
/* Query the fading status of a channel */
Mix_Fading Mix_FadingMusic();
Mix_Fading Mix_FadingChannel(int which);
/* Pause/Resume a particular channel */
void Mix_Pause(int channel);
void Mix_Resume(int channel);
int Mix_Paused(int channel);
/* Pause/Resume the music stream */
void Mix_PauseMusic();
void Mix_ResumeMusic();
void Mix_RewindMusic();
int Mix_PausedMusic();
/* Set the current position in the music stream.
This returns 0 if successful, or -1 if it failed or isn't implemented.
This function is only implemented for MOD music formats (set pattern
order number) and for OGG music (set position in seconds), at the
moment.
*/
int Mix_SetMusicPosition(double position);
/* Check the status of a specific channel.
If the specified channel is -1, check all channels.
*/
int Mix_Playing(int channel);
int Mix_PlayingMusic();
/* Stop music and set external music playback command */
int Mix_SetMusicCMD(char *command);
/* Synchro value is set by MikMod from modules while playing */
int Mix_SetSynchroValue(int value);
int Mix_GetSynchroValue();
/* Get the Mix_Chunk currently associated with a mixer channel
Returns NULL if it's an invalid channel, or there's no chunk associated.
*/
Mix_Chunk * Mix_GetChunk(int channel);
/* Close the mixer, halting all playing audio */
void Mix_CloseAudio();
/* We'll use SDL for reporting errors */
// void Mix_SetError SDL_SetError
char * Mix_GetError() {
return SDL_GetError();
}
}
/* end of SDL_mixer.h ... */
a7xpg/import/opengl.d 0000666 0000000 0000000 00000212650 07732713606 013572 0 ustar root root import windows;
extern(Windows):
alias uint GLenum;
alias ubyte GLboolean;
alias uint GLbitfield;
alias byte GLbyte;
alias short GLshort;
alias int GLint;
alias int GLsizei;
alias ubyte GLubyte;
alias ushort GLushort;
alias uint GLuint;
alias float GLfloat;
alias float GLclampf;
alias double GLdouble;
alias double GLclampd;
alias void GLvoid;
/*************************************************************/
/* Version */
const uint GL_VERSION_1_1 = 1;
/* AccumOp */
const uint GL_ACCUM = 0x0100;
const uint GL_LOAD = 0x0101;
const uint GL_RETURN = 0x0102;
const uint GL_MULT = 0x0103;
const uint GL_ADD = 0x0104;
/* AlphaFunction */
const uint GL_NEVER = 0x0200;
const uint GL_LESS = 0x0201;
const uint GL_EQUAL = 0x0202;
const uint GL_LEQUAL = 0x0203;
const uint GL_GREATER = 0x0204;
const uint GL_NOTEQUAL = 0x0205;
const uint GL_GEQUAL = 0x0206;
const uint GL_ALWAYS = 0x0207;
/* AttribMask */
const uint GL_CURRENT_BIT = 0x00000001;
const uint GL_POINT_BIT = 0x00000002;
const uint GL_LINE_BIT = 0x00000004;
const uint GL_POLYGON_BIT = 0x00000008;
const uint GL_POLYGON_STIPPLE_BIT = 0x00000010;
const uint GL_PIXEL_MODE_BIT = 0x00000020;
const uint GL_LIGHTING_BIT = 0x00000040;
const uint GL_FOG_BIT = 0x00000080;
const uint GL_DEPTH_BUFFER_BIT = 0x00000100;
const uint GL_ACCUM_BUFFER_BIT = 0x00000200;
const uint GL_STENCIL_BUFFER_BIT = 0x00000400;
const uint GL_VIEWPORT_BIT = 0x00000800;
const uint GL_TRANSFORM_BIT = 0x00001000;
const uint GL_ENABLE_BIT = 0x00002000;
const uint GL_COLOR_BUFFER_BIT = 0x00004000;
const uint GL_HINT_BIT = 0x00008000;
const uint GL_EVAL_BIT = 0x00010000;
const uint GL_LIST_BIT = 0x00020000;
const uint GL_TEXTURE_BIT = 0x00040000;
const uint GL_SCISSOR_BIT = 0x00080000;
const uint GL_ALL_ATTRIB_BITS = 0x000fffff;
/* BeginMode */
const uint GL_POINTS = 0x0000;
const uint GL_LINES = 0x0001;
const uint GL_LINE_LOOP = 0x0002;
const uint GL_LINE_STRIP = 0x0003;
const uint GL_TRIANGLES = 0x0004;
const uint GL_TRIANGLE_STRIP = 0x0005;
const uint GL_TRIANGLE_FAN = 0x0006;
const uint GL_QUADS = 0x0007;
const uint GL_QUAD_STRIP = 0x0008;
const uint GL_POLYGON = 0x0009;
/* BlendingFactorDest */
const uint GL_ZERO = 0;
const uint GL_ONE = 1;
const uint GL_SRC_COLOR = 0x0300;
const uint GL_ONE_MINUS_SRC_COLOR = 0x0301;
const uint GL_SRC_ALPHA = 0x0302;
const uint GL_ONE_MINUS_SRC_ALPHA = 0x0303;
const uint GL_DST_ALPHA = 0x0304;
const uint GL_ONE_MINUS_DST_ALPHA = 0x0305;
/* BlendingFactorSrc */
/* GL_ZERO */
/* GL_ONE */
const uint GL_DST_COLOR = 0x0306;
const uint GL_ONE_MINUS_DST_COLOR = 0x0307;
const uint GL_SRC_ALPHA_SATURATE = 0x0308;
/* GL_SRC_ALPHA */
/* GL_ONE_MINUS_SRC_ALPHA */
/* GL_DST_ALPHA */
/* GL_ONE_MINUS_DST_ALPHA */
/* Boolean */
const uint GL_TRUE = 1;
const uint GL_FALSE = 0;
/* ClearBufferMask */
/* GL_COLOR_BUFFER_BIT */
/* GL_ACCUM_BUFFER_BIT */
/* GL_STENCIL_BUFFER_BIT */
/* GL_DEPTH_BUFFER_BIT */
/* ClientArrayType */
/* GL_VERTEX_ARRAY */
/* GL_NORMAL_ARRAY */
/* GL_COLOR_ARRAY */
/* GL_INDEX_ARRAY */
/* GL_TEXTURE_COORD_ARRAY */
/* GL_EDGE_FLAG_ARRAY */
/* ClipPlaneName */
const uint GL_CLIP_PLANE0 = 0x3000;
const uint GL_CLIP_PLANE1 = 0x3001;
const uint GL_CLIP_PLANE2 = 0x3002;
const uint GL_CLIP_PLANE3 = 0x3003;
const uint GL_CLIP_PLANE4 = 0x3004;
const uint GL_CLIP_PLANE5 = 0x3005;
/* ColorMaterialFace */
/* GL_FRONT */
/* GL_BACK */
/* GL_FRONT_AND_BACK */
/* ColorMaterialParameter */
/* GL_AMBIENT */
/* GL_DIFFUSE */
/* GL_SPECULAR */
/* GL_EMISSION */
/* GL_AMBIENT_AND_DIFFUSE */
/* ColorPointerType */
/* GL_BYTE */
/* GL_UNSIGNED_BYTE */
/* GL_SHORT */
/* GL_UNSIGNED_SHORT */
/* GL_INT */
/* GL_UNSIGNED_INT */
/* GL_FLOAT */
/* GL_DOUBLE */
/* CullFaceMode */
/* GL_FRONT */
/* GL_BACK */
/* GL_FRONT_AND_BACK */
/* DataType */
const uint GL_BYTE = 0x1400;
const uint GL_UNSIGNED_BYTE = 0x1401;
const uint GL_SHORT = 0x1402;
const uint GL_UNSIGNED_SHORT = 0x1403;
const uint GL_INT = 0x1404;
const uint GL_UNSIGNED_INT = 0x1405;
const uint GL_FLOAT = 0x1406;
const uint GL_2_BYTES = 0x1407;
const uint GL_3_BYTES = 0x1408;
const uint GL_4_BYTES = 0x1409;
const uint GL_DOUBLE = 0x140A;
/* DepthFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* DrawBufferMode */
const uint GL_NONE = 0;
const uint GL_FRONT_LEFT = 0x0400;
const uint GL_FRONT_RIGHT = 0x0401;
const uint GL_BACK_LEFT = 0x0402;
const uint GL_BACK_RIGHT = 0x0403;
const uint GL_FRONT = 0x0404;
const uint GL_BACK = 0x0405;
const uint GL_LEFT = 0x0406;
const uint GL_RIGHT = 0x0407;
const uint GL_FRONT_AND_BACK = 0x0408;
const uint GL_AUX0 = 0x0409;
const uint GL_AUX1 = 0x040A;
const uint GL_AUX2 = 0x040B;
const uint GL_AUX3 = 0x040C;
/* Enable */
/* GL_FOG */
/* GL_LIGHTING */
/* GL_TEXTURE_1D */
/* GL_TEXTURE_2D */
/* GL_LINE_STIPPLE */
/* GL_POLYGON_STIPPLE */
/* GL_CULL_FACE */
/* GL_ALPHA_TEST */
/* GL_BLEND */
/* GL_INDEX_LOGIC_OP */
/* GL_COLOR_LOGIC_OP */
/* GL_DITHER */
/* GL_STENCIL_TEST */
/* GL_DEPTH_TEST */
/* GL_CLIP_PLANE0 */
/* GL_CLIP_PLANE1 */
/* GL_CLIP_PLANE2 */
/* GL_CLIP_PLANE3 */
/* GL_CLIP_PLANE4 */
/* GL_CLIP_PLANE5 */
/* GL_LIGHT0 */
/* GL_LIGHT1 */
/* GL_LIGHT2 */
/* GL_LIGHT3 */
/* GL_LIGHT4 */
/* GL_LIGHT5 */
/* GL_LIGHT6 */
/* GL_LIGHT7 */
/* GL_TEXTURE_GEN_S */
/* GL_TEXTURE_GEN_T */
/* GL_TEXTURE_GEN_R */
/* GL_TEXTURE_GEN_Q */
/* GL_MAP1_VERTEX_3 */
/* GL_MAP1_VERTEX_4 */
/* GL_MAP1_COLOR_4 */
/* GL_MAP1_INDEX */
/* GL_MAP1_NORMAL */
/* GL_MAP1_TEXTURE_COORD_1 */
/* GL_MAP1_TEXTURE_COORD_2 */
/* GL_MAP1_TEXTURE_COORD_3 */
/* GL_MAP1_TEXTURE_COORD_4 */
/* GL_MAP2_VERTEX_3 */
/* GL_MAP2_VERTEX_4 */
/* GL_MAP2_COLOR_4 */
/* GL_MAP2_INDEX */
/* GL_MAP2_NORMAL */
/* GL_MAP2_TEXTURE_COORD_1 */
/* GL_MAP2_TEXTURE_COORD_2 */
/* GL_MAP2_TEXTURE_COORD_3 */
/* GL_MAP2_TEXTURE_COORD_4 */
/* GL_POINT_SMOOTH */
/* GL_LINE_SMOOTH */
/* GL_POLYGON_SMOOTH */
/* GL_SCISSOR_TEST */
/* GL_COLOR_MATERIAL */
/* GL_NORMALIZE */
/* GL_AUTO_NORMAL */
/* GL_VERTEX_ARRAY */
/* GL_NORMAL_ARRAY */
/* GL_COLOR_ARRAY */
/* GL_INDEX_ARRAY */
/* GL_TEXTURE_COORD_ARRAY */
/* GL_EDGE_FLAG_ARRAY */
/* GL_POLYGON_OFFSET_POINT */
/* GL_POLYGON_OFFSET_LINE */
/* GL_POLYGON_OFFSET_FILL */
/* ErrorCode */
const uint GL_NO_ERROR = 0;
const uint GL_INVALID_ENUM = 0x0500;
const uint GL_INVALID_VALUE = 0x0501;
const uint GL_INVALID_OPERATION = 0x0502;
const uint GL_STACK_OVERFLOW = 0x0503;
const uint GL_STACK_UNDERFLOW = 0x0504;
const uint GL_OUT_OF_MEMORY = 0x0505;
/* FeedBackMode */
const uint GL_2D = 0x0600;
const uint GL_3D = 0x0601;
const uint GL_3D_COLOR = 0x0602;
const uint GL_3D_COLOR_TEXTURE = 0x0603;
const uint GL_4D_COLOR_TEXTURE = 0x0604;
/* FeedBackToken */
const uint GL_PASS_THROUGH_TOKEN = 0x0700;
const uint GL_POINT_TOKEN = 0x0701;
const uint GL_LINE_TOKEN = 0x0702;
const uint GL_POLYGON_TOKEN = 0x0703;
const uint GL_BITMAP_TOKEN = 0x0704;
const uint GL_DRAW_PIXEL_TOKEN = 0x0705;
const uint GL_COPY_PIXEL_TOKEN = 0x0706;
const uint GL_LINE_RESET_TOKEN = 0x0707;
/* FogMode */
/* GL_LINEAR */
const uint GL_EXP = 0x0800;
const uint GL_EXP2 = 0x0801;
/* FogParameter */
/* GL_FOG_COLOR */
/* GL_FOG_DENSITY */
/* GL_FOG_END */
/* GL_FOG_INDEX */
/* GL_FOG_MODE */
/* GL_FOG_START */
/* FrontFaceDirection */
const uint GL_CW = 0x0900;
const uint GL_CCW = 0x0901;
/* GetMapTarget */
const uint GL_COEFF = 0x0A00;
const uint GL_ORDER = 0x0A01;
const uint GL_DOMAIN = 0x0A02;
/* GetPixelMap */
/* GL_PIXEL_MAP_I_TO_I */
/* GL_PIXEL_MAP_S_TO_S */
/* GL_PIXEL_MAP_I_TO_R */
/* GL_PIXEL_MAP_I_TO_G */
/* GL_PIXEL_MAP_I_TO_B */
/* GL_PIXEL_MAP_I_TO_A */
/* GL_PIXEL_MAP_R_TO_R */
/* GL_PIXEL_MAP_G_TO_G */
/* GL_PIXEL_MAP_B_TO_B */
/* GL_PIXEL_MAP_A_TO_A */
/* GetPointerTarget */
/* GL_VERTEX_ARRAY_POINTER */
/* GL_NORMAL_ARRAY_POINTER */
/* GL_COLOR_ARRAY_POINTER */
/* GL_INDEX_ARRAY_POINTER */
/* GL_TEXTURE_COORD_ARRAY_POINTER */
/* GL_EDGE_FLAG_ARRAY_POINTER */
/* GetTarget */
const uint GL_CURRENT_COLOR = 0x0B00;
const uint GL_CURRENT_INDEX = 0x0B01;
const uint GL_CURRENT_NORMAL = 0x0B02;
const uint GL_CURRENT_TEXTURE_COORDS = 0x0B03;
const uint GL_CURRENT_RASTER_COLOR = 0x0B04;
const uint GL_CURRENT_RASTER_INDEX = 0x0B05;
const uint GL_CURRENT_RASTER_TEXTURE_COORDS = 0x0B06;
const uint GL_CURRENT_RASTER_POSITION = 0x0B07;
const uint GL_CURRENT_RASTER_POSITION_VALID = 0x0B08;
const uint GL_CURRENT_RASTER_DISTANCE = 0x0B09;
const uint GL_POINT_SMOOTH = 0x0B10;
const uint GL_POINT_SIZE = 0x0B11;
const uint GL_POINT_SIZE_RANGE = 0x0B12;
const uint GL_POINT_SIZE_GRANULARITY = 0x0B13;
const uint GL_LINE_SMOOTH = 0x0B20;
const uint GL_LINE_WIDTH = 0x0B21;
const uint GL_LINE_WIDTH_RANGE = 0x0B22;
const uint GL_LINE_WIDTH_GRANULARITY = 0x0B23;
const uint GL_LINE_STIPPLE = 0x0B24;
const uint GL_LINE_STIPPLE_PATTERN = 0x0B25;
const uint GL_LINE_STIPPLE_REPEAT = 0x0B26;
const uint GL_LIST_MODE = 0x0B30;
const uint GL_MAX_LIST_NESTING = 0x0B31;
const uint GL_LIST_BASE = 0x0B32;
const uint GL_LIST_INDEX = 0x0B33;
const uint GL_POLYGON_MODE = 0x0B40;
const uint GL_POLYGON_SMOOTH = 0x0B41;
const uint GL_POLYGON_STIPPLE = 0x0B42;
const uint GL_EDGE_FLAG = 0x0B43;
const uint GL_CULL_FACE = 0x0B44;
const uint GL_CULL_FACE_MODE = 0x0B45;
const uint GL_FRONT_FACE = 0x0B46;
const uint GL_LIGHTING = 0x0B50;
const uint GL_LIGHT_MODEL_LOCAL_VIEWER = 0x0B51;
const uint GL_LIGHT_MODEL_TWO_SIDE = 0x0B52;
const uint GL_LIGHT_MODEL_AMBIENT = 0x0B53;
const uint GL_SHADE_MODEL = 0x0B54;
const uint GL_COLOR_MATERIAL_FACE = 0x0B55;
const uint GL_COLOR_MATERIAL_PARAMETER = 0x0B56;
const uint GL_COLOR_MATERIAL = 0x0B57;
const uint GL_FOG = 0x0B60;
const uint GL_FOG_INDEX = 0x0B61;
const uint GL_FOG_DENSITY = 0x0B62;
const uint GL_FOG_START = 0x0B63;
const uint GL_FOG_END = 0x0B64;
const uint GL_FOG_MODE = 0x0B65;
const uint GL_FOG_COLOR = 0x0B66;
const uint GL_DEPTH_RANGE = 0x0B70;
const uint GL_DEPTH_TEST = 0x0B71;
const uint GL_DEPTH_WRITEMASK = 0x0B72;
const uint GL_DEPTH_CLEAR_VALUE = 0x0B73;
const uint GL_DEPTH_FUNC = 0x0B74;
const uint GL_ACCUM_CLEAR_VALUE = 0x0B80;
const uint GL_STENCIL_TEST = 0x0B90;
const uint GL_STENCIL_CLEAR_VALUE = 0x0B91;
const uint GL_STENCIL_FUNC = 0x0B92;
const uint GL_STENCIL_VALUE_MASK = 0x0B93;
const uint GL_STENCIL_FAIL = 0x0B94;
const uint GL_STENCIL_PASS_DEPTH_FAIL = 0x0B95;
const uint GL_STENCIL_PASS_DEPTH_PASS = 0x0B96;
const uint GL_STENCIL_REF = 0x0B97;
const uint GL_STENCIL_WRITEMASK = 0x0B98;
const uint GL_MATRIX_MODE = 0x0BA0;
const uint GL_NORMALIZE = 0x0BA1;
const uint GL_VIEWPORT = 0x0BA2;
const uint GL_MODELVIEW_STACK_DEPTH = 0x0BA3;
const uint GL_PROJECTION_STACK_DEPTH = 0x0BA4;
const uint GL_TEXTURE_STACK_DEPTH = 0x0BA5;
const uint GL_MODELVIEW_MATRIX = 0x0BA6;
const uint GL_PROJECTION_MATRIX = 0x0BA7;
const uint GL_TEXTURE_MATRIX = 0x0BA8;
const uint GL_ATTRIB_STACK_DEPTH = 0x0BB0;
const uint GL_CLIENT_ATTRIB_STACK_DEPTH = 0x0BB1;
const uint GL_ALPHA_TEST = 0x0BC0;
const uint GL_ALPHA_TEST_FUNC = 0x0BC1;
const uint GL_ALPHA_TEST_REF = 0x0BC2;
const uint GL_DITHER = 0x0BD0;
const uint GL_BLEND_DST = 0x0BE0;
const uint GL_BLEND_SRC = 0x0BE1;
const uint GL_BLEND = 0x0BE2;
const uint GL_LOGIC_OP_MODE = 0x0BF0;
const uint GL_INDEX_LOGIC_OP = 0x0BF1;
const uint GL_COLOR_LOGIC_OP = 0x0BF2;
const uint GL_AUX_BUFFERS = 0x0C00;
const uint GL_DRAW_BUFFER = 0x0C01;
const uint GL_READ_BUFFER = 0x0C02;
const uint GL_SCISSOR_BOX = 0x0C10;
const uint GL_SCISSOR_TEST = 0x0C11;
const uint GL_INDEX_CLEAR_VALUE = 0x0C20;
const uint GL_INDEX_WRITEMASK = 0x0C21;
const uint GL_COLOR_CLEAR_VALUE = 0x0C22;
const uint GL_COLOR_WRITEMASK = 0x0C23;
const uint GL_INDEX_MODE = 0x0C30;
const uint GL_RGBA_MODE = 0x0C31;
const uint GL_DOUBLEBUFFER = 0x0C32;
const uint GL_STEREO = 0x0C33;
const uint GL_RENDER_MODE = 0x0C40;
const uint GL_PERSPECTIVE_CORRECTION_HINT= 0x0C50;
const uint GL_POINT_SMOOTH_HINT = 0x0C51;
const uint GL_LINE_SMOOTH_HINT = 0x0C52;
const uint GL_POLYGON_SMOOTH_HINT = 0x0C53;
const uint GL_FOG_HINT = 0x0C54;
const uint GL_TEXTURE_GEN_S = 0x0C60;
const uint GL_TEXTURE_GEN_T = 0x0C61;
const uint GL_TEXTURE_GEN_R = 0x0C62;
const uint GL_TEXTURE_GEN_Q = 0x0C63;
const uint GL_PIXEL_MAP_I_TO_I = 0x0C70;
const uint GL_PIXEL_MAP_S_TO_S = 0x0C71;
const uint GL_PIXEL_MAP_I_TO_R = 0x0C72;
const uint GL_PIXEL_MAP_I_TO_G = 0x0C73;
const uint GL_PIXEL_MAP_I_TO_B = 0x0C74;
const uint GL_PIXEL_MAP_I_TO_A = 0x0C75;
const uint GL_PIXEL_MAP_R_TO_R = 0x0C76;
const uint GL_PIXEL_MAP_G_TO_G = 0x0C77;
const uint GL_PIXEL_MAP_B_TO_B = 0x0C78;
const uint GL_PIXEL_MAP_A_TO_A = 0x0C79;
const uint GL_PIXEL_MAP_I_TO_I_SIZE = 0x0CB0;
const uint GL_PIXEL_MAP_S_TO_S_SIZE = 0x0CB1;
const uint GL_PIXEL_MAP_I_TO_R_SIZE = 0x0CB2;
const uint GL_PIXEL_MAP_I_TO_G_SIZE = 0x0CB3;
const uint GL_PIXEL_MAP_I_TO_B_SIZE = 0x0CB4;
const uint GL_PIXEL_MAP_I_TO_A_SIZE = 0x0CB5;
const uint GL_PIXEL_MAP_R_TO_R_SIZE = 0x0CB6;
const uint GL_PIXEL_MAP_G_TO_G_SIZE = 0x0CB7;
const uint GL_PIXEL_MAP_B_TO_B_SIZE = 0x0CB8;
const uint GL_PIXEL_MAP_A_TO_A_SIZE = 0x0CB9;
const uint GL_UNPACK_SWAP_BYTES = 0x0CF0;
const uint GL_UNPACK_LSB_FIRST = 0x0CF1;
const uint GL_UNPACK_ROW_LENGTH = 0x0CF2;
const uint GL_UNPACK_SKIP_ROWS = 0x0CF3;
const uint GL_UNPACK_SKIP_PIXELS = 0x0CF4;
const uint GL_UNPACK_ALIGNMENT = 0x0CF5;
const uint GL_PACK_SWAP_BYTES = 0x0D00;
const uint GL_PACK_LSB_FIRST = 0x0D01;
const uint GL_PACK_ROW_LENGTH = 0x0D02;
const uint GL_PACK_SKIP_ROWS = 0x0D03;
const uint GL_PACK_SKIP_PIXELS = 0x0D04;
const uint GL_PACK_ALIGNMENT = 0x0D05;
const uint GL_MAP_COLOR = 0x0D10;
const uint GL_MAP_STENCIL = 0x0D11;
const uint GL_INDEX_SHIFT = 0x0D12;
const uint GL_INDEX_OFFSET = 0x0D13;
const uint GL_RED_SCALE = 0x0D14;
const uint GL_RED_BIAS = 0x0D15;
const uint GL_ZOOM_X = 0x0D16;
const uint GL_ZOOM_Y = 0x0D17;
const uint GL_GREEN_SCALE = 0x0D18;
const uint GL_GREEN_BIAS = 0x0D19;
const uint GL_BLUE_SCALE = 0x0D1A;
const uint GL_BLUE_BIAS = 0x0D1B;
const uint GL_ALPHA_SCALE = 0x0D1C;
const uint GL_ALPHA_BIAS = 0x0D1D;
const uint GL_DEPTH_SCALE = 0x0D1E;
const uint GL_DEPTH_BIAS = 0x0D1F;
const uint GL_MAX_EVAL_ORDER = 0x0D30;
const uint GL_MAX_LIGHTS = 0x0D31;
const uint GL_MAX_CLIP_PLANES = 0x0D32;
const uint GL_MAX_TEXTURE_SIZE = 0x0D33;
const uint GL_MAX_PIXEL_MAP_TABLE = 0x0D34;
const uint GL_MAX_ATTRIB_STACK_DEPTH = 0x0D35;
const uint GL_MAX_MODELVIEW_STACK_DEPTH = 0x0D36;
const uint GL_MAX_NAME_STACK_DEPTH = 0x0D37;
const uint GL_MAX_PROJECTION_STACK_DEPTH = 0x0D38;
const uint GL_MAX_TEXTURE_STACK_DEPTH = 0x0D39;
const uint GL_MAX_VIEWPORT_DIMS = 0x0D3A;
const uint GL_MAX_CLIENT_ATTRIB_STACK_DEPTH = 0x0D3B;
const uint GL_SUBPIXEL_BITS = 0x0D50;
const uint GL_INDEX_BITS = 0x0D51;
const uint GL_RED_BITS = 0x0D52;
const uint GL_GREEN_BITS = 0x0D53;
const uint GL_BLUE_BITS = 0x0D54;
const uint GL_ALPHA_BITS = 0x0D55;
const uint GL_DEPTH_BITS = 0x0D56;
const uint GL_STENCIL_BITS = 0x0D57;
const uint GL_ACCUM_RED_BITS = 0x0D58;
const uint GL_ACCUM_GREEN_BITS = 0x0D59;
const uint GL_ACCUM_BLUE_BITS = 0x0D5A;
const uint GL_ACCUM_ALPHA_BITS = 0x0D5B;
const uint GL_NAME_STACK_DEPTH = 0x0D70;
const uint GL_AUTO_NORMAL = 0x0D80;
const uint GL_MAP1_COLOR_4 = 0x0D90;
const uint GL_MAP1_INDEX = 0x0D91;
const uint GL_MAP1_NORMAL = 0x0D92;
const uint GL_MAP1_TEXTURE_COORD_1 = 0x0D93;
const uint GL_MAP1_TEXTURE_COORD_2 = 0x0D94;
const uint GL_MAP1_TEXTURE_COORD_3 = 0x0D95;
const uint GL_MAP1_TEXTURE_COORD_4 = 0x0D96;
const uint GL_MAP1_VERTEX_3 = 0x0D97;
const uint GL_MAP1_VERTEX_4 = 0x0D98;
const uint GL_MAP2_COLOR_4 = 0x0DB0;
const uint GL_MAP2_INDEX = 0x0DB1;
const uint GL_MAP2_NORMAL = 0x0DB2;
const uint GL_MAP2_TEXTURE_COORD_1 = 0x0DB3;
const uint GL_MAP2_TEXTURE_COORD_2 = 0x0DB4;
const uint GL_MAP2_TEXTURE_COORD_3 = 0x0DB5;
const uint GL_MAP2_TEXTURE_COORD_4 = 0x0DB6;
const uint GL_MAP2_VERTEX_3 = 0x0DB7;
const uint GL_MAP2_VERTEX_4 = 0x0DB8;
const uint GL_MAP1_GRID_DOMAIN = 0x0DD0;
const uint GL_MAP1_GRID_SEGMENTS = 0x0DD1;
const uint GL_MAP2_GRID_DOMAIN = 0x0DD2;
const uint GL_MAP2_GRID_SEGMENTS = 0x0DD3;
const uint GL_TEXTURE_1D = 0x0DE0;
const uint GL_TEXTURE_2D = 0x0DE1;
const uint GL_FEEDBACK_BUFFER_POINTER = 0x0DF0;
const uint GL_FEEDBACK_BUFFER_SIZE = 0x0DF1;
const uint GL_FEEDBACK_BUFFER_TYPE = 0x0DF2;
const uint GL_SELECTION_BUFFER_POINTER = 0x0DF3;
const uint GL_SELECTION_BUFFER_SIZE = 0x0DF4;
/* GL_TEXTURE_BINDING_1D */
/* GL_TEXTURE_BINDING_2D */
/* GL_VERTEX_ARRAY */
/* GL_NORMAL_ARRAY */
/* GL_COLOR_ARRAY */
/* GL_INDEX_ARRAY */
/* GL_TEXTURE_COORD_ARRAY */
/* GL_EDGE_FLAG_ARRAY */
/* GL_VERTEX_ARRAY_SIZE */
/* GL_VERTEX_ARRAY_TYPE */
/* GL_VERTEX_ARRAY_STRIDE */
/* GL_NORMAL_ARRAY_TYPE */
/* GL_NORMAL_ARRAY_STRIDE */
/* GL_COLOR_ARRAY_SIZE */
/* GL_COLOR_ARRAY_TYPE */
/* GL_COLOR_ARRAY_STRIDE */
/* GL_INDEX_ARRAY_TYPE */
/* GL_INDEX_ARRAY_STRIDE */
/* GL_TEXTURE_COORD_ARRAY_SIZE */
/* GL_TEXTURE_COORD_ARRAY_TYPE */
/* GL_TEXTURE_COORD_ARRAY_STRIDE */
/* GL_EDGE_FLAG_ARRAY_STRIDE */
/* GL_POLYGON_OFFSET_FACTOR */
/* GL_POLYGON_OFFSET_UNITS */
/* GetTextureParameter */
/* GL_TEXTURE_MAG_FILTER */
/* GL_TEXTURE_MIN_FILTER */
/* GL_TEXTURE_WRAP_S */
/* GL_TEXTURE_WRAP_T */
const uint GL_TEXTURE_WIDTH = 0x1000;
const uint GL_TEXTURE_HEIGHT = 0x1001;
const uint GL_TEXTURE_INTERNAL_FORMAT = 0x1003;
const uint GL_TEXTURE_BORDER_COLOR = 0x1004;
const uint GL_TEXTURE_BORDER = 0x1005;
/* GL_TEXTURE_RED_SIZE */
/* GL_TEXTURE_GREEN_SIZE */
/* GL_TEXTURE_BLUE_SIZE */
/* GL_TEXTURE_ALPHA_SIZE */
/* GL_TEXTURE_LUMINANCE_SIZE */
/* GL_TEXTURE_INTENSITY_SIZE */
/* GL_TEXTURE_PRIORITY */
/* GL_TEXTURE_RESIDENT */
/* HintMode */
const uint GL_DONT_CARE = 0x1100;
const uint GL_FASTEST = 0x1101;
const uint GL_NICEST = 0x1102;
/* HintTarget */
/* GL_PERSPECTIVE_CORRECTION_HINT */
/* GL_POINT_SMOOTH_HINT */
/* GL_LINE_SMOOTH_HINT */
/* GL_POLYGON_SMOOTH_HINT */
/* GL_FOG_HINT */
/* GL_PHONG_HINT */
/* IndexPointerType */
/* GL_SHORT */
/* GL_INT */
/* GL_FLOAT */
/* GL_DOUBLE */
/* LightModelParameter */
/* GL_LIGHT_MODEL_AMBIENT */
/* GL_LIGHT_MODEL_LOCAL_VIEWER */
/* GL_LIGHT_MODEL_TWO_SIDE */
/* LightName */
const uint GL_LIGHT0 = 0x4000;
const uint GL_LIGHT1 = 0x4001;
const uint GL_LIGHT2 = 0x4002;
const uint GL_LIGHT3 = 0x4003;
const uint GL_LIGHT4 = 0x4004;
const uint GL_LIGHT5 = 0x4005;
const uint GL_LIGHT6 = 0x4006;
const uint GL_LIGHT7 = 0x4007;
/* LightParameter */
const uint GL_AMBIENT = 0x1200;
const uint GL_DIFFUSE = 0x1201;
const uint GL_SPECULAR = 0x1202;
const uint GL_POSITION = 0x1203;
const uint GL_SPOT_DIRECTION = 0x1204;
const uint GL_SPOT_EXPONENT = 0x1205;
const uint GL_SPOT_CUTOFF = 0x1206;
const uint GL_CONSTANT_ATTENUATION = 0x1207;
const uint GL_LINEAR_ATTENUATION = 0x1208;
const uint GL_QUADRATIC_ATTENUATION = 0x1209;
/* InterleavedArrays */
/* GL_V2F */
/* GL_V3F */
/* GL_C4UB_V2F */
/* GL_C4UB_V3F */
/* GL_C3F_V3F */
/* GL_N3F_V3F */
/* GL_C4F_N3F_V3F */
/* GL_T2F_V3F */
/* GL_T4F_V4F */
/* GL_T2F_C4UB_V3F */
/* GL_T2F_C3F_V3F */
/* GL_T2F_N3F_V3F */
/* GL_T2F_C4F_N3F_V3F */
/* GL_T4F_C4F_N3F_V4F */
/* ListMode */
const uint GL_COMPILE = 0x1300;
const uint GL_COMPILE_AND_EXECUTE = 0x1301;
/* ListNameType */
/* GL_BYTE */
/* GL_UNSIGNED_BYTE */
/* GL_SHORT */
/* GL_UNSIGNED_SHORT */
/* GL_INT */
/* GL_UNSIGNED_INT */
/* GL_FLOAT */
/* GL_2_BYTES */
/* GL_3_BYTES */
/* GL_4_BYTES */
/* LogicOp */
const uint GL_CLEAR = 0x1500;
const uint GL_AND = 0x1501;
const uint GL_AND_REVERSE = 0x1502;
const uint GL_COPY = 0x1503;
const uint GL_AND_INVERTED = 0x1504;
const uint GL_NOOP = 0x1505;
const uint GL_XOR = 0x1506;
const uint GL_OR = 0x1507;
const uint GL_NOR = 0x1508;
const uint GL_EQUIV = 0x1509;
const uint GL_INVERT = 0x150A;
const uint GL_OR_REVERSE = 0x150B;
const uint GL_COPY_INVERTED = 0x150C;
const uint GL_OR_INVERTED = 0x150D;
const uint GL_NAND = 0x150E;
const uint GL_SET = 0x150F;
/* MapTarget */
/* GL_MAP1_COLOR_4 */
/* GL_MAP1_INDEX */
/* GL_MAP1_NORMAL */
/* GL_MAP1_TEXTURE_COORD_1 */
/* GL_MAP1_TEXTURE_COORD_2 */
/* GL_MAP1_TEXTURE_COORD_3 */
/* GL_MAP1_TEXTURE_COORD_4 */
/* GL_MAP1_VERTEX_3 */
/* GL_MAP1_VERTEX_4 */
/* GL_MAP2_COLOR_4 */
/* GL_MAP2_INDEX */
/* GL_MAP2_NORMAL */
/* GL_MAP2_TEXTURE_COORD_1 */
/* GL_MAP2_TEXTURE_COORD_2 */
/* GL_MAP2_TEXTURE_COORD_3 */
/* GL_MAP2_TEXTURE_COORD_4 */
/* GL_MAP2_VERTEX_3 */
/* GL_MAP2_VERTEX_4 */
/* MaterialFace */
/* GL_FRONT */
/* GL_BACK */
/* GL_FRONT_AND_BACK */
/* MaterialParameter */
const uint GL_EMISSION = 0x1600;
const uint GL_SHININESS = 0x1601;
const uint GL_AMBIENT_AND_DIFFUSE = 0x1602;
const uint GL_COLOR_INDEXES = 0x1603;
/* GL_AMBIENT */
/* GL_DIFFUSE */
/* GL_SPECULAR */
/* MatrixMode */
const uint GL_MODELVIEW = 0x1700;
const uint GL_PROJECTION = 0x1701;
const uint GL_TEXTURE = 0x1702;
/* MeshMode1 */
/* GL_POINT */
/* GL_LINE */
/* MeshMode2 */
/* GL_POINT */
/* GL_LINE */
/* GL_FILL */
/* NormalPointerType */
/* GL_BYTE */
/* GL_SHORT */
/* GL_INT */
/* GL_FLOAT */
/* GL_DOUBLE */
/* PixelCopyType */
const uint GL_COLOR = 0x1800;
const uint GL_DEPTH = 0x1801;
const uint GL_STENCIL = 0x1802;
/* PixelFormat */
const uint GL_COLOR_INDEX = 0x1900;
const uint GL_STENCIL_INDEX = 0x1901;
const uint GL_DEPTH_COMPONENT = 0x1902;
const uint GL_RED = 0x1903;
const uint GL_GREEN = 0x1904;
const uint GL_BLUE = 0x1905;
const uint GL_ALPHA = 0x1906;
const uint GL_RGB = 0x1907;
const uint GL_RGBA = 0x1908;
const uint GL_LUMINANCE = 0x1909;
const uint GL_LUMINANCE_ALPHA = 0x190A;
/* PixelMap */
/* GL_PIXEL_MAP_I_TO_I */
/* GL_PIXEL_MAP_S_TO_S */
/* GL_PIXEL_MAP_I_TO_R */
/* GL_PIXEL_MAP_I_TO_G */
/* GL_PIXEL_MAP_I_TO_B */
/* GL_PIXEL_MAP_I_TO_A */
/* GL_PIXEL_MAP_R_TO_R */
/* GL_PIXEL_MAP_G_TO_G */
/* GL_PIXEL_MAP_B_TO_B */
/* GL_PIXEL_MAP_A_TO_A */
/* PixelStore */
/* GL_UNPACK_SWAP_BYTES */
/* GL_UNPACK_LSB_FIRST */
/* GL_UNPACK_ROW_LENGTH */
/* GL_UNPACK_SKIP_ROWS */
/* GL_UNPACK_SKIP_PIXELS */
/* GL_UNPACK_ALIGNMENT */
/* GL_PACK_SWAP_BYTES */
/* GL_PACK_LSB_FIRST */
/* GL_PACK_ROW_LENGTH */
/* GL_PACK_SKIP_ROWS */
/* GL_PACK_SKIP_PIXELS */
/* GL_PACK_ALIGNMENT */
/* PixelTransfer */
/* GL_MAP_COLOR */
/* GL_MAP_STENCIL */
/* GL_INDEX_SHIFT */
/* GL_INDEX_OFFSET */
/* GL_RED_SCALE */
/* GL_RED_BIAS */
/* GL_GREEN_SCALE */
/* GL_GREEN_BIAS */
/* GL_BLUE_SCALE */
/* GL_BLUE_BIAS */
/* GL_ALPHA_SCALE */
/* GL_ALPHA_BIAS */
/* GL_DEPTH_SCALE */
/* GL_DEPTH_BIAS */
/* PixelType */
const uint GL_BITMAP = 0x1A00;
/* GL_BYTE */
/* GL_UNSIGNED_BYTE */
/* GL_SHORT */
/* GL_UNSIGNED_SHORT */
/* GL_INT */
/* GL_UNSIGNED_INT */
/* GL_FLOAT */
/* PolygonMode */
const uint GL_POINT = 0x1B00;
const uint GL_LINE = 0x1B01;
const uint GL_FILL = 0x1B02;
/* ReadBufferMode */
/* GL_FRONT_LEFT */
/* GL_FRONT_RIGHT */
/* GL_BACK_LEFT */
/* GL_BACK_RIGHT */
/* GL_FRONT */
/* GL_BACK */
/* GL_LEFT */
/* GL_RIGHT */
/* GL_AUX0 */
/* GL_AUX1 */
/* GL_AUX2 */
/* GL_AUX3 */
/* RenderingMode */
const uint GL_RENDER = 0x1C00;
const uint GL_FEEDBACK = 0x1C01;
const uint GL_SELECT = 0x1C02;
/* ShadingModel */
const uint GL_FLAT = 0x1D00;
const uint GL_SMOOTH = 0x1D01;
/* StencilFunction */
/* GL_NEVER */
/* GL_LESS */
/* GL_EQUAL */
/* GL_LEQUAL */
/* GL_GREATER */
/* GL_NOTEQUAL */
/* GL_GEQUAL */
/* GL_ALWAYS */
/* StencilOp */
/* GL_ZERO */
const uint GL_KEEP = 0x1E00;
const uint GL_REPLACE = 0x1E01;
const uint GL_INCR = 0x1E02;
const uint GL_DECR = 0x1E03;
/* GL_INVERT */
/* StringName */
const uint GL_VENDOR = 0x1F00;
const uint GL_RENDERER = 0x1F01;
const uint GL_VERSION = 0x1F02;
const uint GL_EXTENSIONS = 0x1F03;
/* TextureCoordName */
const uint GL_S = 0x2000;
const uint GL_T = 0x2001;
const uint GL_R = 0x2002;
const uint GL_Q = 0x2003;
/* TexCoordPointerType */
/* GL_SHORT */
/* GL_INT */
/* GL_FLOAT */
/* GL_DOUBLE */
/* TextureEnvMode */
const uint GL_MODULATE = 0x2100;
const uint GL_DECAL = 0x2101;
/* GL_BLEND */
/* GL_REPLACE */
/* TextureEnvParameter */
const uint GL_TEXTURE_ENV_MODE = 0x2200;
const uint GL_TEXTURE_ENV_COLOR = 0x2201;
/* TextureEnvTarget */
const uint GL_TEXTURE_ENV = 0x2300;
/* TextureGenMode */
const uint GL_EYE_LINEAR = 0x2400;
const uint GL_OBJECT_LINEAR = 0x2401;
const uint GL_SPHERE_MAP = 0x2402;
/* TextureGenParameter */
const uint GL_TEXTURE_GEN_MODE = 0x2500;
const uint GL_OBJECT_PLANE = 0x2501;
const uint GL_EYE_PLANE = 0x2502;
/* TextureMagFilter */
const uint GL_NEAREST = 0x2600;
const uint GL_LINEAR = 0x2601;
/* TextureMinFilter */
/* GL_NEAREST */
/* GL_LINEAR */
const uint GL_NEAREST_MIPMAP_NEAREST = 0x2700;
const uint GL_LINEAR_MIPMAP_NEAREST = 0x2701;
const uint GL_NEAREST_MIPMAP_LINEAR = 0x2702;
const uint GL_LINEAR_MIPMAP_LINEAR = 0x2703;
/* TextureParameterName */
const uint GL_TEXTURE_MAG_FILTER = 0x2800;
const uint GL_TEXTURE_MIN_FILTER = 0x2801;
const uint GL_TEXTURE_WRAP_S = 0x2802;
const uint GL_TEXTURE_WRAP_T = 0x2803;
/* GL_TEXTURE_BORDER_COLOR */
/* GL_TEXTURE_PRIORITY */
/* TextureTarget */
/* GL_TEXTURE_1D */
/* GL_TEXTURE_2D */
/* GL_PROXY_TEXTURE_1D */
/* GL_PROXY_TEXTURE_2D */
/* TextureWrapMode */
const uint GL_CLAMP = 0x2900;
const uint GL_REPEAT = 0x2901;
/* VertexPointerType */
/* GL_SHORT */
/* GL_INT */
/* GL_FLOAT */
/* GL_DOUBLE */
/* ClientAttribMask */
const uint GL_CLIENT_PIXEL_STORE_BIT = 0x00000001;
const uint GL_CLIENT_VERTEX_ARRAY_BIT = 0x00000002;
const uint GL_CLIENT_ALL_ATTRIB_BITS = 0xffffffff;
/* polygon_offset */
const uint GL_POLYGON_OFFSET_FACTOR = 0x8038;
const uint GL_POLYGON_OFFSET_UNITS = 0x2A00;
const uint GL_POLYGON_OFFSET_POINT = 0x2A01;
const uint GL_POLYGON_OFFSET_LINE = 0x2A02;
const uint GL_POLYGON_OFFSET_FILL = 0x8037;
/* texture */
const uint GL_ALPHA4 = 0x803B;
const uint GL_ALPHA8 = 0x803C;
const uint GL_ALPHA12 = 0x803D;
const uint GL_ALPHA16 = 0x803E;
const uint GL_LUMINANCE4 = 0x803F;
const uint GL_LUMINANCE8 = 0x8040;
const uint GL_LUMINANCE12 = 0x8041;
const uint GL_LUMINANCE16 = 0x8042;
const uint GL_LUMINANCE4_ALPHA4 = 0x8043;
const uint GL_LUMINANCE6_ALPHA2 = 0x8044;
const uint GL_LUMINANCE8_ALPHA8 = 0x8045;
const uint GL_LUMINANCE12_ALPHA4 = 0x8046;
const uint GL_LUMINANCE12_ALPHA12 = 0x8047;
const uint GL_LUMINANCE16_ALPHA16 = 0x8048;
const uint GL_INTENSITY = 0x8049;
const uint GL_INTENSITY4 = 0x804A;
const uint GL_INTENSITY8 = 0x804B;
const uint GL_INTENSITY12 = 0x804C;
const uint GL_INTENSITY16 = 0x804D;
const uint GL_R3_G3_B2 = 0x2A10;
const uint GL_RGB4 = 0x804F;
const uint GL_RGB5 = 0x8050;
const uint GL_RGB8 = 0x8051;
const uint GL_RGB10 = 0x8052;
const uint GL_RGB12 = 0x8053;
const uint GL_RGB16 = 0x8054;
const uint GL_RGBA2 = 0x8055;
const uint GL_RGBA4 = 0x8056;
const uint GL_RGB5_A1 = 0x8057;
const uint GL_RGBA8 = 0x8058;
const uint GL_RGB10_A2 = 0x8059;
const uint GL_RGBA12 = 0x805A;
const uint GL_RGBA16 = 0x805B;
const uint GL_TEXTURE_RED_SIZE = 0x805C;
const uint GL_TEXTURE_GREEN_SIZE = 0x805D;
const uint GL_TEXTURE_BLUE_SIZE = 0x805E;
const uint GL_TEXTURE_ALPHA_SIZE = 0x805F;
const uint GL_TEXTURE_LUMINANCE_SIZE = 0x8060;
const uint GL_TEXTURE_INTENSITY_SIZE = 0x8061;
const uint GL_PROXY_TEXTURE_1D = 0x8063;
const uint GL_PROXY_TEXTURE_2D = 0x8064;
/* texture_object */
const uint GL_TEXTURE_PRIORITY = 0x8066;
const uint GL_TEXTURE_RESIDENT = 0x8067;
const uint GL_TEXTURE_BINDING_1D = 0x8068;
const uint GL_TEXTURE_BINDING_2D = 0x8069;
/* vertex_array */
const uint GL_VERTEX_ARRAY = 0x8074;
const uint GL_NORMAL_ARRAY = 0x8075;
const uint GL_COLOR_ARRAY = 0x8076;
const uint GL_INDEX_ARRAY = 0x8077;
const uint GL_TEXTURE_COORD_ARRAY = 0x8078;
const uint GL_EDGE_FLAG_ARRAY = 0x8079;
const uint GL_VERTEX_ARRAY_SIZE = 0x807A;
const uint GL_VERTEX_ARRAY_TYPE = 0x807B;
const uint GL_VERTEX_ARRAY_STRIDE = 0x807C;
const uint GL_NORMAL_ARRAY_TYPE = 0x807E;
const uint GL_NORMAL_ARRAY_STRIDE = 0x807F;
const uint GL_COLOR_ARRAY_SIZE = 0x8081;
const uint GL_COLOR_ARRAY_TYPE = 0x8082;
const uint GL_COLOR_ARRAY_STRIDE = 0x8083;
const uint GL_INDEX_ARRAY_TYPE = 0x8085;
const uint GL_INDEX_ARRAY_STRIDE = 0x8086;
const uint GL_TEXTURE_COORD_ARRAY_SIZE = 0x8088;
const uint GL_TEXTURE_COORD_ARRAY_TYPE = 0x8089;
const uint GL_TEXTURE_COORD_ARRAY_STRIDE = 0x808A;
const uint GL_EDGE_FLAG_ARRAY_STRIDE = 0x808C;
const uint GL_VERTEX_ARRAY_POINTER = 0x808E;
const uint GL_NORMAL_ARRAY_POINTER = 0x808F;
const uint GL_COLOR_ARRAY_POINTER = 0x8090;
const uint GL_INDEX_ARRAY_POINTER = 0x8091;
const uint GL_TEXTURE_COORD_ARRAY_POINTER= 0x8092;
const uint GL_EDGE_FLAG_ARRAY_POINTER = 0x8093;
const uint GL_V2F = 0x2A20;
const uint GL_V3F = 0x2A21;
const uint GL_C4UB_V2F = 0x2A22;
const uint GL_C4UB_V3F = 0x2A23;
const uint GL_C3F_V3F = 0x2A24;
const uint GL_N3F_V3F = 0x2A25;
const uint GL_C4F_N3F_V3F = 0x2A26;
const uint GL_T2F_V3F = 0x2A27;
const uint GL_T4F_V4F = 0x2A28;
const uint GL_T2F_C4UB_V3F = 0x2A29;
const uint GL_T2F_C3F_V3F = 0x2A2A;
const uint GL_T2F_N3F_V3F = 0x2A2B;
const uint GL_T2F_C4F_N3F_V3F = 0x2A2C;
const uint GL_T4F_C4F_N3F_V4F = 0x2A2D;
/* Extensions */
const uint GL_EXT_vertex_array = 1;
const uint GL_EXT_bgra = 1;
const uint GL_EXT_paletted_texture = 1;
const uint GL_WIN_swap_hint = 1;
const uint GL_WIN_draw_range_elements = 1;
// const uint GL_WIN_phong_shading 1
// const uint GL_WIN_specular_fog 1
/* EXT_vertex_array */
const uint GL_VERTEX_ARRAY_EXT = 0x8074;
const uint GL_NORMAL_ARRAY_EXT = 0x8075;
const uint GL_COLOR_ARRAY_EXT = 0x8076;
const uint GL_INDEX_ARRAY_EXT = 0x8077;
const uint GL_TEXTURE_COORD_ARRAY_EXT = 0x8078;
const uint GL_EDGE_FLAG_ARRAY_EXT = 0x8079;
const uint GL_VERTEX_ARRAY_SIZE_EXT = 0x807A;
const uint GL_VERTEX_ARRAY_TYPE_EXT = 0x807B;
const uint GL_VERTEX_ARRAY_STRIDE_EXT = 0x807C;
const uint GL_VERTEX_ARRAY_COUNT_EXT = 0x807D;
const uint GL_NORMAL_ARRAY_TYPE_EXT = 0x807E;
const uint GL_NORMAL_ARRAY_STRIDE_EXT = 0x807F;
const uint GL_NORMAL_ARRAY_COUNT_EXT = 0x8080;
const uint GL_COLOR_ARRAY_SIZE_EXT = 0x8081;
const uint GL_COLOR_ARRAY_TYPE_EXT = 0x8082;
const uint GL_COLOR_ARRAY_STRIDE_EXT = 0x8083;
const uint GL_COLOR_ARRAY_COUNT_EXT = 0x8084;
const uint GL_INDEX_ARRAY_TYPE_EXT = 0x8085;
const uint GL_INDEX_ARRAY_STRIDE_EXT = 0x8086;
const uint GL_INDEX_ARRAY_COUNT_EXT = 0x8087;
const uint GL_TEXTURE_COORD_ARRAY_SIZE_EXT = 0x8088;
const uint GL_TEXTURE_COORD_ARRAY_TYPE_EXT = 0x8089;
const uint GL_TEXTURE_COORD_ARRAY_STRIDE_EXT = 0x808A;
const uint GL_TEXTURE_COORD_ARRAY_COUNT_EXT = 0x808B;
const uint GL_EDGE_FLAG_ARRAY_STRIDE_EXT = 0x808C;
const uint GL_EDGE_FLAG_ARRAY_COUNT_EXT = 0x808D;
const uint GL_VERTEX_ARRAY_POINTER_EXT = 0x808E;
const uint GL_NORMAL_ARRAY_POINTER_EXT = 0x808F;
const uint GL_COLOR_ARRAY_POINTER_EXT = 0x8090;
const uint GL_INDEX_ARRAY_POINTER_EXT = 0x8091;
const uint GL_TEXTURE_COORD_ARRAY_POINTER_EXT = 0x8092;
const uint GL_EDGE_FLAG_ARRAY_POINTER_EXT = 0x8093;
const uint GL_DOUBLE_EXT = GL_DOUBLE;
/* EXT_bgra */
const uint GL_BGR_EXT = 0x80E0;
const uint GL_BGRA_EXT = 0x80E1;
/* EXT_paletted_texture */
/* These must match the GL_COLOR_TABLE_*_SGI enumerants */
const uint GL_COLOR_TABLE_FORMAT_EXT = 0x80D8;
const uint GL_COLOR_TABLE_WIDTH_EXT = 0x80D9;
const uint GL_COLOR_TABLE_RED_SIZE_EXT = 0x80DA;
const uint GL_COLOR_TABLE_GREEN_SIZE_EXT = 0x80DB;
const uint GL_COLOR_TABLE_BLUE_SIZE_EXT = 0x80DC;
const uint GL_COLOR_TABLE_ALPHA_SIZE_EXT = 0x80DD;
const uint GL_COLOR_TABLE_LUMINANCE_SIZE_EXT = 0x80DE;
const uint GL_COLOR_TABLE_INTENSITY_SIZE_EXT = 0x80DF;
const uint GL_COLOR_INDEX1_EXT = 0x80E2;
const uint GL_COLOR_INDEX2_EXT = 0x80E3;
const uint GL_COLOR_INDEX4_EXT = 0x80E4;
const uint GL_COLOR_INDEX8_EXT = 0x80E5;
const uint GL_COLOR_INDEX12_EXT = 0x80E6;
const uint GL_COLOR_INDEX16_EXT = 0x80E7;
/* WIN_draw_range_elements */
const uint GL_MAX_ELEMENTS_VERTICES_WIN = 0x80E8;
const uint GL_MAX_ELEMENTS_INDICES_WIN = 0x80E9;
/* WIN_phong_shading */
const uint GL_PHONG_WIN = 0x80EA;
const uint GL_PHONG_HINT_WIN = 0x80EB;
/* WIN_specular_fog */
const uint GL_FOG_SPECULAR_TEXTURE_WIN = 0x80EC;
/* For compatibility with OpenGL v1.0 */
const uint GL_LOGIC_OP = GL_INDEX_LOGIC_OP;
const uint GL_TEXTURE_COMPONENTS = GL_TEXTURE_INTERNAL_FORMAT;
/*************************************************************/
extern(Windows) void /*APIENTRY*/glAccum (GLenum op, GLfloat value);
extern(Windows) void /*APIENTRY*/glAlphaFunc (GLenum func, GLclampf ref);
extern(Windows) GLboolean /*APIENTRY*/glAreTexturesResident (GLsizei n, GLuint *textures, GLboolean *residences);
extern(Windows) void /*APIENTRY*/glArrayElement (GLint i);
extern(Windows) void /*APIENTRY*/glBegin (GLenum mode);
extern(Windows) void /*APIENTRY*/glBindTexture (GLenum target, GLuint texture);
extern(Windows) void /*APIENTRY*/glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, GLubyte *bitmap);
extern(Windows) void /*APIENTRY*/glBlendFunc (GLenum sfactor, GLenum dfactor);
extern(Windows) void /*APIENTRY*/glCallList (GLuint list);
extern(Windows) void /*APIENTRY*/glCallLists (GLsizei n, GLenum type, GLvoid *lists);
extern(Windows) void /*APIENTRY*/glClear (GLbitfield mask);
extern(Windows) void /*APIENTRY*/glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
extern(Windows) void /*APIENTRY*/glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
extern(Windows) void /*APIENTRY*/glClearDepth (GLclampd depth);
extern(Windows) void /*APIENTRY*/glClearIndex (GLfloat c);
extern(Windows) void /*APIENTRY*/glClearStencil (GLint s);
extern(Windows) void /*APIENTRY*/glClipPlane (GLenum plane, GLdouble *equation);
extern(Windows) void /*APIENTRY*/glColor3b (GLbyte red, GLbyte green, GLbyte blue);
extern(Windows) void /*APIENTRY*/glColor3bv (GLbyte *v);
extern(Windows) void /*APIENTRY*/glColor3d (GLdouble red, GLdouble green, GLdouble blue);
extern(Windows) void /*APIENTRY*/glColor3dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glColor3f (GLfloat red, GLfloat green, GLfloat blue);
extern(Windows) void /*APIENTRY*/glColor3fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glColor3i (GLint red, GLint green, GLint blue);
extern(Windows) void /*APIENTRY*/glColor3iv (GLint *v);
extern(Windows) void /*APIENTRY*/glColor3s (GLshort red, GLshort green, GLshort blue);
extern(Windows) void /*APIENTRY*/glColor3sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glColor3ub (GLubyte red, GLubyte green, GLubyte blue);
extern(Windows) void /*APIENTRY*/glColor3ubv (GLubyte *v);
extern(Windows) void /*APIENTRY*/glColor3ui (GLuint red, GLuint green, GLuint blue);
extern(Windows) void /*APIENTRY*/glColor3uiv (GLuint *v);
extern(Windows) void /*APIENTRY*/glColor3us (GLushort red, GLushort green, GLushort blue);
extern(Windows) void /*APIENTRY*/glColor3usv (GLushort *v);
extern(Windows) void /*APIENTRY*/glColor4b (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
extern(Windows) void /*APIENTRY*/glColor4bv (GLbyte *v);
extern(Windows) void /*APIENTRY*/glColor4d (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha);
extern(Windows) void /*APIENTRY*/glColor4dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
extern(Windows) void /*APIENTRY*/glColor4fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glColor4i (GLint red, GLint green, GLint blue, GLint alpha);
extern(Windows) void /*APIENTRY*/glColor4iv (GLint *v);
extern(Windows) void /*APIENTRY*/glColor4s (GLshort red, GLshort green, GLshort blue, GLshort alpha);
extern(Windows) void /*APIENTRY*/glColor4sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
extern(Windows) void /*APIENTRY*/glColor4ubv (GLubyte *v);
extern(Windows) void /*APIENTRY*/glColor4ui (GLuint red, GLuint green, GLuint blue, GLuint alpha);
extern(Windows) void /*APIENTRY*/glColor4uiv (GLuint *v);
extern(Windows) void /*APIENTRY*/glColor4us (GLushort red, GLushort green, GLushort blue, GLushort alpha);
extern(Windows) void /*APIENTRY*/glColor4usv (GLushort *v);
extern(Windows) void /*APIENTRY*/glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
extern(Windows) void /*APIENTRY*/glColorMaterial (GLenum face, GLenum mode);
extern(Windows) void /*APIENTRY*/glColorPointer (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);
extern(Windows) void /*APIENTRY*/glCopyPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type);
extern(Windows) void /*APIENTRY*/glCopyTexImage1D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border);
extern(Windows) void /*APIENTRY*/glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
extern(Windows) void /*APIENTRY*/glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
extern(Windows) void /*APIENTRY*/glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
extern(Windows) void /*APIENTRY*/glCullFace (GLenum mode);
extern(Windows) void /*APIENTRY*/glDeleteLists (GLuint list, GLsizei range);
extern(Windows) void /*APIENTRY*/glDeleteTextures (GLsizei n, GLuint *textures);
extern(Windows) void /*APIENTRY*/glDepthFunc (GLenum func);
extern(Windows) void /*APIENTRY*/glDepthMask (GLboolean flag);
extern(Windows) void /*APIENTRY*/glDepthRange (GLclampd zNear, GLclampd zFar);
extern(Windows) void /*APIENTRY*/glDisable (GLenum cap);
extern(Windows) void /*APIENTRY*/glDisableClientState (GLenum array);
extern(Windows) void /*APIENTRY*/glDrawArrays (GLenum mode, GLint first, GLsizei count);
extern(Windows) void /*APIENTRY*/glDrawBuffer (GLenum mode);
extern(Windows) void /*APIENTRY*/glDrawElements (GLenum mode, GLsizei count, GLenum type, GLvoid *indices);
extern(Windows) void /*APIENTRY*/glDrawPixels (GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
extern(Windows) void /*APIENTRY*/glEdgeFlag (GLboolean flag);
extern(Windows) void /*APIENTRY*/glEdgeFlagPointer (GLsizei stride, GLvoid *pointer);
extern(Windows) void /*APIENTRY*/glEdgeFlagv (GLboolean *flag);
extern(Windows) void /*APIENTRY*/glEnable (GLenum cap);
extern(Windows) void /*APIENTRY*/glEnableClientState (GLenum array);
extern(Windows) void /*APIENTRY*/glEnd ();
extern(Windows) void /*APIENTRY*/glEndList ();
extern(Windows) void /*APIENTRY*/glEvalCoord1d (GLdouble u);
extern(Windows) void /*APIENTRY*/glEvalCoord1dv (GLdouble *u);
extern(Windows) void /*APIENTRY*/glEvalCoord1f (GLfloat u);
extern(Windows) void /*APIENTRY*/glEvalCoord1fv (GLfloat *u);
extern(Windows) void /*APIENTRY*/glEvalCoord2d (GLdouble u, GLdouble v);
extern(Windows) void /*APIENTRY*/glEvalCoord2dv (GLdouble *u);
extern(Windows) void /*APIENTRY*/glEvalCoord2f (GLfloat u, GLfloat v);
extern(Windows) void /*APIENTRY*/glEvalCoord2fv (GLfloat *u);
extern(Windows) void /*APIENTRY*/glEvalMesh1 (GLenum mode, GLint i1, GLint i2);
extern(Windows) void /*APIENTRY*/glEvalMesh2 (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
extern(Windows) void /*APIENTRY*/glEvalPoint1 (GLint i);
extern(Windows) void /*APIENTRY*/glEvalPoint2 (GLint i, GLint j);
extern(Windows) void /*APIENTRY*/glFeedbackBuffer (GLsizei size, GLenum type, GLfloat *buffer);
extern(Windows) void /*APIENTRY*/glFinish ();
extern(Windows) void /*APIENTRY*/glFlush ();
extern(Windows) void /*APIENTRY*/glFogf (GLenum pname, GLfloat param);
extern(Windows) void /*APIENTRY*/glFogfv (GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glFogi (GLenum pname, GLint param);
extern(Windows) void /*APIENTRY*/glFogiv (GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glFrontFace (GLenum mode);
extern(Windows) void /*APIENTRY*/glFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
extern(Windows) GLuint /*APIENTRY*/glGenLists (GLsizei range);
extern(Windows) void /*APIENTRY*/glGenTextures (GLsizei n, GLuint *textures);
extern(Windows) void /*APIENTRY*/glGetBooleanv (GLenum pname, GLboolean *params);
extern(Windows) void /*APIENTRY*/glGetClipPlane (GLenum plane, GLdouble *equation);
extern(Windows) void /*APIENTRY*/glGetDoublev (GLenum pname, GLdouble *params);
extern(Windows) GLenum /*APIENTRY*/glGetError ();
extern(Windows) void /*APIENTRY*/glGetFloatv (GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glGetIntegerv (GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glGetLightiv (GLenum light, GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glGetMapdv (GLenum target, GLenum query, GLdouble *v);
extern(Windows) void /*APIENTRY*/glGetMapfv (GLenum target, GLenum query, GLfloat *v);
extern(Windows) void /*APIENTRY*/glGetMapiv (GLenum target, GLenum query, GLint *v);
extern(Windows) void /*APIENTRY*/glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glGetMaterialiv (GLenum face, GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glGetPixelMapfv (GLenum map, GLfloat *values);
extern(Windows) void /*APIENTRY*/glGetPixelMapuiv (GLenum map, GLuint *values);
extern(Windows) void /*APIENTRY*/glGetPixelMapusv (GLenum map, GLushort *values);
extern(Windows) void /*APIENTRY*/glGetPointerv (GLenum pname, GLvoid* *params);
extern(Windows) void /*APIENTRY*/glGetPolygonStipple (GLubyte *mask);
extern(Windows) GLubyte * /*APIENTRY*/glGetString (GLenum name);
extern(Windows) void /*APIENTRY*/glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glGetTexEnviv (GLenum target, GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glGetTexGendv (GLenum coord, GLenum pname, GLdouble *params);
extern(Windows) void /*APIENTRY*/glGetTexGenfv (GLenum coord, GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glGetTexGeniv (GLenum coord, GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels);
extern(Windows) void /*APIENTRY*/glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glHint (GLenum target, GLenum mode);
extern(Windows) void /*APIENTRY*/glIndexMask (GLuint mask);
extern(Windows) void /*APIENTRY*/glIndexPointer (GLenum type, GLsizei stride, GLvoid *pointer);
extern(Windows) void /*APIENTRY*/glIndexd (GLdouble c);
extern(Windows) void /*APIENTRY*/glIndexdv (GLdouble *c);
extern(Windows) void /*APIENTRY*/glIndexf (GLfloat c);
extern(Windows) void /*APIENTRY*/glIndexfv (GLfloat *c);
extern(Windows) void /*APIENTRY*/glIndexi (GLint c);
extern(Windows) void /*APIENTRY*/glIndexiv (GLint *c);
extern(Windows) void /*APIENTRY*/glIndexs (GLshort c);
extern(Windows) void /*APIENTRY*/glIndexsv (GLshort *c);
extern(Windows) void /*APIENTRY*/glIndexub (GLubyte c);
extern(Windows) void /*APIENTRY*/glIndexubv (GLubyte *c);
extern(Windows) void /*APIENTRY*/glInitNames ();
extern(Windows) void /*APIENTRY*/glInterleavedArrays (GLenum format, GLsizei stride, GLvoid *pointer);
extern(Windows) GLboolean /*APIENTRY*/glIsEnabled (GLenum cap);
extern(Windows) GLboolean /*APIENTRY*/glIsList (GLuint list);
extern(Windows) GLboolean /*APIENTRY*/glIsTexture (GLuint texture);
extern(Windows) void /*APIENTRY*/glLightModelf (GLenum pname, GLfloat param);
extern(Windows) void /*APIENTRY*/glLightModelfv (GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glLightModeli (GLenum pname, GLint param);
extern(Windows) void /*APIENTRY*/glLightModeliv (GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glLightf (GLenum light, GLenum pname, GLfloat param);
extern(Windows) void /*APIENTRY*/glLightfv (GLenum light, GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glLighti (GLenum light, GLenum pname, GLint param);
extern(Windows) void /*APIENTRY*/glLightiv (GLenum light, GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glLineStipple (GLint factor, GLushort pattern);
extern(Windows) void /*APIENTRY*/glLineWidth (GLfloat width);
extern(Windows) void /*APIENTRY*/glListBase (GLuint base);
extern(Windows) void /*APIENTRY*/glLoadIdentity ();
extern(Windows) void /*APIENTRY*/glLoadMatrixd (GLdouble *m);
extern(Windows) void /*APIENTRY*/glLoadMatrixf (GLfloat *m);
extern(Windows) void /*APIENTRY*/glLoadName (GLuint name);
extern(Windows) void /*APIENTRY*/glLogicOp (GLenum opcode);
extern(Windows) void /*APIENTRY*/glMap1d (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, GLdouble *points);
extern(Windows) void /*APIENTRY*/glMap1f (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, GLfloat *points);
extern(Windows) void /*APIENTRY*/glMap2d (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble *points);
extern(Windows) void /*APIENTRY*/glMap2f (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat *points);
extern(Windows) void /*APIENTRY*/glMapGrid1d (GLint un, GLdouble u1, GLdouble u2);
extern(Windows) void /*APIENTRY*/glMapGrid1f (GLint un, GLfloat u1, GLfloat u2);
extern(Windows) void /*APIENTRY*/glMapGrid2d (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2);
extern(Windows) void /*APIENTRY*/glMapGrid2f (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2);
extern(Windows) void /*APIENTRY*/glMaterialf (GLenum face, GLenum pname, GLfloat param);
extern(Windows) void /*APIENTRY*/glMaterialfv (GLenum face, GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glMateriali (GLenum face, GLenum pname, GLint param);
extern(Windows) void /*APIENTRY*/glMaterialiv (GLenum face, GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glMatrixMode (GLenum mode);
extern(Windows) void /*APIENTRY*/glMultMatrixd (GLdouble *m);
extern(Windows) void /*APIENTRY*/glMultMatrixf (GLfloat *m);
extern(Windows) void /*APIENTRY*/glNewList (GLuint list, GLenum mode);
extern(Windows) void /*APIENTRY*/glNormal3b (GLbyte nx, GLbyte ny, GLbyte nz);
extern(Windows) void /*APIENTRY*/glNormal3bv (GLbyte *v);
extern(Windows) void /*APIENTRY*/glNormal3d (GLdouble nx, GLdouble ny, GLdouble nz);
extern(Windows) void /*APIENTRY*/glNormal3dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
extern(Windows) void /*APIENTRY*/glNormal3fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glNormal3i (GLint nx, GLint ny, GLint nz);
extern(Windows) void /*APIENTRY*/glNormal3iv (GLint *v);
extern(Windows) void /*APIENTRY*/glNormal3s (GLshort nx, GLshort ny, GLshort nz);
extern(Windows) void /*APIENTRY*/glNormal3sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glNormalPointer (GLenum type, GLsizei stride, GLvoid *pointer);
extern(Windows) void /*APIENTRY*/glOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
extern(Windows) void /*APIENTRY*/glPassThrough (GLfloat token);
extern(Windows) void /*APIENTRY*/glPixelMapfv (GLenum map, GLsizei mapsize, GLfloat *values);
extern(Windows) void /*APIENTRY*/glPixelMapuiv (GLenum map, GLsizei mapsize, GLuint *values);
extern(Windows) void /*APIENTRY*/glPixelMapusv (GLenum map, GLsizei mapsize, GLushort *values);
extern(Windows) void /*APIENTRY*/glPixelStoref (GLenum pname, GLfloat param);
extern(Windows) void /*APIENTRY*/glPixelStorei (GLenum pname, GLint param);
extern(Windows) void /*APIENTRY*/glPixelTransferf (GLenum pname, GLfloat param);
extern(Windows) void /*APIENTRY*/glPixelTransferi (GLenum pname, GLint param);
extern(Windows) void /*APIENTRY*/glPixelZoom (GLfloat xfactor, GLfloat yfactor);
extern(Windows) void /*APIENTRY*/glPointSize (GLfloat size);
extern(Windows) void /*APIENTRY*/glPolygonMode (GLenum face, GLenum mode);
extern(Windows) void /*APIENTRY*/glPolygonOffset (GLfloat factor, GLfloat units);
extern(Windows) void /*APIENTRY*/glPolygonStipple (GLubyte *mask);
extern(Windows) void /*APIENTRY*/glPopAttrib ();
extern(Windows) void /*APIENTRY*/glPopClientAttrib ();
extern(Windows) void /*APIENTRY*/glPopMatrix ();
extern(Windows) void /*APIENTRY*/glPopName ();
extern(Windows) void /*APIENTRY*/glPrioritizeTextures (GLsizei n, GLuint *textures, GLclampf *priorities);
extern(Windows) void /*APIENTRY*/glPushAttrib (GLbitfield mask);
extern(Windows) void /*APIENTRY*/glPushClientAttrib (GLbitfield mask);
extern(Windows) void /*APIENTRY*/glPushMatrix ();
extern(Windows) void /*APIENTRY*/glPushName (GLuint name);
extern(Windows) void /*APIENTRY*/glRasterPos2d (GLdouble x, GLdouble y);
extern(Windows) void /*APIENTRY*/glRasterPos2dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glRasterPos2f (GLfloat x, GLfloat y);
extern(Windows) void /*APIENTRY*/glRasterPos2fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glRasterPos2i (GLint x, GLint y);
extern(Windows) void /*APIENTRY*/glRasterPos2iv (GLint *v);
extern(Windows) void /*APIENTRY*/glRasterPos2s (GLshort x, GLshort y);
extern(Windows) void /*APIENTRY*/glRasterPos2sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glRasterPos3d (GLdouble x, GLdouble y, GLdouble z);
extern(Windows) void /*APIENTRY*/glRasterPos3dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glRasterPos3f (GLfloat x, GLfloat y, GLfloat z);
extern(Windows) void /*APIENTRY*/glRasterPos3fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glRasterPos3i (GLint x, GLint y, GLint z);
extern(Windows) void /*APIENTRY*/glRasterPos3iv (GLint *v);
extern(Windows) void /*APIENTRY*/glRasterPos3s (GLshort x, GLshort y, GLshort z);
extern(Windows) void /*APIENTRY*/glRasterPos3sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glRasterPos4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern(Windows) void /*APIENTRY*/glRasterPos4dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glRasterPos4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern(Windows) void /*APIENTRY*/glRasterPos4fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glRasterPos4i (GLint x, GLint y, GLint z, GLint w);
extern(Windows) void /*APIENTRY*/glRasterPos4iv (GLint *v);
extern(Windows) void /*APIENTRY*/glRasterPos4s (GLshort x, GLshort y, GLshort z, GLshort w);
extern(Windows) void /*APIENTRY*/glRasterPos4sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glReadBuffer (GLenum mode);
extern(Windows) void /*APIENTRY*/glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
extern(Windows) void /*APIENTRY*/glRectd (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
extern(Windows) void /*APIENTRY*/glRectdv (GLdouble *v1, GLdouble *v2);
extern(Windows) void /*APIENTRY*/glRectf (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
extern(Windows) void /*APIENTRY*/glRectfv (GLfloat *v1, GLfloat *v2);
extern(Windows) void /*APIENTRY*/glRecti (GLint x1, GLint y1, GLint x2, GLint y2);
extern(Windows) void /*APIENTRY*/glRectiv (GLint *v1, GLint *v2);
extern(Windows) void /*APIENTRY*/glRects (GLshort x1, GLshort y1, GLshort x2, GLshort y2);
extern(Windows) void /*APIENTRY*/glRectsv (GLshort *v1, GLshort *v2);
extern(Windows) GLint /*APIENTRY*/glRenderMode (GLenum mode);
extern(Windows) void /*APIENTRY*/glRotated (GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
extern(Windows) void /*APIENTRY*/glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
extern(Windows) void /*APIENTRY*/glScaled (GLdouble x, GLdouble y, GLdouble z);
extern(Windows) void /*APIENTRY*/glScalef (GLfloat x, GLfloat y, GLfloat z);
extern(Windows) void /*APIENTRY*/glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
extern(Windows) void /*APIENTRY*/glSelectBuffer (GLsizei size, GLuint *buffer);
extern(Windows) void /*APIENTRY*/glShadeModel (GLenum mode);
extern(Windows) void /*APIENTRY*/glStencilFunc (GLenum func, GLint ref, GLuint mask);
extern(Windows) void /*APIENTRY*/glStencilMask (GLuint mask);
extern(Windows) void /*APIENTRY*/glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
extern(Windows) void /*APIENTRY*/glTexCoord1d (GLdouble s);
extern(Windows) void /*APIENTRY*/glTexCoord1dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glTexCoord1f (GLfloat s);
extern(Windows) void /*APIENTRY*/glTexCoord1fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glTexCoord1i (GLint s);
extern(Windows) void /*APIENTRY*/glTexCoord1iv (GLint *v);
extern(Windows) void /*APIENTRY*/glTexCoord1s (GLshort s);
extern(Windows) void /*APIENTRY*/glTexCoord1sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glTexCoord2d (GLdouble s, GLdouble t);
extern(Windows) void /*APIENTRY*/glTexCoord2dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glTexCoord2f (GLfloat s, GLfloat t);
extern(Windows) void /*APIENTRY*/glTexCoord2fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glTexCoord2i (GLint s, GLint t);
extern(Windows) void /*APIENTRY*/glTexCoord2iv (GLint *v);
extern(Windows) void /*APIENTRY*/glTexCoord2s (GLshort s, GLshort t);
extern(Windows) void /*APIENTRY*/glTexCoord2sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glTexCoord3d (GLdouble s, GLdouble t, GLdouble r);
extern(Windows) void /*APIENTRY*/glTexCoord3dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glTexCoord3f (GLfloat s, GLfloat t, GLfloat r);
extern(Windows) void /*APIENTRY*/glTexCoord3fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glTexCoord3i (GLint s, GLint t, GLint r);
extern(Windows) void /*APIENTRY*/glTexCoord3iv (GLint *v);
extern(Windows) void /*APIENTRY*/glTexCoord3s (GLshort s, GLshort t, GLshort r);
extern(Windows) void /*APIENTRY*/glTexCoord3sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glTexCoord4d (GLdouble s, GLdouble t, GLdouble r, GLdouble q);
extern(Windows) void /*APIENTRY*/glTexCoord4dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glTexCoord4f (GLfloat s, GLfloat t, GLfloat r, GLfloat q);
extern(Windows) void /*APIENTRY*/glTexCoord4fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glTexCoord4i (GLint s, GLint t, GLint r, GLint q);
extern(Windows) void /*APIENTRY*/glTexCoord4iv (GLint *v);
extern(Windows) void /*APIENTRY*/glTexCoord4s (GLshort s, GLshort t, GLshort r, GLshort q);
extern(Windows) void /*APIENTRY*/glTexCoord4sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glTexCoordPointer (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);
extern(Windows) void /*APIENTRY*/glTexEnvf (GLenum target, GLenum pname, GLfloat param);
extern(Windows) void /*APIENTRY*/glTexEnvfv (GLenum target, GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glTexEnvi (GLenum target, GLenum pname, GLint param);
extern(Windows) void /*APIENTRY*/glTexEnviv (GLenum target, GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glTexGend (GLenum coord, GLenum pname, GLdouble param);
extern(Windows) void /*APIENTRY*/glTexGendv (GLenum coord, GLenum pname, GLdouble *params);
extern(Windows) void /*APIENTRY*/glTexGenf (GLenum coord, GLenum pname, GLfloat param);
extern(Windows) void /*APIENTRY*/glTexGenfv (GLenum coord, GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glTexGeni (GLenum coord, GLenum pname, GLint param);
extern(Windows) void /*APIENTRY*/glTexGeniv (GLenum coord, GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, GLvoid *pixels);
extern(Windows) void /*APIENTRY*/glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid *pixels);
extern(Windows) void /*APIENTRY*/glTexParameterf (GLenum target, GLenum pname, GLfloat param);
extern(Windows) void /*APIENTRY*/glTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
extern(Windows) void /*APIENTRY*/glTexParameteri (GLenum target, GLenum pname, GLint param);
extern(Windows) void /*APIENTRY*/glTexParameteriv (GLenum target, GLenum pname, GLint *params);
extern(Windows) void /*APIENTRY*/glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, GLvoid *pixels);
extern(Windows) void /*APIENTRY*/glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels);
extern(Windows) void /*APIENTRY*/glTranslated (GLdouble x, GLdouble y, GLdouble z);
extern(Windows) void /*APIENTRY*/glTranslatef (GLfloat x, GLfloat y, GLfloat z);
extern(Windows) void /*APIENTRY*/glVertex2d (GLdouble x, GLdouble y);
extern(Windows) void /*APIENTRY*/glVertex2dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glVertex2f (GLfloat x, GLfloat y);
extern(Windows) void /*APIENTRY*/glVertex2fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glVertex2i (GLint x, GLint y);
extern(Windows) void /*APIENTRY*/glVertex2iv (GLint *v);
extern(Windows) void /*APIENTRY*/glVertex2s (GLshort x, GLshort y);
extern(Windows) void /*APIENTRY*/glVertex2sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glVertex3d (GLdouble x, GLdouble y, GLdouble z);
extern(Windows) void /*APIENTRY*/glVertex3dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glVertex3f (GLfloat x, GLfloat y, GLfloat z);
extern(Windows) void /*APIENTRY*/glVertex3fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glVertex3i (GLint x, GLint y, GLint z);
extern(Windows) void /*APIENTRY*/glVertex3iv (GLint *v);
extern(Windows) void /*APIENTRY*/glVertex3s (GLshort x, GLshort y, GLshort z);
extern(Windows) void /*APIENTRY*/glVertex3sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glVertex4d (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
extern(Windows) void /*APIENTRY*/glVertex4dv (GLdouble *v);
extern(Windows) void /*APIENTRY*/glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
extern(Windows) void /*APIENTRY*/glVertex4fv (GLfloat *v);
extern(Windows) void /*APIENTRY*/glVertex4i (GLint x, GLint y, GLint z, GLint w);
extern(Windows) void /*APIENTRY*/glVertex4iv (GLint *v);
extern(Windows) void /*APIENTRY*/glVertex4s (GLshort x, GLshort y, GLshort z, GLshort w);
extern(Windows) void /*APIENTRY*/glVertex4sv (GLshort *v);
extern(Windows) void /*APIENTRY*/glVertexPointer (GLint size, GLenum type, GLsizei stride, GLvoid *pointer);
extern(Windows) void /*APIENTRY*/glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
extern(Windows):
/* 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);
/* WIN_draw_range_elements */
typedef void (* PFNGLDRAWRANGEELEMENTSWINPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLvoid *indices);
/* WIN_swap_hint */
typedef void (* PFNGLADDSWAPHINTRECTWINPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
/* 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);
import openglu; a7xpg/import/SDL_mutex.d 0000666 0000000 0000000 00000011124 07732713606 014143 0 ustar root root /*
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
*/
/* Functions to provide thread synchronization primitives
These are independent of the other SDL routines.
*/
import SDL_types;
extern(C):
/* Synchronization functions which can time out return this value
if they time out.
*/
const uint SDL_MUTEX_TIMEDOUT = 1;
/* This is the timeout value which corresponds to never time out */
const uint SDL_MUTEX_MAXWAIT = 0xFFFFFFFF;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Mutex functions */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
struct SDL_mutex { }
/* Create a mutex, initialized unlocked */
SDL_mutex * SDL_CreateMutex();
/* Lock the mutex (Returns 0, or -1 on error) */
int SDL_LockMutex(SDL_mutex *m) { return SDL_mutexP(m); }
int SDL_mutexP(SDL_mutex *mutex);
/* Unlock the mutex (Returns 0, or -1 on error) */
int SDL_UnlockMutex(SDL_mutex* m) { return SDL_mutexV(m); }
int SDL_mutexV(SDL_mutex *mutex);
/* Destroy a mutex */
void SDL_DestroyMutex(SDL_mutex *mutex);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Semaphore functions */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
struct SDL_sem { }
/* Create a semaphore, initialized with value, returns NULL on failure. */
SDL_sem * SDL_CreateSemaphore(Uint32 initial_value);
/* Destroy a semaphore */
void SDL_DestroySemaphore(SDL_sem *sem);
/* This function suspends the calling thread until the semaphore pointed
* to by sem has a positive count. It then atomically decreases the semaphore
* count.
*/
int SDL_SemWait(SDL_sem *sem);
/* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds,
SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error.
*/
int SDL_SemTryWait(SDL_sem *sem);
/* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if
the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in
the allotted time, and -1 on error.
On some platforms this function is implemented by looping with a delay
of 1 ms, and so should be avoided if possible.
*/
int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms);
/* Atomically increases the semaphore's count (not blocking), returns 0,
or -1 on error.
*/
int SDL_SemPost(SDL_sem *sem);
/* Returns the current count of the semaphore */
Uint32 SDL_SemValue(SDL_sem *sem);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Condition variable functions */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
struct SDL_cond { }
/* Create a condition variable */
SDL_cond * SDL_CreateCond();
/* Destroy a condition variable */
void SDL_DestroyCond(SDL_cond *cond);
/* Restart one of the threads that are waiting on the condition variable,
returns 0 or -1 on error.
*/
int SDL_CondSignal(SDL_cond *cond);
/* Restart all threads that are waiting on the condition variable,
returns 0 or -1 on error.
*/
int SDL_CondBroadcast(SDL_cond *cond);
/* Wait on the condition variable, unlocking the provided mutex.
The mutex must be locked before entering this function!
Returns 0 when it is signaled, or -1 on error.
*/
int SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);
/* Waits for at most 'ms' milliseconds, and returns 0 if the condition
variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
signaled in the allotted time, and -1 on error.
On some platforms this function is implemented by looping with a delay
of 1 ms, and so should be avoided if possible.
*/
int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);
a7xpg/import/SDL_video.d 0000666 0000000 0000000 00000107103 07732713606 014112 0 ustar root root /*
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
*/
/* Header file for access to the SDL raw framebuffer window */
import SDL_types;
import SDL_mutex;
import SDL_rwops;
extern(C):
/* Transparency definitions: These define alpha as the opacity of a surface */
const uint SDL_ALPHA_OPAQUE = 255;
const uint SDL_ALPHA_TRANSPARENT = 0;
/* Useful data types */
struct SDL_Rect {
Sint16 x, y;
Uint16 w, h;
}
struct SDL_Color {
Uint8 r;
Uint8 g;
Uint8 b;
Uint8 unused;
}
struct SDL_Palette {
int ncolors;
SDL_Color *colors;
}
/* Everything in the pixel format structure is read-only */
struct SDL_PixelFormat {
SDL_Palette *palette;
Uint8 BitsPerPixel;
Uint8 BytesPerPixel;
Uint8 Rloss;
Uint8 Gloss;
Uint8 Bloss;
Uint8 Aloss;
Uint8 Rshift;
Uint8 Gshift;
Uint8 Bshift;
Uint8 Ashift;
Uint32 Rmask;
Uint32 Gmask;
Uint32 Bmask;
Uint32 Amask;
/* RGB color key information */
Uint32 colorkey;
/* Alpha value information (per-surface alpha) */
Uint8 alpha;
}
/* typedef for private surface blitting functions */
typedef int (*SDL_blit)(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
/* This structure should be treated as read-only, except for 'pixels',
which, if not NULL, contains the raw pixel data for the surface.
*/
struct SDL_Surface {
Uint32 flags; /* Read-only */
SDL_PixelFormat *format; /* Read-only */
int w, h; /* Read-only */
Uint16 pitch; /* Read-only */
void *pixels; /* Read-write */
int offset; /* Private */
/* Hardware-specific surface info */
void /*private_hwdata*/ *hwdata;
/* clipping information */
SDL_Rect clip_rect; /* Read-only */
Uint32 unused1; /* for binary compatibility */
/* Allow recursive locks */
Uint32 locked; /* Private */
/* info for fast blit mapping to other surfaces */
void /*SDL_BlitMap*/ *map; /* Private */
/* format version, bumped at every change to invalidate blit maps */
uint format_version; /* Private */
/* Reference count -- used when freeing surface */
int refcount; /* Read-mostly */
}
/* These are the currently supported flags for the SDL_surface */
/* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */
const uint SDL_SWSURFACE = 0x00000000; /* Surface is in system memory */
const uint SDL_HWSURFACE = 0x00000001; /* Surface is in video memory */
const uint SDL_ASYNCBLIT = 0x00000004; /* Use asynchronous blits if possible */
/* Available for SDL_SetVideoMode() */
const uint SDL_ANYFORMAT = 0x10000000; /* Allow any video depth/pixel-format */
const uint SDL_HWPALETTE = 0x20000000; /* Surface has exclusive palette */
const uint SDL_DOUBLEBUF = 0x40000000; /* Set up double-buffered video mode */
const uint SDL_FULLSCREEN = 0x80000000; /* Surface is a full screen display */
const uint SDL_OPENGL = 0x00000002; /* Create an OpenGL rendering context */
const uint SDL_OPENGLBLIT = 0x0000000A; /* Create an OpenGL rendering context and use it for blitting */
const uint SDL_RESIZABLE = 0x00000010; /* This video mode may be resized */
const uint SDL_NOFRAME = 0x00000020; /* No window caption or edge frame */
/* Used internally (read-only) */
const uint SDL_HWACCEL = 0x00000100; /* Blit uses hardware acceleration */
const uint SDL_SRCCOLORKEY = 0x00001000; /* Blit uses a source color key */
const uint SDL_RLEACCELOK = 0x00002000; /* Private flag */
const uint SDL_RLEACCEL = 0x00004000; /* Surface is RLE encoded */
const uint SDL_SRCALPHA = 0x00010000; /* Blit uses source alpha blending */
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)
{
return surface.offset || ((surface.flags &
(SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_RLEACCEL)) != 0);
}
/* Useful for determining the video hardware capabilities */
struct SDL_VideoInfo {
Uint32 flags;
// Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */
// Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */
// Uint32 UnusedBits1 :6;
// Uint32 UnusedBits2 :1;
// Uint32 blit_hw :1; /* Flag: Accelerated blits HW -. HW */
// Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */
// Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */
// Uint32 blit_sw :1; /* Flag: Accelerated blits SW -. HW */
// Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */
// Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */
// Uint32 blit_fill :1; /* Flag: Accelerated color fill */
// Uint32 UnusedBits3 :16;
Uint32 video_mem; /* The total amount of video memory (in K) */
SDL_PixelFormat *vfmt; /* Value: The format of the video surface */
}
/* The most common video overlay formats.
For an explanation of these pixel formats, see:
http://www.webartz.com/fourcc/indexyuv.htm
For information on the relationship between color spaces, see:
http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
*/
const uint SDL_YV12_OVERLAY = 0x32315659; /* Planar mode: Y + V + U (3 planes) */
const uint SDL_IYUV_OVERLAY = 0x56555949; /* Planar mode: Y + U + V (3 planes) */
const uint SDL_YUY2_OVERLAY = 0x32595559; /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
const uint SDL_UYVY_OVERLAY = 0x59565955; /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
const uint SDL_YVYU_OVERLAY = 0x55595659; /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
/* The YUV hardware video overlay */
struct SDL_Overlay {
Uint32 format; /* Read-only */
int w, h; /* Read-only */
int planes; /* Read-only */
Uint16 *pitches; /* Read-only */
Uint8 **pixels; /* Read-write */
/* Hardware-specific surface info */
void /*private_yuvhwfuncs*/ *hwfuncs;
void /*private_yuvhwdata*/ *hwdata;
/* Special flags */
union
{
bit hw_overlay;
Uint32 _dummy;
}
// Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */
// Uint32 UnusedBits :31;
}
/* Public enumeration for setting the OpenGL window attributes. */
alias int SDL_GLattr;
enum {
SDL_GL_RED_SIZE,
SDL_GL_GREEN_SIZE,
SDL_GL_BLUE_SIZE,
SDL_GL_ALPHA_SIZE,
SDL_GL_BUFFER_SIZE,
SDL_GL_DOUBLEBUFFER,
SDL_GL_DEPTH_SIZE,
SDL_GL_STENCIL_SIZE,
SDL_GL_ACCUM_RED_SIZE,
SDL_GL_ACCUM_GREEN_SIZE,
SDL_GL_ACCUM_BLUE_SIZE,
SDL_GL_ACCUM_ALPHA_SIZE
}
/* flags for SDL_SetPalette() */
const uint SDL_LOGPAL = 0x01;
const uint SDL_PHYSPAL = 0x02;
/* Function prototypes */
/* These functions are used internally, and should not be used unless you
* have a specific need to specify the video driver you want to use.
* You should normally use SDL_Init() or SDL_InitSubSystem().
*
* SDL_VideoInit() initializes the video subsystem -- sets up a connection
* to the window manager, etc, and determines the current video mode and
* pixel format, but does not initialize a window or graphics mode.
* Note that event handling is activated by this routine.
*
* If you use both sound and video in your application, you need to call
* SDL_Init() before opening the sound device, otherwise under Win32 DirectX,
* you won't be able to set full-screen display modes.
*/
int SDL_VideoInit(char *driver_name, Uint32 flags);
void SDL_VideoQuit();
/* This function fills the given character buffer with the name of the
* video driver, and returns a pointer to it if the video driver has
* been initialized. It returns NULL if no driver has been initialized.
*/
char *SDL_VideoDriverName(char *namebuf, int maxlen);
/*
* This function returns a pointer to the current display surface.
* If SDL is doing format conversion on the display surface, this
* function returns the publicly visible surface, not the real video
* surface.
*/
SDL_Surface * SDL_GetVideoSurface();
/*
* This function returns a read-only pointer to information about the
* video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt'
* member of the returned structure will contain the pixel format of the
* "best" video mode.
*/
SDL_VideoInfo * SDL_GetVideoInfo();
/*
* Check to see if a particular video mode is supported.
* It returns 0 if the requested mode is not supported under any bit depth,
* or returns the bits-per-pixel of the closest available mode with the
* given width and height. If this bits-per-pixel is different from the
* one used when setting the video mode, SDL_SetVideoMode() will succeed,
* but will emulate the requested bits-per-pixel with a shadow surface.
*
* The arguments to SDL_VideoModeOK() are the same ones you would pass to
* SDL_SetVideoMode()
*/
int SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);
/*
* Return a pointer to an array of available screen dimensions for the
* given format and video flags, sorted largest to smallest. Returns
* NULL if there are no dimensions available for a particular format,
* or (SDL_Rect **)-1 if any dimension is okay for the given format.
*
* If 'format' is NULL, the mode list will be for the format given
* by SDL_GetVideoInfo().vfmt
*/
SDL_Rect ** SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
/*
* Set up a video mode with the specified width, height and bits-per-pixel.
*
* If 'bpp' is 0, it is treated as the current display bits per pixel.
*
* If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the
* requested bits-per-pixel, but will return whatever video pixel format is
* available. The default is to emulate the requested pixel format if it
* is not natively available.
*
* If SDL_HWSURFACE is set in 'flags', the video surface will be placed in
* video memory, if possible, and you may have to call SDL_LockSurface()
* in order to access the raw framebuffer. Otherwise, the video surface
* will be created in system memory.
*
* If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle
* updates asynchronously, but you must always lock before accessing pixels.
* SDL will wait for updates to complete before returning from the lock.
*
* If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee
* that the colors set by SDL_SetColors() will be the colors you get.
* Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all
* of the colors exactly the way they are requested, and you should look
* at the video surface structure to determine the actual palette.
* If SDL cannot guarantee that the colors you request can be set,
* i.e. if the colormap is shared, then the video surface may be created
* under emulation in system memory, overriding the SDL_HWSURFACE flag.
*
* If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set
* a fullscreen video mode. The default is to create a windowed mode
* if the current graphics system has a window manager.
* If the SDL library is able to set a fullscreen video mode, this flag
* will be set in the surface that is returned.
*
* If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up
* two surfaces in video memory and swap between them when you call
* SDL_Flip(). This is usually slower than the normal single-buffering
* scheme, but prevents "tearing" artifacts caused by modifying video
* memory while the monitor is refreshing. It should only be used by
* applications that redraw the entire screen on every update.
*
* If SDL_RESIZABLE is set in 'flags', the SDL library will allow the
* window manager, if any, to resize the window at runtime. When this
* occurs, SDL will send a SDL_VIDEORESIZE event to you application,
* and you must respond to the event by re-calling SDL_SetVideoMode()
* with the requested size (or another size that suits the application).
*
* If SDL_NOFRAME is set in 'flags', the SDL library will create a window
* without any title bar or frame decoration. Fullscreen video modes have
* this flag set automatically.
*
* This function returns the video framebuffer surface, or NULL if it fails.
*
* If you rely on functionality provided by certain video flags, check the
* flags of the returned surface to make sure that functionality is available.
* SDL will fall back to reduced functionality if the exact flags you wanted
* are not available.
*/
SDL_Surface *SDL_SetVideoMode
(int width, int height, int bpp, Uint32 flags);
/*
* Makes sure the given list of rectangles is updated on the given screen.
* If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
* screen.
* These functions should not be called while 'screen' is locked.
*/
void SDL_UpdateRects
(SDL_Surface *screen, int numrects, SDL_Rect *rects);
void SDL_UpdateRect
(SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
/*
* On hardware that supports double-buffering, this function sets up a flip
* and returns. The hardware will wait for vertical retrace, and then swap
* video buffers before the next video surface blit or lock will return.
* On hardware that doesn not support double-buffering, this is equivalent
* to calling SDL_UpdateRect(screen, 0, 0, 0, 0);
* The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when
* setting the video mode for this function to perform hardware flipping.
* This function returns 0 if successful, or -1 if there was an error.
*/
int SDL_Flip(SDL_Surface *screen);
/*
* Set the gamma correction for each of the color channels.
* The gamma values range (approximately) between 0.1 and 10.0
*
* If this function isn't supported directly by the hardware, it will
* be emulated using gamma ramps, if available. If successful, this
* function returns 0, otherwise it returns -1.
*/
int SDL_SetGamma(float red, float green, float blue);
/*
* Set the gamma translation table for the red, green, and blue channels
* of the video hardware. Each table is an array of 256 16-bit quantities,
* representing a mapping between the input and output for that channel.
* The input is the index into the array, and the output is the 16-bit
* gamma value at that index, scaled to the output color precision.
*
* You may pass NULL for any of the channels to leave it unchanged.
* If the call succeeds, it will return 0. If the display driver or
* hardware does not support gamma translation, or otherwise fails,
* this function will return -1.
*/
int SDL_SetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue);
/*
* Retrieve the current values of the gamma translation tables.
*
* You must pass in valid pointers to arrays of 256 16-bit quantities.
* Any of the pointers may be NULL to ignore that channel.
* If the call succeeds, it will return 0. If the display driver or
* hardware does not support gamma translation, or otherwise fails,
* this function will return -1.
*/
int SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue);
/*
* Sets a portion of the colormap for the given 8-bit surface. If 'surface'
* is not a palettized surface, this function does nothing, returning 0.
* If all of the colors were set as passed to SDL_SetColors(), it will
* return 1. If not all the color entries were set exactly as given,
* it will return 0, and you should look at the surface palette to
* determine the actual color palette.
*
* When 'surface' is the surface associated with the current display, the
* display colormap will be updated with the requested colors. If
* SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
* will always return 1, and the palette is guaranteed to be set the way
* you desire, even if the window colormap has to be warped or run under
* emulation.
*/
int SDL_SetColors(SDL_Surface *surface,
SDL_Color *colors, int firstcolor, int ncolors);
/*
* Sets a portion of the colormap for a given 8-bit surface.
* 'flags' is one or both of:
* SDL_LOGPAL -- set logical palette, which controls how blits are mapped
* to/from the surface,
* SDL_PHYSPAL -- set physical palette, which controls how pixels look on
* the screen
* Only screens have physical palettes. Separate change of physical/logical
* palettes is only possible if the screen has SDL_HWPALETTE set.
*
* The return value is 1 if all colours could be set as requested, and 0
* otherwise.
*
* SDL_SetColors() is equivalent to calling this function with
* flags = (SDL_LOGPAL|SDL_PHYSPAL).
*/
int SDL_SetPalette(SDL_Surface *surface, int flags,
SDL_Color *colors, int firstcolor,
int ncolors);
/*
* Maps an RGB triple to an opaque pixel value for a given pixel format
*/
Uint32 SDL_MapRGB
(SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b);
/*
* Maps an RGBA quadruple to a pixel value for a given pixel format
*/
Uint32 SDL_MapRGBA(SDL_PixelFormat *format,
Uint8 r, Uint8 g, Uint8 b, Uint8 a);
/*
* Maps a pixel value into the RGB components for a given pixel format
*/
void SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt,
Uint8 *r, Uint8 *g, Uint8 *b);
/*
* Maps a pixel value into the RGBA components for a given pixel format
*/
void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt,
Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
/*
* Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
* If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
* If the depth is greater than 8 bits, the pixel format is set using the
* flags '[RGB]mask'.
* If the function runs out of memory, it will return NULL.
*
* The 'flags' tell what kind of surface to create.
* SDL_SWSURFACE means that the surface should be created in system memory.
* SDL_HWSURFACE means that the surface should be created in video memory,
* with the same format as the display surface. This is useful for surfaces
* that will not change much, to take advantage of hardware acceleration
* when being blitted to the display surface.
* SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with
* this surface, but you must always lock it before accessing the pixels.
* SDL will wait for current blits to finish before returning from the lock.
* SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
* If the hardware supports acceleration of colorkey blits between
* two surfaces in video memory, SDL will try to place the surface in
* video memory. If this isn't possible or if there is no hardware
* acceleration available, the surface will be placed in system memory.
* SDL_SRCALPHA means that the surface will be used for alpha blits and
* if the hardware supports hardware acceleration of alpha blits between
* two surfaces in video memory, to place the surface in video memory
* if possible, otherwise it will be placed in system memory.
* If the surface is created in video memory, blits will be _much_ faster,
* but the surface format must be identical to the video surface format,
* and the only way to access the pixels member of the surface is to use
* the SDL_LockSurface() and SDL_UnlockSurface() calls.
* If the requested surface actually resides in video memory, SDL_HWSURFACE
* will be set in the flags member of the returned surface. If for some
* reason the surface could not be placed in video memory, it will not have
* the SDL_HWSURFACE flag set, and will be created in system memory instead.
*/
SDL_Surface *SDL_CreateRGBSurface
(Uint32 flags, int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels,
int width, int height, int depth, int pitch,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
void SDL_FreeSurface(SDL_Surface *surface);
SDL_Surface *SDL_AllocSurface
(Uint32 flags, int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
{
return SDL_CreateRGBSurface(flags, width, height, depth,
Rmask, Gmask, Bmask, Amask);
}
/*
* SDL_LockSurface() sets up a surface for directly accessing the pixels.
* Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
* to and read from 'surface.pixels', using the pixel format stored in
* 'surface.format'. Once you are done accessing the surface, you should
* use SDL_UnlockSurface() to release it.
*
* Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
* to 0, then you can read and write to the surface at any time, and the
* pixel format of the surface will not change. In particular, if the
* SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you
* will not need to lock the display surface before accessing it.
*
* No operating system or library calls should be made between lock/unlock
* pairs, as critical system locks may be held during this time.
*
* SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
*/
int SDL_LockSurface(SDL_Surface *surface);
void SDL_UnlockSurface(SDL_Surface *surface);
/*
* Load a surface from a seekable SDL data source (memory or file.)
* If 'freesrc' is non-zero, the source will be closed after being read.
* Returns the new surface, or NULL if there was an error.
* The new surface should be freed with SDL_FreeSurface().
*/
SDL_Surface * SDL_LoadBMP_RW(SDL_RWops *src, int freesrc);
/* Convenience macro -- load a surface from a file */
SDL_Surface * SDL_LoadBMP(char* file)
{
return SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1);
}
/*
* Save a surface to a seekable SDL data source (memory or file.)
* If 'freedst' is non-zero, the source will be closed after being written.
* Returns 0 if successful or -1 if there was an error.
*/
int SDL_SaveBMP_RW
(SDL_Surface *surface, SDL_RWops *dst, int freedst);
/* Convenience macro -- save a surface to a file */
int SDL_SaveBMP(SDL_Surface *surface, char* file)
{
return SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1);
}
/*
* Sets the color key (transparent pixel) in a blittable surface.
* If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL),
* 'key' will be the transparent pixel in the source image of a blit.
* SDL_RLEACCEL requests RLE acceleration for the surface if present,
* and removes RLE acceleration if absent.
* If 'flag' is 0, this function clears any current color key.
* This function returns 0, or -1 if there was an error.
*/
int SDL_SetColorKey
(SDL_Surface *surface, Uint32 flag, Uint32 key);
/*
* This function sets the alpha value for the entire surface, as opposed to
* using the alpha component of each pixel. This value measures the range
* of transparency of the surface, 0 being completely transparent to 255
* being completely opaque. An 'alpha' value of 255 causes blits to be
* opaque, the source pixels copied to the destination (the default). Note
* that per-surface alpha can be combined with colorkey transparency.
*
* If 'flag' is 0, alpha blending is disabled for the surface.
* If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
* OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
* surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
*/
int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
/*
* Sets the clipping rectangle for the destination surface in a blit.
*
* If the clip rectangle is NULL, clipping will be disabled.
* If the clip rectangle doesn't intersect the surface, the function will
* return SDL_FALSE and blits will be completely clipped. Otherwise the
* function returns SDL_TRUE and blits to the surface will be clipped to
* the intersection of the surface area and the clipping rectangle.
*
* Note that blits are automatically clipped to the edges of the source
* and destination surfaces.
*/
SDL_bool SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect);
/*
* Gets the clipping rectangle for the destination surface in a blit.
* 'rect' must be a pointer to a valid rectangle which will be filled
* with the correct values.
*/
void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect);
/*
* Creates a new surface of the specified format, and then copies and maps
* the given surface to it so the blit of the converted surface will be as
* fast as possible. If this function fails, it returns NULL.
*
* The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those
* semantics. You can also pass SDL_RLEACCEL in the flags parameter and
* SDL will try to RLE accelerate colorkey and alpha blits in the resulting
* surface.
*
* This function is used internally by SDL_DisplayFormat().
*/
SDL_Surface *SDL_ConvertSurface
(SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);
/*
* This performs a fast blit from the source surface to the destination
* surface. It assumes that the source and destination rectangles are
* the same size. If either 'srcrect' or 'dstrect' are NULL, the entire
* surface (src or dst) is copied. The final blit rectangles are saved
* in 'srcrect' and 'dstrect' after all clipping is performed.
* If the blit is successful, it returns 0, otherwise it returns -1.
*
* The blit function should not be called on a locked surface.
*
* The blit semantics for surfaces with and without alpha and colorkey
* are defined as follows:
*
* RGBA.RGB:
* SDL_SRCALPHA set:
* alpha-blend (using alpha-channel).
* SDL_SRCCOLORKEY ignored.
* SDL_SRCALPHA not set:
* copy RGB.
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* RGB values of the source colour key, ignoring alpha in the
* comparison.
*
* RGB.RGBA:
* SDL_SRCALPHA set:
* alpha-blend (using the source per-surface alpha value);
* set destination alpha to opaque.
* SDL_SRCALPHA not set:
* copy RGB, set destination alpha to opaque.
* both:
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* source colour key.
*
* RGBA.RGBA:
* SDL_SRCALPHA set:
* alpha-blend (using the source alpha channel) the RGB values;
* leave destination alpha untouched. [Note: is this correct?]
* SDL_SRCCOLORKEY ignored.
* SDL_SRCALPHA not set:
* copy all of RGBA to the destination.
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* RGB values of the source colour key, ignoring alpha in the
* comparison.
*
* RGB.RGB:
* SDL_SRCALPHA set:
* alpha-blend (using the source per-surface alpha value).
* SDL_SRCALPHA not set:
* copy RGB.
* both:
* if SDL_SRCCOLORKEY set, only copy the pixels matching the
* source colour key.
*
* If either of the surfaces were in video memory, and the blit returns -2,
* the video memory was lost, so it should be reloaded with artwork and
* re-blitted:
while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
while ( SDL_LockSurface(image) < 0 )
Sleep(10);
-- Write image pixels to image.pixels --
SDL_UnlockSurface(image);
}
* This happens under DirectX 5.0 when the system switches away from your
* fullscreen application. The lock will also fail until you have access
* to the video memory again.
*/
/* You should call SDL_BlitSurface() unless you know exactly how SDL
blitting works internally and how to use the other blit functions.
*/
/* This is the public blit function, SDL_BlitSurface(), and it performs
rectangle validation and clipping before passing it to SDL_LowerBlit()
*/
int SDL_UpperBlit
(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
/* This is a semi-private blit function and it performs low-level surface
blitting only.
*/
int SDL_LowerBlit
(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
int SDL_BlitSurface
(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect)
{
return SDL_UpperBlit(src, srcrect, dst, dstrect);
}
/*
* This function performs a fast fill of the given rectangle with 'color'
* The given rectangle is clipped to the destination surface clip area
* and the final fill rectangle is saved in the passed in pointer.
* If 'dstrect' is NULL, the whole surface will be filled with 'color'
* The color should be a pixel of the format used by the surface, and
* can be generated by the SDL_MapRGB() function.
* This function returns 0 on success, or -1 on error.
*/
int SDL_FillRect
(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
/*
* This function takes a surface and copies it to a new surface of the
* pixel format and colors of the video framebuffer, suitable for fast
* blitting onto the display surface. It calls SDL_ConvertSurface()
*
* If you want to take advantage of hardware colorkey or alpha blit
* acceleration, you should set the colorkey and alpha value before
* calling this function.
*
* If the conversion fails or runs out of memory, it returns NULL
*/
SDL_Surface * SDL_DisplayFormat(SDL_Surface *surface);
/*
* This function takes a surface and copies it to a new surface of the
* pixel format and colors of the video framebuffer (if possible),
* suitable for fast alpha blitting onto the display surface.
* The new surface will always have an alpha channel.
*
* If you want to take advantage of hardware colorkey or alpha blit
* acceleration, you should set the colorkey and alpha value before
* calling this function.
*
* If the conversion fails or runs out of memory, it returns NULL
*/
SDL_Surface * SDL_DisplayFormatAlpha(SDL_Surface *surface);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* YUV video surface overlay functions */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* This function creates a video output overlay
Calling the returned surface an overlay is something of a misnomer because
the contents of the display surface underneath the area where the overlay
is shown is undefined - it may be overwritten with the converted YUV data.
*/
SDL_Overlay *SDL_CreateYUVOverlay(int width, int height,
Uint32 format, SDL_Surface *display);
/* Lock an overlay for direct access, and unlock it when you are done */
int SDL_LockYUVOverlay(SDL_Overlay *overlay);
void SDL_UnlockYUVOverlay(SDL_Overlay *overlay);
/* Blit a video overlay to the display surface.
The contents of the video surface underneath the blit destination are
not defined.
The width and height of the destination rectangle may be different from
that of the overlay, but currently only 2x scaling is supported.
*/
int SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect);
/* Free a video overlay */
void SDL_FreeYUVOverlay(SDL_Overlay *overlay);
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* OpenGL support functions. */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Dynamically load a GL driver, if SDL is built with dynamic GL.
*
* SDL links normally with the OpenGL library on your system by default,
* but you can compile it to dynamically load the GL driver at runtime.
* If you do this, you need to retrieve all of the GL functions used in
* your program from the dynamic library using SDL_GL_GetProcAddress().
*
* This is disabled in default builds of SDL.
*/
int SDL_GL_LoadLibrary(char *path);
/*
* Get the address of a GL function (for extension functions)
*/
void *SDL_GL_GetProcAddress(char* proc);
/*
* Set an attribute of the OpenGL subsystem before intialization.
*/
int SDL_GL_SetAttribute(SDL_GLattr attr, int value);
/*
* Get an attribute of the OpenGL subsystem from the windowing
* interface, such as glX. This is of course different from getting
* the values from SDL's internal OpenGL subsystem, which only
* stores the values you request before initialization.
*
* Developers should track the values they pass into SDL_GL_SetAttribute
* themselves if they want to retrieve these values.
*/
int SDL_GL_GetAttribute(SDL_GLattr attr, int* value);
/*
* Swap the OpenGL buffers, if double-buffering is supported.
*/
void SDL_GL_SwapBuffers();
/*
* Internal functions that should not be called unless you have read
* and understood the source code for these functions.
*/
void SDL_GL_UpdateRects(int numrects, SDL_Rect* rects);
void SDL_GL_Lock();
void SDL_GL_Unlock();
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* These functions allow interaction with the window manager, if any. */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
* Sets/Gets the title and icon text of the display window
*/
void SDL_WM_SetCaption(char *title, char *icon);
void SDL_WM_GetCaption(char **title, char **icon);
/*
* Sets the icon for the display window.
* This function must be called before the first call to SDL_SetVideoMode().
* It takes an icon surface, and a mask in MSB format.
* If 'mask' is NULL, the entire icon surface will be used as the icon.
*/
void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);
/*
* This function iconifies the window, and returns 1 if it succeeded.
* If the function succeeds, it generates an SDL_APPACTIVE loss event.
* This function is a noop and returns 0 in non-windowed environments.
*/
int SDL_WM_IconifyWindow();
/*
* Toggle fullscreen mode without changing the contents of the screen.
* If the display surface does not require locking before accessing
* the pixel information, then the memory pointers will not change.
*
* If this function was able to toggle fullscreen mode (change from
* running in a window to fullscreen, or vice-versa), it will return 1.
* If it is not implemented, or fails, it returns 0.
*
* The next call to SDL_SetVideoMode() will set the mode fullscreen
* attribute based on the flags parameter - if SDL_FULLSCREEN is not
* set, then the display will be windowed by default where supported.
*
* This is currently only implemented in the X11 video driver.
*/
int SDL_WM_ToggleFullScreen(SDL_Surface *surface);
/*
* This function allows you to set and query the input grab state of
* the application. It returns the new input grab state.
*/
alias int SDL_GrabMode;
enum {
SDL_GRAB_QUERY = -1,
SDL_GRAB_OFF = 0,
SDL_GRAB_ON = 1,
SDL_GRAB_FULLSCREEN /* Used internally */
}
/*
* Grabbing means that the mouse is confined to the application window,
* and nearly all keyboard input is passed directly to the application,
* and not interpreted by a window manager, if any.
*/
SDL_GrabMode SDL_WM_GrabInput(SDL_GrabMode mode);
/* Not in public API at the moment - do not use! */
int SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect,
SDL_Surface *dst, SDL_Rect *dstrect);
a7xpg/import/SDL_timer.d 0000666 0000000 0000000 00000007556 07732713606 014137 0 ustar root root /*
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
*/
import SDL_types;
extern(C):
/* This is the OS scheduler timeslice, in milliseconds */
const uint SDL_TIMESLICE = 10;
/* This is the maximum resolution of the SDL timer on all platforms */
const uint TIMER_RESOLUTION = 10; /* Experimentally determined */
/* Get the number of milliseconds since the SDL library initialization.
* Note that this value wraps if the program runs for more than ~49 days.
*/
Uint32 SDL_GetTicks();
/* Wait a specified number of milliseconds before returning */
void SDL_Delay(Uint32 ms);
/* Function prototype for the timer callback function */
alias Uint32 (*SDL_TimerCallback)(Uint32 interval);
/* Set a callback to run after the specified number of milliseconds has
* elapsed. The callback function is passed the current timer interval
* and returns the next timer interval. If the returned value is the
* same as the one passed in, the periodic alarm continues, otherwise a
* new alarm is scheduled. If the callback returns 0, the periodic alarm
* is cancelled.
*
* To cancel a currently running timer, call SDL_SetTimer(0, NULL);
*
* The timer callback function may run in a different thread than your
* main code, and so shouldn't call any functions from within itself.
*
* The maximum resolution of this timer is 10 ms, which means that if
* you request a 16 ms timer, your callback will run approximately 20 ms
* later on an unloaded system. If you wanted to set a flag signaling
* a frame update at 30 frames per second (every 33 ms), you might set a
* timer for 30 ms:
* SDL_SetTimer((33/10)*10, flag_update);
*
* If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init().
*
* Under UNIX, you should not use raise or use SIGALRM and this function
* in the same program, as it is implemented using setitimer(). You also
* should not use this function in multi-threaded applications as signals
* to multi-threaded apps have undefined behavior in some implementations.
*/
int SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);
/* New timer API, supports multiple timers
* Written by Stephane Peter
*/
/* Function prototype for the new timer callback function.
* The callback function is passed the current timer interval and returns
* the next timer interval. If the returned value is the same as the one
* 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);
/* Definition of the timer ID type */
alias void *SDL_TimerID;
/* Add a new timer to the pool of timers already running.
Returns a timer ID, or NULL when an error occurs.
*/
SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);
/* Remove one of the multiple timers knowing its ID.
* Returns a boolean value indicating success.
*/
SDL_bool SDL_RemoveTimer(SDL_TimerID t);
a7xpg/import/SDL_byteorder.d 0000666 0000000 0000000 00000002632 07732713606 015004 0 ustar root root /*
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
*/
/* Macros for determining the byte-order of this platform */
/* The two types of endianness */
const uint SDL_LIL_ENDIAN = 1234;
const uint SDL_BIG_ENDIAN = 4321;
/* Pardon the mess, I'm trying to determine the endianness of this host.
I'm doing it by preprocessor defines rather than some sort of configure
script so that application code can use this too. The "right" way would
be to dynamically generate this file on install, but that's a lot of work.
*/
const uint SDL_BYTEORDER = SDL_LIL_ENDIAN;
a7xpg/import/SDL_mouse.d 0000666 0000000 0000000 00000007620 07732713606 014137 0 ustar root root /*
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
*/
/* Include file for SDL mouse event handling */
import SDL_types;
import SDL_video;
extern(C):
struct SDL_Cursor {
SDL_Rect area; /* The area of the mouse cursor */
Sint16 hot_x, hot_y; /* The "tip" of the cursor */
Uint8 *data; /* B/W cursor data */
Uint8 *mask; /* B/W cursor mask */
Uint8 *save[2]; /* Place to save cursor area */
void /*WMcursor*/ *wm_cursor; /* Window-manager cursor */
}
/* Function prototypes */
/*
* Retrieve the current state of the mouse.
* The current button state is returned as a button bitmask, which can
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
* current mouse cursor position. You can pass NULL for either x or y.
*/
Uint8 SDL_GetMouseState(int *x, int *y);
/*
* Retrieve the current state of the mouse.
* The current button state is returned as a button bitmask, which can
* be tested using the SDL_BUTTON(X) macros, and x and y are set to the
* mouse deltas since the last call to SDL_GetRelativeMouseState().
*/
Uint8 SDL_GetRelativeMouseState(int *x, int *y);
/*
* Set the position of the mouse cursor (generates a mouse motion event)
*/
void SDL_WarpMouse(Uint16 x, Uint16 y);
/*
* Create a cursor using the specified data and mask (in MSB format).
* The cursor width must be a multiple of 8 bits.
*
* The cursor is created in black and white according to the following:
* data mask resulting pixel on screen
* 0 1 White
* 1 1 Black
* 0 0 Transparent
* 1 0 Inverted color if possible, black if not.
*
* Cursors created with this function must be freed with SDL_FreeCursor().
*/
SDL_Cursor *SDL_CreateCursor
(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
/*
* Set the currently active cursor to the specified one.
* If the cursor is currently visible, the change will be immediately
* represented on the display.
*/
void SDL_SetCursor(SDL_Cursor *cursor);
/*
* Returns the currently active cursor.
*/
SDL_Cursor * SDL_GetCursor();
/*
* Deallocates a cursor created with SDL_CreateCursor().
*/
void SDL_FreeCursor(SDL_Cursor *cursor);
/*
* Toggle whether or not the cursor is shown on the screen.
* The cursor start off displayed, but can be turned off.
* SDL_ShowCursor() returns 1 if the cursor was being displayed
* before the call, or 0 if it was not. You can query the current
* state by passing a 'toggle' value of -1.
*/
int SDL_ShowCursor(int toggle);
/* Used as a mask when testing buttons in buttonstate
Button 1: Left mouse button
Button 2: Middle mouse button
Button 3: Right mouse button
*/
uint SDL_BUTTON(uint X) { return SDL_PRESSED << (X-1); }
const uint SDL_BUTTON_LEFT = 1;
const uint SDL_BUTTON_MIDDLE = 2;
const uint SDL_BUTTON_RIGHT = 3;
const uint SDL_BUTTON_LMASK = SDL_PRESSED << (SDL_BUTTON_LEFT - 1);
const uint SDL_BUTTON_MMASK = SDL_PRESSED << (SDL_BUTTON_MIDDLE - 1);
const uint SDL_BUTTON_RMASK = SDL_PRESSED << (SDL_BUTTON_RIGHT - 1);
a7xpg/import/SDL_getenv.d 0000666 0000000 0000000 00000000560 07732713606 014273 0 ustar root root /* Not all environments have a working getenv()/putenv() */
extern(C):
/* Put a variable of the form "name=value" into the environment */
int SDL_putenv(char *variable);
int putenv(char* X) { return SDL_putenv(X); }
/* Retrieve a variable named "name" from the environment */
char *SDL_getenv(char *name);
char *getenv(char* X) { return SDL_getenv(X); }
a7xpg/import/SDL_keyboard.d 0000666 0000000 0000000 00000007042 07732713606 014605 0 ustar root root /*
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
*/
/* Include file for SDL keyboard event handling */
import SDL_types;
// !!! A hack! struct SDL_keysym is defined in this module,
// !!! so we need to resolve the nameclash...
// !!! Definitely won't work on *NIX but for now will do.
import SDL_Keysym;
extern(C):
/* Keysym structure
- The scancode is hardware dependent, and should not be used by general
applications. If no hardware scancode is available, it will be 0.
- The 'unicode' translated character is only available when character
translation is enabled by the SDL_EnableUNICODE() API. If non-zero,
this is a UNICODE character corresponding to the keypress. If the
high 9 bits of the character are 0, then this maps to the equivalent
ASCII character:
char ch;
if ( (keysym.unicode & 0xFF80) == 0 ) {
ch = keysym.unicode & 0x7F;
} else {
An international character..
}
*/
struct SDL_keysym {
Uint8 scancode; /* hardware specific scancode */
SDLKey sym; /* SDL virtual keysym */
SDLMod mod; /* current key modifiers */
Uint16 unicode; /* translated character */
}
/* This is the mask which refers to all hotkey bindings */
const uint SDL_ALL_HOTKEYS = 0xFFFFFFFF;
/* Function prototypes */
/*
* Enable/Disable UNICODE translation of keyboard input.
* This translation has some overhead, so translation defaults off.
* If 'enable' is 1, translation is enabled.
* If 'enable' is 0, translation is disabled.
* If 'enable' is -1, the translation state is not changed.
* It returns the previous state of keyboard translation.
*/
int SDL_EnableUNICODE(int enable);
/*
* Enable/Disable keyboard repeat. Keyboard repeat defaults to off.
* 'delay' is the initial delay in ms between the time when a key is
* pressed, and keyboard repeat begins.
* 'interval' is the time in ms between keyboard repeat events.
*/
const uint SDL_DEFAULT_REPEAT_DELAY = 500;
const uint SDL_DEFAULT_REPEAT_INTERVAL = 30;
/*
* If 'delay' is set to 0, keyboard repeat is disabled.
*/
int SDL_EnableKeyRepeat(int delay, int interval);
/*
* Get a snapshot of the current state of the keyboard.
* Returns an array of keystates, indexed by the SDLK_* syms.
* Used:
* Uint8 *keystate = SDL_GetKeyState(NULL);
* if ( keystate[SDLK_RETURN] ) ... is pressed.
*/
Uint8 * SDL_GetKeyState(int *numkeys);
/*
* Get the current key modifier state
*/
SDLMod SDL_GetModState();
/*
* Set the current key modifier state
* This does not change the keyboard state, only the key modifier flags.
*/
void SDL_SetModState(SDLMod modstate);
/*
* Get the name of an SDL virtual keysym
*/
char * SDL_GetKeyName(SDLKey key);
a7xpg/import/SDL_error.d 0000666 0000000 0000000 00000002476 07732713606 014144 0 ustar root root /*
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
*/
/* Simple error message routines for SDL */
extern(C):
/* Public functions */
void SDL_SetError(char *fmt, ...);
char * SDL_GetError();
void SDL_ClearError();
/* Private error message function - used internally */
//#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
alias int SDL_errorcode;
enum {
SDL_ENOMEM,
SDL_EFREAD,
SDL_EFWRITE,
SDL_EFSEEK,
SDL_LASTERROR
}
extern void SDL_Error(SDL_errorcode code);
a7xpg/import/SDL_types.d 0000666 0000000 0000000 00000002443 07732713606 014151 0 ustar root root /*
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
*/
/* General data types used by the SDL library */
/* Basic data types */
alias int SDL_bool;
enum {
SDL_FALSE = 0,
SDL_TRUE = 1
}
alias ubyte Uint8;
alias byte Sint8;
alias ushort Uint16;
alias short Sint16;
alias uint Uint32;
alias int Sint32;
alias ulong Uint64;
alias long Sint64;
/* General keyboard/mouse state definitions */
enum { SDL_PRESSED = 0x01, SDL_RELEASED = 0x00 };
a7xpg/import/SDL_version.d 0000666 0000000 0000000 00000004441 07732713606 014472 0 ustar root root /*
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 = 3;
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();
a7xpg/import/SDL_cdrom.d 0000666 0000000 0000000 00000012155 07732713606 014112 0 ustar root root /*
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 is the CD-audio control API for Simple DirectMedia Layer */
import SDL_types;
extern(C):
/* In order to use these functions, SDL_Init() must have been called
with the SDL_INIT_CDROM flag. This causes SDL to scan the system
for CD-ROM drives, and load appropriate drivers.
*/
/* The maximum number of CD-ROM tracks on a disk */
const int SDL_MAX_TRACKS = 99;
/* The types of CD-ROM track possible */
const uint SDL_AUDIO_TRACK = 0x00;
const uint SDL_DATA_TRACK = 0x04;
/* The possible states which a CD-ROM drive can be in. */
alias int CDstatus;
enum {
CD_TRAYEMPTY,
CD_STOPPED,
CD_PLAYING,
CD_PAUSED,
CD_ERROR = -1
}
/* Given a status, returns true if there's a disk in the drive */
bit CD_INDRIVE(int status) { return status > 0; }
struct SDL_CDtrack {
Uint8 id; /* Track number */
Uint8 type; /* Data or audio track */
Uint16 unused;
Uint32 length; /* Length, in frames, of this track */
Uint32 offset; /* Offset, in frames, from start of disk */
}
/* This structure is only current as of the last call to SDL_CDStatus() */
struct SDL_CD {
int id; /* Private drive identifier */
CDstatus status; /* Current drive status */
/* The rest of this structure is only valid if there's a CD in drive */
int numtracks; /* Number of tracks on disk */
int cur_track; /* Current track position */
int cur_frame; /* Current frame offset within current track */
SDL_CDtrack track[SDL_MAX_TRACKS+1];
}
/* Conversion functions from frames to Minute/Second/Frames and vice versa */
const uint CD_FPS = 75;
void FRAMES_TO_MSF(int f, out int M, out int S, out int F)
{
int value = f;
F = value % CD_FPS;
value /= CD_FPS;
S = value % 60;
value /= 60;
M = value;
}
int MSF_TO_FRAMES(int M, int S, int F)
{
return M * 60 * CD_FPS + S * CD_FPS + F;
}
/* CD-audio API functions: */
/* Returns the number of CD-ROM drives on the system, or -1 if
SDL_Init() has not been called with the SDL_INIT_CDROM flag.
*/
int SDL_CDNumDrives();
/* Returns a human-readable, system-dependent identifier for the CD-ROM.
Example:
"/dev/cdrom"
"E:"
"/dev/disk/ide/1/master"
*/
char * SDL_CDName(int drive);
/* Opens a CD-ROM drive for access. It returns a drive handle on success,
or NULL if the drive was invalid or busy. This newly opened CD-ROM
becomes the default CD used when other CD functions are passed a NULL
CD-ROM handle.
Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
*/
SDL_CD * SDL_CDOpen(int drive);
/* This function returns the current status of the given drive.
If the drive has a CD in it, the table of contents of the CD and current
play position of the CD will be stored in the SDL_CD structure.
*/
CDstatus SDL_CDStatus(SDL_CD *cdrom);
/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
until the end of the CD. This function will skip data tracks.
This function should only be called after calling SDL_CDStatus() to
get track information about the CD.
For example:
// Play entire CD:
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
// Play last track:
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
}
// Play first and second track and 10 seconds of third track:
if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);
This function returns 0, or -1 if there was an error.
*/
int SDL_CDPlayTracks(SDL_CD *cdrom,
int start_track, int start_frame, int ntracks, int nframes);
/* Play the given CD starting at 'start' frame for 'length' frames.
It returns 0, or -1 if there was an error.
*/
int SDL_CDPlay(SDL_CD *cdrom, int start, int length);
/* Pause play -- returns 0, or -1 on error */
int SDL_CDPause(SDL_CD *cdrom);
/* Resume play -- returns 0, or -1 on error */
int SDL_CDResume(SDL_CD *cdrom);
/* Stop play -- returns 0, or -1 on error */
int SDL_CDStop(SDL_CD *cdrom);
/* Eject CD-ROM -- returns 0, or -1 on error */
int SDL_CDEject(SDL_CD *cdrom);
/* Closes the handle for the CD-ROM drive */
void SDL_CDClose(SDL_CD *cdrom);
a7xpg/import/SDL_copying.d 0000666 0000000 0000000 00000001610 07732713606 014450 0 ustar root root /*
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
*/
a7xpg/import/SDL_keysym.d 0000666 0000000 0000000 00000016417 07732713606 014334 0 ustar root root /*
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);
a7xpg/import/openglu.d 0000666 0000000 0000000 00000036633 07732713606 013764 0 ustar root root import opengl;
extern(Windows):
GLubyte* gluErrorString (
GLenum errCode);
wchar* gluErrorUnicodeStringEXT (
GLenum errCode);
GLubyte* gluGetString (
GLenum name);
void gluOrtho2D (
GLdouble left,
GLdouble right,
GLdouble bottom,
GLdouble top);
void gluPerspective (
GLdouble fovy,
GLdouble aspect,
GLdouble zNear,
GLdouble zFar);
void gluPickMatrix (
GLdouble x,
GLdouble y,
GLdouble width,
GLdouble height,
GLint[4] viewport);
void gluLookAt (
GLdouble eyex,
GLdouble eyey,
GLdouble eyez,
GLdouble centerx,
GLdouble centery,
GLdouble centerz,
GLdouble upx,
GLdouble upy,
GLdouble upz);
int gluProject (
GLdouble objx,
GLdouble objy,
GLdouble objz,
GLdouble[16] modelMatrix,
GLdouble[16] projMatrix,
GLint[4] viewport,
GLdouble *winx,
GLdouble *winy,
GLdouble *winz);
int gluUnProject (
GLdouble winx,
GLdouble winy,
GLdouble winz,
GLdouble[16] modelMatrix,
GLdouble[16] projMatrix,
GLint[4] viewport,
GLdouble *objx,
GLdouble *objy,
GLdouble *objz);
int gluScaleImage (
GLenum format,
GLint widthin,
GLint heightin,
GLenum typein,
void *datain,
GLint widthout,
GLint heightout,
GLenum typeout,
void *dataout);
int gluBuild1DMipmaps (
GLenum target,
GLint components,
GLint width,
GLenum format,
GLenum type,
void *data);
int gluBuild2DMipmaps (
GLenum target,
GLint components,
GLint width,
GLint height,
GLenum format,
GLenum type,
void *data);
struct GLUnurbs { }
struct GLUquadric { }
struct GLUtesselator { }
/* backwards compatibility: */
alias GLUnurbs GLUnurbsObj;
alias GLUquadric GLUquadricObj;
alias GLUtesselator GLUtesselatorObj;
alias GLUtesselator GLUtriangulatorObj;
GLUquadric* gluNewQuadric ();
void gluDeleteQuadric (
GLUquadric *state);
void gluQuadricNormals (
GLUquadric *quadObject,
GLenum normals);
void gluQuadricTexture (
GLUquadric *quadObject,
GLboolean textureCoords);
void gluQuadricOrientation (
GLUquadric *quadObject,
GLenum orientation);
void gluQuadricDrawStyle (
GLUquadric *quadObject,
GLenum drawStyle);
void gluCylinder (
GLUquadric *qobj,
GLdouble baseRadius,
GLdouble topRadius,
GLdouble height,
GLint slices,
GLint stacks);
void gluDisk (
GLUquadric *qobj,
GLdouble innerRadius,
GLdouble outerRadius,
GLint slices,
GLint loops);
void gluPartialDisk (
GLUquadric *qobj,
GLdouble innerRadius,
GLdouble outerRadius,
GLint slices,
GLint loops,
GLdouble startAngle,
GLdouble sweepAngle);
void gluSphere (
GLUquadric *qobj,
GLdouble radius,
GLint slices,
GLint stacks);
void gluQuadricCallback (
GLUquadric *qobj,
GLenum which,
void (* fn)());
GLUtesselator* gluNewTess(
);
void gluDeleteTess(
GLUtesselator *tess );
void gluTessBeginPolygon(
GLUtesselator *tess,
void *polygon_data );
void gluTessBeginContour(
GLUtesselator *tess );
void gluTessVertex(
GLUtesselator *tess,
GLdouble[3] coords,
void *data );
void gluTessEndContour(
GLUtesselator *tess );
void gluTessEndPolygon(
GLUtesselator *tess );
void gluTessProperty(
GLUtesselator *tess,
GLenum which,
GLdouble value );
void gluTessNormal(
GLUtesselator *tess,
GLdouble x,
GLdouble y,
GLdouble z );
void gluTessCallback(
GLUtesselator *tess,
GLenum which,
void ( *fn)());
void gluGetTessProperty(
GLUtesselator *tess,
GLenum which,
GLdouble *value );
GLUnurbs* gluNewNurbsRenderer ();
void gluDeleteNurbsRenderer (
GLUnurbs *nobj);
void gluBeginSurface (
GLUnurbs *nobj);
void gluBeginCurve (
GLUnurbs *nobj);
void gluEndCurve (
GLUnurbs *nobj);
void gluEndSurface (
GLUnurbs *nobj);
void gluBeginTrim (
GLUnurbs *nobj);
void gluEndTrim (
GLUnurbs *nobj);
void gluPwlCurve (
GLUnurbs *nobj,
GLint count,
GLfloat *array,
GLint stride,
GLenum type);
void gluNurbsCurve (
GLUnurbs *nobj,
GLint nknots,
GLfloat *knot,
GLint stride,
GLfloat *ctlarray,
GLint order,
GLenum type);
void
gluNurbsSurface(
GLUnurbs *nobj,
GLint sknot_count,
float *sknot,
GLint tknot_count,
GLfloat *tknot,
GLint s_stride,
GLint t_stride,
GLfloat *ctlarray,
GLint sorder,
GLint torder,
GLenum type);
void
gluLoadSamplingMatrices (
GLUnurbs *nobj,
GLfloat[16] modelMatrix,
GLfloat[16] projMatrix,
GLint[4] viewport );
void
gluNurbsProperty (
GLUnurbs *nobj,
GLenum property,
GLfloat value );
void
gluGetNurbsProperty (
GLUnurbs *nobj,
GLenum property,
GLfloat *value );
void
gluNurbsCallback (
GLUnurbs *nobj,
GLenum which,
void (* fn)() );
/**** function prototypes ****/
/* gluQuadricCallback */
typedef void (* GLUquadricErrorProc) (GLenum);
/* 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* );
/* gluNurbsCallback */
typedef void (* GLUnurbsErrorProc) (GLenum);
/**** Generic constants ****/
/* Version */
const int GLU_VERSION_1_1 = 1;
const int GLU_VERSION_1_2 = 1;
/* Errors: (return value 0 = no error) */
const int GLU_INVALID_ENUM = 100900;
const int GLU_INVALID_VALUE = 100901;
const int GLU_OUT_OF_MEMORY = 100902;
const int GLU_INCOMPATIBLE_GL_VERSION = 100903;
/* StringName */
const int GLU_VERSION = 100800;
const int GLU_EXTENSIONS = 100801;
/* Boolean */
const int GLU_TRUE = GL_TRUE;
const int GLU_FALSE = GL_FALSE;
/**** Quadric constants ****/
/* QuadricNormal */
const int GLU_SMOOTH = 100000;
const int GLU_FLAT = 100001;
const int GLU_NONE = 100002;
/* QuadricDrawStyle */
const int GLU_POINT = 100010;
const int GLU_LINE = 100011;
const int GLU_FILL = 100012;
const int GLU_SILHOUETTE = 100013;
/* QuadricOrientation */
const int GLU_OUTSIDE = 100020;
const int GLU_INSIDE = 100021;
/* types: */
/* GLU_ERROR 100103 */
/**** Tesselation constants ****/
//const extended GLU_TESS_MAX_COORD = 1.0e150;
const real GLU_TESS_MAX_COORD = 1.0e150;
/* TessProperty */
const int GLU_TESS_WINDING_RULE = 100140;
const int GLU_TESS_BOUNDARY_ONLY = 100141;
const int GLU_TESS_TOLERANCE = 100142;
/* TessWinding */
const int GLU_TESS_WINDING_ODD = 100130;
const int GLU_TESS_WINDING_NONZERO = 100131;
const int GLU_TESS_WINDING_POSITIVE = 100132;
const int GLU_TESS_WINDING_NEGATIVE = 100133;
const int GLU_TESS_WINDING_ABS_GEQ_TWO = 100134;
/* TessCallback */
const int GLU_TESS_BEGIN = 100100; /* void (*)(GLenum type) */
const int GLU_TESS_VERTEX = 100101; /* void (*)(void *data) */
const int GLU_TESS_END = 100102; /* void (*)(void) */
const int GLU_TESS_ERROR = 100103; /* void (*)(GLenum errno) */
const int GLU_TESS_EDGE_FLAG = 100104; /* void (*)(GLboolean boundaryEdge) */
const int GLU_TESS_COMBINE = 100105; /* void (*)(GLdouble coords[3],
void *data[4],
GLfloat weight[4],
void **dataOut) */
const int GLU_TESS_BEGIN_DATA = 100106; /* void (*)(GLenum type,
void *polygon_data) */
const int GLU_TESS_VERTEX_DATA = 100107; /* void (*)(void *data,
void *polygon_data) */
const int GLU_TESS_END_DATA = 100108; /* void (*)(void *polygon_data) */
const int GLU_TESS_ERROR_DATA = 100109; /* void (*)(GLenum errno,
void *polygon_data) */
const int GLU_TESS_EDGE_FLAG_DATA = 100110; /* void (*)(GLboolean boundaryEdge,
void *polygon_data) */
const int GLU_TESS_COMBINE_DATA = 100111; /* void (*)(GLdouble coords[3],
void *data[4],
GLfloat weight[4],
void **dataOut,
void *polygon_data) */
/* TessError */
const int GLU_TESS_ERROR1 = 100151;
const int GLU_TESS_ERROR2 = 100152;
const int GLU_TESS_ERROR3 = 100153;
const int GLU_TESS_ERROR4 = 100154;
const int GLU_TESS_ERROR5 = 100155;
const int GLU_TESS_ERROR6 = 100156;
const int GLU_TESS_ERROR7 = 100157;
const int GLU_TESS_ERROR8 = 100158;
const int GLU_TESS_MISSING_BEGIN_POLYGON = GLU_TESS_ERROR1;
const int GLU_TESS_MISSING_BEGIN_CONTOUR = GLU_TESS_ERROR2;
const int GLU_TESS_MISSING_END_POLYGON = GLU_TESS_ERROR3;
const int GLU_TESS_MISSING_END_CONTOUR = GLU_TESS_ERROR4;
const int GLU_TESS_COORD_TOO_LARGE = GLU_TESS_ERROR5;
const int GLU_TESS_NEED_COMBINE_CALLBACK = GLU_TESS_ERROR6;
/**** NURBS constants ****/
/* NurbsProperty */
const int GLU_AUTO_LOAD_MATRIX = 100200;
const int GLU_CULLING = 100201;
const int GLU_SAMPLING_TOLERANCE = 100203;
const int GLU_DISPLAY_MODE = 100204;
const int GLU_PARAMETRIC_TOLERANCE = 100202;
const int GLU_SAMPLING_METHOD = 100205;
const int GLU_U_STEP = 100206;
const int GLU_V_STEP = 100207;
/* NurbsSampling */
const int GLU_PATH_LENGTH = 100215;
const int GLU_PARAMETRIC_ERROR = 100216;
const int GLU_DOMAIN_DISTANCE = 100217;
/* NurbsTrim */
const int GLU_MAP1_TRIM_2 = 100210;
const int GLU_MAP1_TRIM_3 = 100211;
/* NurbsDisplay */
/* GLU_FILL 100012 */
const int GLU_OUTLINE_POLYGON = 100240;
const int GLU_OUTLINE_PATCH = 100241;
/* NurbsCallback */
/* GLU_ERROR 100103 */
/* NurbsErrors */
const int GLU_NURBS_ERROR1 = 100251;
const int GLU_NURBS_ERROR2 = 100252;
const int GLU_NURBS_ERROR3 = 100253;
const int GLU_NURBS_ERROR4 = 100254;
const int GLU_NURBS_ERROR5 = 100255;
const int GLU_NURBS_ERROR6 = 100256;
const int GLU_NURBS_ERROR7 = 100257;
const int GLU_NURBS_ERROR8 = 100258;
const int GLU_NURBS_ERROR9 = 100259;
const int GLU_NURBS_ERROR10 = 100260;
const int GLU_NURBS_ERROR11 = 100261;
const int GLU_NURBS_ERROR12 = 100262;
const int GLU_NURBS_ERROR13 = 100263;
const int GLU_NURBS_ERROR14 = 100264;
const int GLU_NURBS_ERROR15 = 100265;
const int GLU_NURBS_ERROR16 = 100266;
const int GLU_NURBS_ERROR17 = 100267;
const int GLU_NURBS_ERROR18 = 100268;
const int GLU_NURBS_ERROR19 = 100269;
const int GLU_NURBS_ERROR20 = 100270;
const int GLU_NURBS_ERROR21 = 100271;
const int GLU_NURBS_ERROR22 = 100272;
const int GLU_NURBS_ERROR23 = 100273;
const int GLU_NURBS_ERROR24 = 100274;
const int GLU_NURBS_ERROR25 = 100275;
const int GLU_NURBS_ERROR26 = 100276;
const int GLU_NURBS_ERROR27 = 100277;
const int GLU_NURBS_ERROR28 = 100278;
const int GLU_NURBS_ERROR29 = 100279;
const int GLU_NURBS_ERROR30 = 100280;
const int GLU_NURBS_ERROR31 = 100281;
const int GLU_NURBS_ERROR32 = 100282;
const int GLU_NURBS_ERROR33 = 100283;
const int GLU_NURBS_ERROR34 = 100284;
const int GLU_NURBS_ERROR35 = 100285;
const int GLU_NURBS_ERROR36 = 100286;
const int GLU_NURBS_ERROR37 = 100287;
/**** Backwards compatibility for old tesselator ****/
void gluBeginPolygon( GLUtesselator *tess );
void gluNextContour( GLUtesselator *tess,
GLenum type );
void gluEndPolygon( GLUtesselator *tess );
/* Contours types -- obsolete! */
const int GLU_CW = 100120;
const int GLU_CCW = 100121;
const int GLU_INTERIOR = 100122;
const int GLU_EXTERIOR = 100123;
const int GLU_UNKNOWN = 100124;
/* Names without "TESS_" prefix */
const int GLU_BEGIN = GLU_TESS_BEGIN;
const int GLU_VERTEX = GLU_TESS_VERTEX;
const int GLU_END = GLU_TESS_END;
const int GLU_ERROR = GLU_TESS_ERROR;
const int GLU_EDGE_FLAG = GLU_TESS_EDGE_FLAG;
a7xpg/import/SDL_video.obj 0000666 0000000 0000000 00000003366 07732713606 014447 0 ustar root root ' %C:\usr\psn\monsiro\import\SDL_video.d 7nO 。CV , FLAT_TEXTCODE_DATADATACONST_BSSBSS ゥ i i iク _SDL_ALPHA_OPAQUE 槍 _SDL_ALPHA_TRANSPARENT __init_9SDL_video8SDL_Rect __init_9SDL_video9SDL_Color __init_9SDL_video11SDL_Palette 祖 "__init_9SDL_video15SDL_PixelFormat __init_9SDL_video11SDL_SurfaceH _SDL_SWSURFACE 組 _SDL_HWSURFACE _SDL_ASYNCBLIT _SDL_ANYFORMAT _SDL_HWPALETTE _SDL_DOUBLEBUF 宋 _SDL_FULLSCREEN _SDL_OPENGL _SDL_OPENGLBLIT _SDL_RESIZABLE$ _SDL_NOFRAME( _SDL_HWACCEL,
_SDL_MUSTLOCK シ
組 _SDL_SRCCOLORKEY0 _SDL_RLEACCELOK4
_SDL_RLEACCEL8
_SDL_SRCALPHA<