Commit 0752e4dd authored by Kiste's avatar Kiste
Browse files

Fix line endings

parent 8491e663
libBulletML 0.0.5
* Abstract
It is a C++ library to handle BulletML, the Bullet Markup
Language. You can use BulletML in your program without bothering to
parse XML.
If you want to know BulletML more, please see following web site by
ABA (author of BulletML):
http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/index_e.html
* Usage
You can use it with VC and BorlandC++ and gcc and I wish, almost all
compiler that supports standard C++.
An example of this library is available in my software "siroi
danmakukun":
http://user.ecc.u-tokyo.ac.jp/~s31552/wp/sdmkun/sdmkun-1.5.6.zip
You can see usage of this library in src/command_bulletml.* .
* Tutorial
This library's basic usage is event driven model.
0. Get XML file written in BulletML.
You can use BulletML file in "siroi danmakukun". (bosses.d/*.xml in
archive)
1. Include headers
#include "bulletml/bulletmlparser.h"
#include "bulletml/bulletmlparser-tinyxml.h"
#include "bulletml/bulletmlrunner.h"
2. Create class that inherits BulletMLRunner
class BulletCommand : public BulletMLRunner {
// ...
// the bullet you will handle
Bullet* bullet_;
}
3. Implement all pure virtual function defined in bulletmlrunner.h
For example:
class BulletCommand : public BulletMLRunner {
virtual void doVanish() {
bullet_->die();
}
// ... and other pure virtual functions
}
createSimpleBullet and createBullet method should be implemented
carefully. In libBulletML, all bullets are divided to two
types. createSimpleBullet type does not have <action>, createBullet
type has <action>. For example, "siroi danmakukun" uses two class:
Shot and Enemy.
When libBulletML handle <fire> element that does not have <action>
element, BulletMLRunner calls createSimpleBullet method with two
arguments: direction and speed.
In the other hand, if <fire> element has <action> element,
BulletMLRunner calls createBullet method with three arguments:
direction, speed, and state. You should not care the detail of the
state argument. But it should be given to the class derived from
BulletMLRunner in its constructor. The creation of this class is
described in next section.
4. Create of the class derived from BulletMLRunner
In libBulletML, the batteries are divided two types. One type is the
battery that is defined in <action label="top"> (first order battery),
and one type is the battery that is created by the other battery
(second, third, forth... battery).
Then, you should create two constructors to handle these two kind of
batteries.
For example, first order battery is implemented like following:
BulletCommand::BulletCommand(BulletMLParser* bp, Bullet* b)
: BulletMLRunner(bp), bullet_(b)
For example, second, third... order battery is implemented like following:
BulletCommand::BulletCommand(BulletMLState* bs, Bullet* b)
: BulletMLRunner(bs), bullet_(b)
You should call this constructor when createBullet method is called.
5. Create BulletML document
BulletMLParser* bp = new BulletMLParserTinyXML("foo.xml");
bp->build();
Because parsing BulletML is slow, all xml files should be loaded in
the initialization of the program.
6. Create first order battery
BulletCommand* bc = new BulletCommand(bp)
7. Run BulletCommand in all turn.
while (1) {
// the main loop of game
bc->run();
}
If some errors are occured, libBulletML throws BulletMLError. You can
catch this exception.
* Misc
TinyXML is used to parse XML.
http://www.gibaradunn.srac.org/tiny/index.shtml
If you cannot understand this document (yes, it's poor document and
writen in poor English), please ask me with email.
* Modified BSD License
Copyright (c) 2003, shinichiro.h All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"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 COPYRIGHT
OWNER 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.
shinichiro.h
hamaji@nii.ac.jp
http://shinh.skr.jp/
libBulletML 0.0.5
* Abstract
It is a C++ library to handle BulletML, the Bullet Markup
Language. You can use BulletML in your program without bothering to
parse XML.
If you want to know BulletML more, please see following web site by
ABA (author of BulletML):
http://www.asahi-net.or.jp/~cs8k-cyu/bulletml/index_e.html
* Usage
You can use it with VC and BorlandC++ and gcc and I wish, almost all
compiler that supports standard C++.
An example of this library is available in my software "siroi
danmakukun":
http://user.ecc.u-tokyo.ac.jp/~s31552/wp/sdmkun/sdmkun-1.5.6.zip
You can see usage of this library in src/command_bulletml.* .
* Tutorial
This library's basic usage is event driven model.
0. Get XML file written in BulletML.
You can use BulletML file in "siroi danmakukun". (bosses.d/*.xml in
archive)
1. Include headers
#include "bulletml/bulletmlparser.h"
#include "bulletml/bulletmlparser-tinyxml.h"
#include "bulletml/bulletmlrunner.h"
2. Create class that inherits BulletMLRunner
class BulletCommand : public BulletMLRunner {
// ...
// the bullet you will handle
Bullet* bullet_;
}
3. Implement all pure virtual function defined in bulletmlrunner.h
For example:
class BulletCommand : public BulletMLRunner {
virtual void doVanish() {
bullet_->die();
}
// ... and other pure virtual functions
}
createSimpleBullet and createBullet method should be implemented
carefully. In libBulletML, all bullets are divided to two
types. createSimpleBullet type does not have <action>, createBullet
type has <action>. For example, "siroi danmakukun" uses two class:
Shot and Enemy.
When libBulletML handle <fire> element that does not have <action>
element, BulletMLRunner calls createSimpleBullet method with two
arguments: direction and speed.
In the other hand, if <fire> element has <action> element,
BulletMLRunner calls createBullet method with three arguments:
direction, speed, and state. You should not care the detail of the
state argument. But it should be given to the class derived from
BulletMLRunner in its constructor. The creation of this class is
described in next section.
4. Create of the class derived from BulletMLRunner
In libBulletML, the batteries are divided two types. One type is the
battery that is defined in <action label="top"> (first order battery),
and one type is the battery that is created by the other battery
(second, third, forth... battery).
Then, you should create two constructors to handle these two kind of
batteries.
For example, first order battery is implemented like following:
BulletCommand::BulletCommand(BulletMLParser* bp, Bullet* b)
: BulletMLRunner(bp), bullet_(b)
For example, second, third... order battery is implemented like following:
BulletCommand::BulletCommand(BulletMLState* bs, Bullet* b)
: BulletMLRunner(bs), bullet_(b)
You should call this constructor when createBullet method is called.
5. Create BulletML document
BulletMLParser* bp = new BulletMLParserTinyXML("foo.xml");
bp->build();
Because parsing BulletML is slow, all xml files should be loaded in
the initialization of the program.
6. Create first order battery
BulletCommand* bc = new BulletCommand(bp)
7. Run BulletCommand in all turn.
while (1) {
// the main loop of game
bc->run();
}
If some errors are occured, libBulletML throws BulletMLError. You can
catch this exception.
* Misc
TinyXML is used to parse XML.
http://www.gibaradunn.srac.org/tiny/index.shtml
If you cannot understand this document (yes, it's poor document and
writen in poor English), please ask me with email.
* Modified BSD License
Copyright (c) 2003, shinichiro.h All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* 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.
* The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"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 COPYRIGHT
OWNER 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.
shinichiro.h
hamaji@nii.ac.jp
http://shinh.skr.jp/
// bulletml.cpp : DLL アプリケーション用のエントリ ポイントを定義します。
//
#include "stdafx.h"
#include "bulletml.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// これはエクスポートされた変数の例です。
BULLETML_API int nBulletml=0;
// これはエクスポートされた関数の例です。
BULLETML_API int fnBulletml(void)
{
return 42;
}
// これはエクスポートされたクラスのコンストラクタです。
// クラスの定義については bulletml.h を参照してください。
CBulletml::CBulletml()
{
return;
}
// bulletml.cpp : DLL アプリケーション用のエントリ ポイントを定義します。
//
#include "stdafx.h"
#include "bulletml.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// これはエクスポートされた変数の例です。
BULLETML_API int nBulletml=0;
// これはエクスポートされた関数の例です。
BULLETML_API int fnBulletml(void)
{
return 42;
}
// これはエクスポートされたクラスのコンストラクタです。
// クラスの定義については bulletml.h を参照してください。
CBulletml::CBulletml()
{
return;
}
# Microsoft Developer Studio Project File - Name="bulletml" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** 編集しないでください **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=bulletml - Win32 Debug
!MESSAGE これは有効なメイクファイルではありません。 このプロジェクトをビルドするためには NMAKE を使用してください。
!MESSAGE [メイクファイルのエクスポート] コマンドを使用して実行してください
!MESSAGE
!MESSAGE NMAKE /f "bulletml.mak".
!MESSAGE
!MESSAGE NMAKE の実行時に構成を指定できます
!MESSAGE コマンド ライン上でマクロの設定を定義します。例:
!MESSAGE
!MESSAGE NMAKE /f "bulletml.mak" CFG="bulletml - Win32 Debug"
!MESSAGE
!MESSAGE 選択可能なビルド モード:
!MESSAGE
!MESSAGE "bulletml - Win32 Release" ("Win32 (x86) Dynamic-Link Library" 用)
!MESSAGE "bulletml - Win32 Debug" ("Win32 (x86) Dynamic-Link Library" 用)
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "bulletml - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BULLETML_EXPORTS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MT /W3 /GR /GX /O2 /I "src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BULLETML_EXPORTS" /D "WIN32_DLL_EXPORT" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x411 /d "NDEBUG"
# ADD RSC /l 0x411 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
!ELSEIF "$(CFG)" == "bulletml - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BULLETML_EXPORTS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /GR /GX /ZI /Od /I "src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "BULLETML_EXPORTS" /D "WIN32_DLL_EXPORT" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x411 /d "_DEBUG"
# ADD RSC /l 0x411 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "bulletml - Win32 Release"
# Name "bulletml - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Group "libBulletML src"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\bulletml.cpp
# End Source File
# Begin Source File
SOURCE=".\src\bulletmlparser-tinyxml.cpp"
# End Source File
# Begin Source File
SOURCE=".\src\bulletmlparser-xerces.cpp"
# End Source File
# Begin Source File
SOURCE=".\src\bulletmlparser-ygg.cpp"
# End Source File
# Begin Source File
SOURCE=.\src\bulletmlparser.cpp
# End Source File
# Begin Source File
SOURCE=.\src\bulletmlrunner.cpp
# End Source File
# Begin Source File
SOURCE=.\src\bulletmlrunnerimpl.cpp
# End Source File
# Begin Source File
SOURCE=.\src\bulletmltree.cpp
# End Source File
# Begin Source File
SOURCE=.\src\calc.cpp
# End Source File
# Begin Source File
SOURCE=".\src\formula-variables.cpp"
# End Source File
# End Group
# Begin Group "TinyXML src"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\tinyxml\tinyxml.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tinyxml\tinyxmlerror.cpp
# End Source File
# Begin Source File
SOURCE=.\src\tinyxml\tinyxmlparser.cpp
# End Source File
# End Group
# Begin Group "ygg src"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\ygg\ygg.cpp
# End Source File
# End Group
# Begin Source File
SOURCE=.\StdAfx.cpp
# ADD CPP /Yc"stdafx.h"
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Group "libBulletML header"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\auto_ptr_fix.h
# End Source File
# Begin Source File
SOURCE=.\bulletml.h
# End Source File
# Begin Source File
SOURCE=.\src\bulletmlcommon.h
# End Source File
# Begin Source File
SOURCE=.\src\bulletmlerror.h
# End Source File
# Begin Source File
SOURCE=".\src\bulletmlparser-tinyxml.h"
# End Source File
# Begin Source File
SOURCE=".\src\bulletmlparser-xerces.h"
# End Source File
# Begin Source File
SOURCE=".\src\bulletmlparser-ygg.h"
# End Source File
# Begin Source File
SOURCE=.\src\bulletmlparser.h
# End Source File
# Begin Source File
SOURCE=.\src\bulletmlrunner.h
# End Source File
# Begin Source File
SOURCE=.\src\bulletmlrunnerimpl.h
# End Source File
# Begin Source File
SOURCE=.\src\bulletmltree.h
# End Source File
# Begin Source File
SOURCE=.\src\calc.h
# End Source File
# Begin Source File
SOURCE=".\src\formula-variables.h"
# End Source File
# Begin Source File
SOURCE=.\src\formula.h
# End Source File
# Begin Source File
SOURCE=.\src\tree.h
# End Source File
# End Group
# Begin Group "TinyXML header"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\tinyxml\tinyxml.h
# End Source File
# End Group
# Begin Group "ygg header"
<