check font load, clarify license, remove namespace creep

master
poikilos 2019-03-07 22:18:07 -05:00
parent 5e57aa252c
commit ec30dae805
19 changed files with 279 additions and 135 deletions

View File

@ -7,11 +7,18 @@
to README.md
* icon, install scripts, and mime type (`model/b3d`)--see README.md
* mime type (`model/x`)
* added ClearSansRegular.ttf
### Changed
* The program can now start without "test.b3d" in the current working
directory (fixed Segmentation Fault).
* set `TARGET = b3view` in B3View.pro, so that binary is lowercase as
per usual Linux naming conventions.
* check for font load failure properly, and load properly if succeeds
* check for "ClearSansRegular.ttf" instead of "arial.ttf"
* move `using namespace` directives from `h` files and specify upon use,
as per C++ best practices; add directives to `cpp` files only as
needed (removed cumulative namespace creep).
## [git-94e3b8f] - 2019-03-06
(poikilos)
@ -22,7 +29,9 @@
(CGUITTFont methods are in CGUITTFont class unless otherwise specified)
* fixed instances of "0 as null pointer constant" (changed to `nullptr`)
* changed inconsistent use of spaces and tabs (changed tabs to 4 spaces)
* (UserInterface.cpp) fixed "logical not is only applied to the left hand side of this comparison..." (put parenthesis around `event.EventType == EET_GUI_EVENT`)
* (UserInterface.cpp) fixed "logical not is only applied to the left
hand side of this comparison..." (put parenthesis around
`event.EventType == EET_GUI_EVENT`)
* Silently degrade to pixel font if font file cannot be read (fixes
Segmentation Fault when font file cannot be read).
* check for nullptr before using:
@ -33,11 +42,14 @@
`draw`, `attach` (also don't copy null by
reference there--instead, set to nullptr if source is nullptr)
* check length of array before using
* (CGUITTFont.cpp) elements of `Glyph` array (type `core::array<CGUITTGlyph>`) in `getHeightFromCharacter`
* (CGUITTFont.cpp) check whether file can be read in `CGUITTFace::load` before proceeding
* (CGUITTFont.cpp) elements of `Glyph` array (type
`core::array<CGUITTGlyph>`) in `getHeightFromCharacter`
* (CGUITTFont.cpp) check whether file can be read in
`CGUITTFace::load` before proceeding
### Removed
* arial.tff removed, since it may be the "real" Arial font, which has a proprietary license
* arial.tff removed, since it may be the "real" Arial font, which has a
proprietary license
## [git-d964384] - 2019-03-06
### Changed

View File

@ -1,5 +1,11 @@
#include "Debug.h"
using std::cout;
using std::endl;
using std::ostream;
using std::wcout;
using std::wcerr;
ostream & debug()
{
std::flush( cout );

View File

@ -4,12 +4,7 @@
#include <iostream>
#include <cassert>
using std::cout;
using std::endl;
using std::ostream;
using std::wcout;
using std::wcerr;
ostream & debug();
std::ostream & debug();
#endif // DEBUG_H

View File

@ -1,5 +1,16 @@
#include "Engine.h"
using std::cout;
using std::endl;
using std::wstring;
using std::wstringstream;
using namespace irr;
using namespace irr::core;
using namespace irr::scene;
using namespace irr::video;
using namespace irr::gui;
/* //////////////////////////////////////////////////////////////////////////
PRIVATE METHODS
/////////////////////////////////////////////////////////////////////// */
@ -42,21 +53,25 @@ void Engine::drawAxisLines()
m_Driver->setMaterial( *lineX );
m_Driver->draw3DLine( vector3df(), vector3df( 5, 0, 0 ), SColor( 255, 255, 0, 0 ));
position2d<s32> textPos = m_Scene->getSceneCollisionManager()->getScreenCoordinatesFrom3DPosition( vector3df( 5.2, 0, 0 ));
dimension2d<u32> textSize = m_AxisFont->getDimension( L"X+" );
m_AxisFont->draw( L"X+", rect<s32>( textPos, textSize ), SColor( 255, 255, 0, 0 ), true, true );
dimension2d<u32> textSize;
if (m_AxisFont != nullptr) {
textSize = m_AxisFont->getDimension( L"X+" );
m_AxisFont->draw( L"X+", rect<s32>( textPos, textSize ), SColor( 255, 255, 0, 0 ), true, true );
}
m_Driver->setMaterial( *lineY );
m_Driver->draw3DLine( vector3df(), vector3df( 0, 5, 0 ), SColor( 255, 0, 255, 0 ));
textPos = m_Scene->getSceneCollisionManager()->getScreenCoordinatesFrom3DPosition( vector3df( 0, 5.2, 0 ));
textSize = m_AxisFont->getDimension( L"Y+" );
m_AxisFont->draw( L"Y+", rect<s32>( textPos, textSize ), SColor( 255, 0, 255, 0 ), true, true );
if (m_AxisFont != nullptr) {
textSize = m_AxisFont->getDimension( L"Y+" );
m_AxisFont->draw( L"Y+", rect<s32>( textPos, textSize ), SColor( 255, 0, 255, 0 ), true, true );
}
m_Driver->setMaterial( *lineZ );
m_Driver->draw3DLine( vector3df(), vector3df( 0, 0, 5 ), SColor( 255, 0, 0, 255 ));
textPos = m_Scene->getSceneCollisionManager()->getScreenCoordinatesFrom3DPosition( vector3df( 0, 0, 5.2 ));
textSize = m_AxisFont->getDimension( L"Z+" );
m_AxisFont->draw( L"Z+", rect<s32>( textPos, textSize ), SColor( 255, 0, 0, 255 ), true, true );
if (m_AxisFont != nullptr) {
textSize = m_AxisFont->getDimension( L"Z+" );
m_AxisFont->draw( L"Z+", rect<s32>( textPos, textSize ), SColor( 255, 0, 0, 255 ), true, true );
}
delete lineX;
delete lineY;
delete lineZ;
@ -109,7 +124,6 @@ s32 Engine::getNumberOfVertices()
Engine::Engine()
{
this->previousMeshPath = L"";
#if WIN32
m_Device = createDevice( EDT_DIRECT3D9, dimension2d<u32>( 1024, 768 ), 32, false, false, false, nullptr );
#else
@ -139,13 +153,15 @@ Engine::Engine()
// Load font for displaying Axis names
m_AxisFontFace = new CGUITTFace();
m_AxisFontFace->load( "arial.ttf" );
m_AxisFont = new CGUITTFont( m_UserInterface->getGUIEnvironment() );
assert(m_AxisFontFace != nullptr);
assert(m_AxisFontFace->face != nullptr);
m_AxisFont->attach( m_AxisFontFace, 14 );
m_AxisFont->AntiAlias = false;
if (m_AxisFontFace->load( "ClearSansRegular.ttf" )) {
m_AxisFont = new CGUITTFont( m_UserInterface->getGUIEnvironment() );
m_AxisFont->attach( m_AxisFontFace, 14 );
m_AxisFont->AntiAlias = false;
}
else {
delete m_AxisFontFace;
m_AxisFontFace = nullptr;
}
// Set Engine enabled
m_RunEngine = true;
m_LoadedMesh = nullptr;
@ -166,21 +182,31 @@ Engine::~Engine()
void Engine::loadMesh( const wstring &fileName )
{
// if (m_LoadedMesh != nullptr) {
//std::wstring fn;
//fn.assign(fileName.c_str());
// std::wcerr << "fileName = " << fn << endl;
// std::wcerr << "fileName = " << fileName << endl;
this->m_EventHandler->m_PreviousPath = fileName;
// std::wcerr << "this->m_EventHandler->m_PreviousPath = " << this->m_EventHandler->m_PreviousPath.c_str() << endl;
// }
if( m_LoadedMesh != nullptr )
m_LoadedMesh->remove();
m_LoadedMesh = m_Scene->addAnimatedMeshSceneNode( m_Scene->getMesh( fileName.c_str()));
if (m_LoadedMesh != nullptr) {
this->previousMeshPath = fileName;
}
Utility::dumpMeshInfoToConsole( m_LoadedMesh );
}
void Engine::reloadMesh()
{
if (this->m_EventHandler->m_PreviousPath.length() > 0) {
std::wcerr << "this->m_EventHandler->m_PreviousPath = " << this->m_EventHandler->m_PreviousPath.c_str() << endl;
loadMesh(this->m_EventHandler->m_PreviousPath);
}
}
void Engine::loadTexture(const wstring &fileName)
{
//TODO: eliminate this?
//if (previousMeshPath.length() > 0)
//m_LoadedMesh = m_Scene->addAnimatedMeshSceneNode( m_Scene->getMesh(previousMeshPath.c_str()));
m_LoadedMesh->setMaterialTexture(0, this->m_Driver->getTexture(fileName.c_str()));
}

View File

@ -16,17 +16,6 @@ class View;
#include "extlib/CGUITTFont.h"
using std::cout;
using std::endl;
using std::wstring;
using std::wstringstream;
using namespace irr;
using namespace irr::core;
using namespace irr::scene;
using namespace irr::video;
using namespace irr::gui;
enum SceneItemID
{
SIID_LIGHT = 1,
@ -38,18 +27,17 @@ class Engine
{
friend class UserInterface;
friend class View;
wstring previousMeshPath;
private:
IrrlichtDevice *m_Device;
IVideoDriver *m_Driver;
ISceneManager *m_Scene;
IAnimatedMeshSceneNode *m_LoadedMesh;
ILightSceneNode *m_SceneLight;
CGUITTFont *m_AxisFont;
CGUITTFace *m_AxisFontFace;
irr::IrrlichtDevice *m_Device;
irr::video::IVideoDriver *m_Driver;
irr::scene::ISceneManager *m_Scene;
irr::scene::IAnimatedMeshSceneNode *m_LoadedMesh;
irr::scene::ILightSceneNode *m_SceneLight;
irr::gui::CGUITTFont *m_AxisFont;
irr::gui::CGUITTFace *m_AxisFontFace;
dimension2d<u32> *m_WindowSize;
irr::core::dimension2d<irr::u32> *m_WindowSize;
bool m_RunEngine;
@ -61,16 +49,17 @@ private:
void drawAxisLines();
void drawBackground();
void checkResize();
IGUIEnvironment *getGUIEnvironment() const;
s32 getNumberOfVertices();
irr::gui::IGUIEnvironment *getGUIEnvironment() const;
irr::s32 getNumberOfVertices();
public:
Engine();
~Engine();
void run();
void loadMesh( const wstring &fileName );
void loadTexture( const wstring &fileName );
void loadMesh( const std::wstring &fileName );
void reloadMesh();
void loadTexture( const std::wstring &fileName );
void setMeshDisplayMode( bool wireframe = false, bool lighting = true );
};

View File

@ -1,8 +1,24 @@
#include "EventHandler.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <Utils.h>
using namespace irr;
using namespace irr::video;
using namespace irr::gui;
// Public
EventHandler::EventHandler( IrrlichtDevice *device )
{
// For monitoring single press: see
// <http://irrlicht.sourceforge.net/forum/viewtopic.php?p=210744>
for (u32 i=0; i<KEY_KEY_CODES_COUNT; ++i)
KeyIsDown[i] = false;
for (u32 i=0; i<KEY_KEY_CODES_COUNT; ++i)
keyState[i] = 0;
LMouseState = 0;
RMouseState = 0;
m_Device = device;
m_EventReceivers = new map<EventReceiverType, IEventReceiver *>();
}
@ -21,24 +37,37 @@ bool EventHandler::addEventReceiver( EventReceiverType type, IEventReceiver *rec
// IEventReceiver
bool EventHandler::OnEvent( const SEvent &event )
{
if( event.EventType == EET_GUI_EVENT )
if (event.EventType == EET_GUI_EVENT)
{
// Pass to User Interface Handler
map<EventReceiverType,IEventReceiver *>::iterator iter = m_EventReceivers->find( ERT_USERINTERFACE );
iter->second->OnEvent( event );
}
else if( event.EventType == EET_MOUSE_INPUT_EVENT )
else if (event.EventType == EET_MOUSE_INPUT_EVENT)
{
map<EventReceiverType,IEventReceiver *>::iterator iter = m_EventReceivers->find( ERT_3DVIEW );
iter->second->OnEvent( event );
}
// Window resize handling - send to all subscribers
if( event.EventType == EET_USER_EVENT && event.UserEvent.UserData1 == UEI_WINDOWSIZECHANGED )
else if (event.EventType == EET_KEY_INPUT_EVENT) {
if (event.KeyInput.PressedDown && !KeyIsDown[event.KeyInput.Key]) {
std::wstring basePath = L".";
if (this->m_PreviousPath.length() > 0) {
// std::wcerr << "this->m_PreviousPath: " << this->m_PreviousPath.c_str() << endl;
std::wstring lastDirPath = Utility::parentOfPath(m_PreviousPath);
std::wcerr << "lastDirPath: " << lastDirPath << endl;
}
else debug() << "Keydown" << endl;
}
KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
}
else if (event.EventType == EET_USER_EVENT)
{
map<EventReceiverType,IEventReceiver *>::iterator iter;
for( iter = m_EventReceivers->begin(); iter != m_EventReceivers->end(); iter ++ )
iter->second->OnEvent( event );
if (event.UserEvent.UserData1 == UEI_WINDOWSIZECHANGED) {
// Window resize handling - send to all subscribers
map<EventReceiverType,IEventReceiver *>::iterator iter;
for( iter = m_EventReceivers->begin(); iter != m_EventReceivers->end(); iter ++ )
iter->second->OnEvent( event );
}
}
return false;

View File

@ -14,10 +14,6 @@ using std::endl;
using std::map;
using std::make_pair;
using namespace irr;
using namespace irr::video;
using namespace irr::gui;
enum EventReceiverType
{
ERT_USERINTERFACE = 1,
@ -29,20 +25,23 @@ enum UserEventIdentifier
UEI_WINDOWSIZECHANGED = 1
};
class EventHandler : public IEventReceiver
class EventHandler : public irr::IEventReceiver
{
private:
IrrlichtDevice *m_Device;
irr::IrrlichtDevice *m_Device;
map<EventReceiverType, IEventReceiver*> *m_EventReceivers;
bool KeyIsDown[irr::KEY_KEY_CODES_COUNT];
irr::s32 keyState[irr::KEY_KEY_CODES_COUNT];
irr::s32 LMouseState,RMouseState;
public:
EventHandler( IrrlichtDevice *device );
EventHandler( irr::IrrlichtDevice *device );
~EventHandler();
bool addEventReceiver( EventReceiverType type, IEventReceiver *receiver );
bool addEventReceiver(EventReceiverType type, irr::IEventReceiver *receiver );
// IEventReceiver
virtual bool OnEvent( const SEvent &event );
virtual bool OnEvent( const irr::SEvent &event );
std::wstring m_PreviousPath;
};
#endif // EVENTHANDLER_H

View File

@ -14,9 +14,9 @@ This is a modernized fork by poikilos (see CHANGELOG.md).
[filehandoff#compiling-issues](https://github.com/poikilos/filehandoff#compiling-issues))
* Copy all of the files from `./build` to your actual build directory,
if your build directory is not `./build`
* Copy your favorite font to `./build/arial.tff` _(Arial is not included
due it possibly being the "real" Arial, which has a proprietary
license)_.
* (optional) Copy your favorite public-licensed font over
`./build/ClearSansRegular.tff` or to current working directory of
program
## Installation
### Windows
@ -60,3 +60,19 @@ This is a modernized fork by poikilos (see CHANGELOG.md).
* Warn on missing texture.
* Implement Start/Stop button functionality.
* Test and complete install.bat on Windows.
## Authors
* ClearSansRegular.ttf (Apache 2.0 License) by Intel
<https://01.org/clear-sans> via
<https://www.fontsquirrel.com/fonts/clear-sans>
* ninja.b3d, nskin*.jpg by Psionic (psionic3d.co.uk)
<http://www.psionic3d.co.uk/downloads/ninja.zip>
(I've seen this file ripped and in several repos, but finally found
the original site above, which has additional skins not found
elsewhere, via included "ninja animation ranges.txt" from
<https://sledjhamr.org/source/media/Irrlicht/>)
"Feel free to use however you like, commercial etc, credits are
Appreciated..." -Psionic
* Until original author egrath responds, all files not mentioned above
are licensed under the GitHub ToS (GitHub has rights to distribute
the files).

View File

@ -1,6 +1,13 @@
#include "UserInterface.h"
#include <iostream>
using namespace irr;
using namespace irr::core;
using namespace irr::gui;
using std::string;
using std::wstring;
// PRIVATE
void UserInterface::setupUserInterface()
{
@ -35,18 +42,21 @@ void UserInterface::setupUserInterface()
// Set Font for UI Elements
m_GuiFontFace = new CGUITTFace();
//irrString defines stringc as string<c8>
std::string fontPath = "arial.ttf"; // core::stringc has implicit conversion to io::path
//if (QFile(fontPath).exists()) {}
m_GuiFontFace->load( fontPath.c_str() ); //actually takes `const io::path &`
m_GuiFont = new CGUITTFont( m_Gui );
assert(m_GuiFontFace != nullptr);
if (m_GuiFontFace->face != nullptr) {
// irrString defines stringc as string<c8>
std::wstring fontPath = L"ClearSansRegular.ttf"; // core::stringc has implicit conversion to io::path
// if (QFile(fontPath).exists()) {}
if (m_GuiFontFace->load(fontPath.c_str())) { // actually takes `const io::path &`
m_GuiFont = new CGUITTFont( m_Gui );
m_GuiFont->attach( m_GuiFontFace, 14 );
m_Gui->getSkin()->setFont( m_GuiFont );
}
else {
cerr << "WARNING: Missing '" << fontPath << "'" << endl;
std::wcerr << L"WARNING: Missing '" << fontPath << L"'" << endl;
delete m_GuiFontFace;
m_GuiFontFace = nullptr;
if (m_GuiFont != nullptr) {
std::wcerr << L"WARNING: Keeping old font loaded." << endl;
}
}
//}
}
@ -122,7 +132,7 @@ void UserInterface::drawStatusLine() const
bool UserInterface::OnEvent( const SEvent &event )
{
// Events arriving here should be destined for us
if( ! (event.EventType == EET_GUI_EVENT) )
if (!(event.EventType == EET_GUI_EVENT))
return false;
const SEvent::SGUIEvent *ge = &( event.GUIEvent );

View File

@ -13,13 +13,6 @@ class Engine;
#include "extlib/CGUITTFont.h"
using namespace irr;
using namespace irr::core;
using namespace irr::gui;
using std::string;
using std::wstring;
enum UserInterfaceElements
{
UIE_PLAYBACKWINDOW = 1000,
@ -40,18 +33,18 @@ enum UserInterfaceCommands
UIC_VIEW_LIGHTING = 2001
};
class UserInterface : public IEventReceiver
class UserInterface : public irr::IEventReceiver
{
private:
Engine *m_Engine;
IGUIEnvironment *m_Gui;
CGUITTFont *m_GuiFont;
CGUITTFace *m_GuiFontFace;
irr::gui::IGUIEnvironment *m_Gui;
irr::gui::CGUITTFont *m_GuiFont;
irr::gui::CGUITTFace *m_GuiFontFace;
void setupUserInterface();
void displayLoadFileDialog();
void displayLoadTextureDialog();
void handleMenuItemPressed( IGUIContextMenu *menu );
void handleMenuItemPressed(irr::gui::IGUIContextMenu *menu);
bool m_WireframeDisplay;
bool m_Lighting;
@ -59,11 +52,11 @@ private:
public:
UserInterface( Engine *device );
~UserInterface();
IGUIEnvironment * getGUIEnvironment() const;
irr::gui::IGUIEnvironment *getGUIEnvironment() const;
void drawStatusLine() const;
// IEventReceiver
virtual bool OnEvent( const SEvent &event );
virtual bool OnEvent( const irr::SEvent &event );
};
#endif // USERINTERFACE_H

View File

@ -1,4 +1,9 @@
#include "Utils.h"
using namespace irr::core;
using namespace irr::scene;
using namespace irr::video;
using namespace std;
void Utility::dumpVectorToConsole( const vector3df &vector )
{
@ -36,4 +41,22 @@ void Utility::dumpMeshInfoToConsole( IAnimatedMeshSceneNode *node )
}
}
std::wstring Utility::parentOfPath(const wstring &path)
{
std::wstring ret = L".";
if (path == L".") {
ret = L"..";
}
else {
std::wstring::size_type lastSlashPos = path.find_last_of(L"/");
if (lastSlashPos == std::wstring::npos) {
std::wstring::size_type lastSlashPos = path.find_last_of(L"\\");
}
if (lastSlashPos != std::wstring::npos) {
ret = path.substr(0, lastSlashPos);
}
}
return ret;
}

10
Utils.h
View File

@ -5,16 +5,12 @@
#include <irrlicht/irrlicht.h>
#include "Debug.h"
using namespace irr::core;
using namespace irr::scene;
using namespace irr::video;
using namespace std;
class Utility
{
public:
static void dumpVectorToConsole( const vector3df &vector );
static void dumpMeshInfoToConsole( IAnimatedMeshSceneNode *node );
static void dumpVectorToConsole( const irr::core::vector3df &vector );
static void dumpMeshInfoToConsole( irr::scene::IAnimatedMeshSceneNode *node );
static std::wstring parentOfPath(const std::wstring &path);
};
#endif // UTILS_H

View File

@ -1,5 +1,9 @@
#include "View.h"
using namespace irr;
using namespace irr::core;
using namespace irr::scene;
void View::setNewCameraPosition()
{
vector3d<f32> newCameraPosition;

17
View.h
View File

@ -7,28 +7,25 @@
#include "Engine.h"
#include "Utils.h"
using namespace irr;
using namespace irr::scene;
using namespace irr::core;
using namespace irr::video;
class View : public IEventReceiver
class View : public irr::IEventReceiver
{
private:
Engine *m_Engine;
f32 m_Yaw, m_Pitch, m_CameraDistance;
vector2d<int> *m_LastMousePosition;
irr::f32 m_Yaw, m_Pitch, m_CameraDistance;
irr::core::vector2d<int> *m_LastMousePosition;
bool m_RotMouse;
void setNewCameraPosition();
void setNewLightDirection( const vector3df &cameraPosition );
void setNewLightDirection( const irr::core::vector3df &cameraPosition );
public:
View( Engine *engine );
~View();
// IEventReceiver
virtual bool OnEvent( const SEvent &event );
virtual bool OnEvent( const irr::SEvent &event );
};
#endif // VIEW_H
#endif // VIEW_H

BIN
build/ClearSansRegular.ttf Normal file

Binary file not shown.

View File

@ -87,18 +87,21 @@ fi
if [ ! -d "$applications_path" ]; then
mkdir -p "$applications_path"
fi
if [ "@$PROFILE_ENABLE" = "@true" ]; then
if [ -f "$shortcut_src_path" ]; then
cat "$shortcut_src_path" | grep -v Exec= | grep -v Icon= > "$applications_path/$shortcut_name"
echo "Exec=$dest_bin_dir/$project_unix_name" >> "$applications_path/$shortcut_name"
echo "Icon=$icons_root/$icon_name" >> "$applications_path/$shortcut_name"
echo >> "$applications_path/$shortcut_name"
else
echo "ERROR: No icon installed since missing '$shortcut_src_path'"
fi
#if [ "@$PROFILE_ENABLE" = "@true" ]; then
# always rewrite, since PREFIX may differ
if [ -f "$shortcut_src_path" ]; then
cat "$shortcut_src_path" | grep -v Exec= | grep -v Icon= > "$applications_path/$shortcut_name"
echo "Exec=$dest_bin_dir/$project_unix_name" >> "$applications_path/$shortcut_name"
echo "Icon=$icons_root/$icon_name" >> "$applications_path/$shortcut_name"
echo >> "$applications_path/$shortcut_name"
else
cp -f "$shortcut_src_path" "$applications_path/"
echo "ERROR: No icon installed since missing '$shortcut_src_path'"
fi
#else
#cp -f "$shortcut_src_path" "$applications_path/"
#fi
if [ -f "$applications_path/$shortcut_name" ]; then
echo "Successfully copied '$applications_path/$shortcut_name'"
else

View File

@ -0,0 +1,36 @@
hey guys heres all the ranges for the ninja model, 20 ranges and 300 frames....Phew!!
you may need to scale or rotate the model and change animation speeds for various 3D game engines...
Please check the numbers carefully cus they dont follow any order and in between ranges often skip a few frames, this as how I achieved certain moves in Character FX its not a mistake :)
1-14 Walk (normal)
15-30 Stealth Walk
32-44 Punch and swipe sword
45-59 Swipe and spin sword
60-68 Overhead twohanded downswipe
69-72 Up to block position (play backwards to lower sword if you want)
73-83 Forward kick
84-93 Pick up from floor (or down to crouch at frame 87)
94-102 Jump
103-111 Jump without height (for programmer controlled jumps)
112-125 High jump to Sword Kill (Finish em off move??)
126-133 Side Kick
134-145 Spinning Sword attack (might wanna speed this up in game)
146-158 Backflip
159-165 Climb wall
166-173 Death 1 - Fall back onto ground
174-182 Death 2 - Fall forward onto ground
184-205 Idle 1 - Breathe heavily
206-250 Idle 2
251-300 Idle 3
Ok there it is, have fun and maybe drop by my forums hang out, ask questions, post your own work etc
Feel free to use however you like, commercial etc, credits are Appreciated as a LOT of work went into this! ;-)
Psionic
http://www.psionic3d.co.uk
Note for Irrlicht: Irrlicht uses a 0-based frame index. So subtract 1 from each of the loops!

View File

@ -1,9 +1,14 @@
// Kudus to Nalin for this wonderful piece of code!
// See: http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=3995
#include <assert.h>
#include <iostream>
#include <irrlicht/irrlicht.h>
using namespace irr;
#include "CGUITTFont.h"
#include <assert.h>
using namespace std;
namespace irr
{
@ -14,6 +19,7 @@ FT_Library library;
bool CGUITTFace::libraryLoaded = false;
s32 facesCount = 0;
//////////////////////
CGUITTFace::CGUITTFace()
@ -308,22 +314,21 @@ CGUITTFont::~CGUITTFont()
bool CGUITTFont::attach(CGUITTFace *face, u32 size, bool size_is_pixels)
{
if (!Driver)
return false;
if (tt_face == nullptr) {
if (!Driver) {
cerr << "ERROR: tried to attach font Face but there is no Driver" << endl;
return false;
}
if (tt_face == nullptr || tt_face->face == nullptr) {
if (face == nullptr) {
cerr << "ERROR: tried to attach null tt_face" << endl;
return false;
}
if (face->face == nullptr) {
cerr << "ERROR: tried to attach null tt_face->face" << endl;
return false;
}
tt_face = face;
assert(tt_face != nullptr);
assert(tt_face->face != nullptr);
if (tt_face->face->num_glyphs > 0) {
Glyphs.reallocate(tt_face->face->num_glyphs);
Glyphs.set_used(tt_face->face->num_glyphs);

View File

@ -4,6 +4,11 @@
#include "Engine.h"
using std::wstring;
using namespace irr;
using namespace irr::core;
wchar_t * getWideCharString( char *str );
#ifdef WIN32