Commit c7713661 authored by Fluorohydride's avatar Fluorohydride

update

parent a7da0e4c
This diff is collapsed.
This diff is collapsed.
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_GUI_EDIT_BOX_H_INCLUDED__
#define __C_GUI_EDIT_BOX_H_INCLUDED__
#include "IrrCompileConfig.h"
#ifdef _IRR_COMPILE_WITH_GUI_
#include "IGUIEditBox.h"
#include "irrArray.h"
#include "IOSOperator.h"
namespace irr
{
namespace gui
{
class CGUIEditBox : public IGUIEditBox
{
public:
//! constructor
CGUIEditBox(const wchar_t* text, bool border, IGUIEnvironment* environment,
IGUIElement* parent, s32 id, const core::rect<s32>& rectangle);
//! destructor
virtual ~CGUIEditBox();
//! Sets another skin independent font.
virtual void setOverrideFont(IGUIFont* font=0);
//! Sets another color for the text.
virtual void setOverrideColor(video::SColor color);
//! Sets if the text should use the overide color or the
//! color in the gui skin.
virtual void enableOverrideColor(bool enable);
//! Turns the border on or off
virtual void setDrawBorder(bool border);
//! Enables or disables word wrap for using the edit box as multiline text editor.
virtual void setWordWrap(bool enable);
//! Checks if word wrap is enabled
//! \return true if word wrap is enabled, false otherwise
virtual bool isWordWrapEnabled() const;
//! Enables or disables newlines.
/** \param enable: If set to true, the EGET_EDITBOX_ENTER event will not be fired,
instead a newline character will be inserted. */
virtual void setMultiLine(bool enable);
//! Checks if multi line editing is enabled
//! \return true if mult-line is enabled, false otherwise
virtual bool isMultiLineEnabled() const;
//! Enables or disables automatic scrolling with cursor position
//! \param enable: If set to true, the text will move around with the cursor position
virtual void setAutoScroll(bool enable);
//! Checks to see if automatic scrolling is enabled
//! \return true if automatic scrolling is enabled, false if not
virtual bool isAutoScrollEnabled() const;
//! Gets the size area of the text in the edit box
//! \return Returns the size in pixels of the text
virtual core::dimension2du getTextDimension();
//! Sets text justification
virtual void setTextAlignment(EGUI_ALIGNMENT horizontal, EGUI_ALIGNMENT vertical);
//! called if an event happened.
virtual bool OnEvent(const SEvent& event);
//! draws the element and its children
virtual void draw();
//! Sets the new caption of this element.
virtual void setText(const wchar_t* text);
//! Sets the maximum amount of characters which may be entered in the box.
//! \param max: Maximum amount of characters. If 0, the character amount is
//! infinity.
virtual void setMax(u32 max);
//! Returns maximum amount of characters, previously set by setMax();
virtual u32 getMax() const;
//! Sets whether the edit box is a password box. Setting this to true will
/** disable MultiLine, WordWrap and the ability to copy with ctrl+c or ctrl+x
\param passwordBox: true to enable password, false to disable
\param passwordChar: the character that is displayed instead of letters */
virtual void setPasswordBox(bool passwordBox, wchar_t passwordChar = L'*');
//! Returns true if the edit box is currently a password box.
virtual bool isPasswordBox() const;
//! Updates the absolute position, splits text if required
virtual void updateAbsolutePosition();
//! Writes attributes of the element.
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const;
//! Reads attributes of the element
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options);
protected:
//! Breaks the single text line.
void breakText();
//! sets the area of the given line
void setTextRect(s32 line);
//! returns the line number that the cursor is on
s32 getLineFromPos(s32 pos);
//! adds a letter to the edit box
void inputChar(wchar_t c);
//! calculates the current scroll position
void calculateScrollPos();
//! send some gui event to parent
void sendGuiEvent(EGUI_EVENT_TYPE type);
//! set text markers
void setTextMarkers(s32 begin, s32 end);
bool processKey(const SEvent& event);
bool processMouse(const SEvent& event);
s32 getCursorPos(s32 x, s32 y);
bool MouseMarking;
bool Border;
bool OverrideColorEnabled;
s32 MarkBegin;
s32 MarkEnd;
video::SColor OverrideColor;
gui::IGUIFont *OverrideFont, *LastBreakFont;
IOSOperator* Operator;
u32 BlinkStartTime;
s32 CursorPos;
s32 HScrollPos, VScrollPos; // scroll position in characters
u32 Max;
bool WordWrap, MultiLine, AutoScroll, PasswordBox;
wchar_t PasswordChar;
EGUI_ALIGNMENT HAlign, VAlign;
core::array< core::stringw > BrokenText;
core::array< s32 > BrokenTextPositions;
core::rect<s32> CurrentTextRect, FrameRect; // temporary values
};
} // end namespace gui
} // end namespace irr
#endif // _IRR_COMPILE_WITH_GUI_
#endif // __C_GUI_EDIT_BOX_H_INCLUDED__
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IRR_DEVICE_STUB_H_INCLUDED__
#define __C_IRR_DEVICE_STUB_H_INCLUDED__
#include "IrrlichtDevice.h"
#include "IImagePresenter.h"
#include "SIrrCreationParameters.h"
#include "CVideoModeList.h"
namespace irr
{
// lots of prototypes:
class ILogger;
class CLogger;
namespace gui
{
class IGUIEnvironment;
IGUIEnvironment* createGUIEnvironment(io::IFileSystem* fs,
video::IVideoDriver* Driver, IOSOperator* op);
}
namespace scene
{
ISceneManager* createSceneManager(video::IVideoDriver* driver,
io::IFileSystem* fs, gui::ICursorControl* cc, gui::IGUIEnvironment *gui);
}
namespace io
{
IFileSystem* createFileSystem();
}
namespace video
{
IVideoDriver* createSoftwareDriver(const core::dimension2d<u32>& windowSize,
bool fullscreen, io::IFileSystem* io,
video::IImagePresenter* presenter);
IVideoDriver* createSoftwareDriver2(const core::dimension2d<u32>& windowSize,
bool fullscreen, io::IFileSystem* io,
video::IImagePresenter* presenter);
IVideoDriver* createNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize);
}
//! Stub for an Irrlicht Device implementation
class CIrrDeviceStub : public IrrlichtDevice
{
public:
//! constructor
CIrrDeviceStub(const SIrrlichtCreationParameters& param);
//! destructor
virtual ~CIrrDeviceStub();
//! returns the video driver
virtual video::IVideoDriver* getVideoDriver();
//! return file system
virtual io::IFileSystem* getFileSystem();
//! returns the gui environment
virtual gui::IGUIEnvironment* getGUIEnvironment();
//! returns the scene manager
virtual scene::ISceneManager* getSceneManager();
//! \return Returns a pointer to the mouse cursor control interface.
virtual gui::ICursorControl* getCursorControl();
//! Returns a pointer to a list with all video modes supported by the gfx adapter.
virtual video::IVideoModeList* getVideoModeList();
//! Returns a pointer to the ITimer object. With it the current Time can be received.
virtual ITimer* getTimer();
//! Returns the version of the engine.
virtual const char* getVersion() const;
//! send the event to the right receiver
virtual bool postEventFromUser(const SEvent& event);
//! Sets a new event receiver to receive events
virtual void setEventReceiver(IEventReceiver* receiver);
//! Returns pointer to the current event receiver. Returns 0 if there is none.
virtual IEventReceiver* getEventReceiver();
//! Sets the input receiving scene manager.
/** If set to null, the main scene manager (returned by GetSceneManager()) will receive the input */
virtual void setInputReceivingSceneManager(scene::ISceneManager* sceneManager);
//! Returns a pointer to the logger.
virtual ILogger* getLogger();
//! Returns the operation system opertator object.
virtual IOSOperator* getOSOperator();
//! Checks if the window is running in fullscreen mode.
virtual bool isFullscreen() const;
//! get color format of the current window
virtual video::ECOLOR_FORMAT getColorFormat() const;
//! Activate any joysticks, and generate events for them.
virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo);
//! Set the current Gamma Value for the Display
virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast );
//! Get the current Gamma Value for the Display
virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast );
//! Set the maximal elapsed time between 2 clicks to generate doubleclicks for the mouse. It also affects tripleclick behaviour.
//! When set to 0 no double- and tripleclicks will be generated.
virtual void setDoubleClickTime( u32 timeMs );
//! Get the maximal elapsed time between 2 clicks to generate double- and tripleclicks for the mouse.
virtual u32 getDoubleClickTime() const;
//! Remove all messages pending in the system message loop
virtual void clearSystemMessages();
protected:
void createGUIAndScene();
//! checks version of SDK and prints warning if there might be a problem
bool checkVersion(const char* version);
//! Compares to the last call of this function to return double and triple clicks.
//! \return Returns only 1,2 or 3. A 4th click will start with 1 again.
virtual u32 checkSuccessiveClicks(s32 mouseX, s32 mouseY, EMOUSE_INPUT_EVENT inputEvent );
void calculateGammaRamp ( u16 *ramp, f32 gamma, f32 relativebrightness, f32 relativecontrast );
void calculateGammaFromRamp ( f32 &gamma, const u16 *ramp );
video::IVideoDriver* VideoDriver;
gui::IGUIEnvironment* GUIEnvironment;
scene::ISceneManager* SceneManager;
ITimer* Timer;
gui::ICursorControl* CursorControl;
IEventReceiver* UserReceiver;
CLogger* Logger;
IOSOperator* Operator;
io::IFileSystem* FileSystem;
scene::ISceneManager* InputReceivingSceneManager;
struct SMouseMultiClicks
{
SMouseMultiClicks()
: DoubleClickTime(500), CountSuccessiveClicks(0), LastClickTime(0), LastMouseInputEvent(EMIE_COUNT)
{}
u32 DoubleClickTime;
u32 CountSuccessiveClicks;
u32 LastClickTime;
core::position2di LastClick;
EMOUSE_INPUT_EVENT LastMouseInputEvent;
};
SMouseMultiClicks MouseMultiClicks;
video::CVideoModeList VideoModeList;
SIrrlichtCreationParameters CreationParams;
bool Close;
};
} // end namespace irr
#endif
This diff is collapsed.
This diff is collapsed.
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "COSOperator.h"
#ifdef _IRR_WINDOWS_API_
#ifndef _IRR_XBOX_PLATFORM_
#include <windows.h>
#endif
#else
#include <string.h>
#include <unistd.h>
#ifndef _IRR_SOLARIS_PLATFORM_
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
#endif
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
#include "CIrrDeviceLinux.h"
#endif
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
#include "MacOSX/OSXClipboard.h"
#endif
namespace irr
{
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
// constructor linux
COSOperator::COSOperator(const c8* osversion, CIrrDeviceLinux* device)
: IrrDeviceLinux(device)
{
}
#endif
// constructor
COSOperator::COSOperator(const c8* osVersion) : OperatingSystem(osVersion)
{
#ifdef _DEBUG
setDebugName("COSOperator");
#endif
}
//! returns the current operating system version as string.
const wchar_t* COSOperator::getOperationSystemVersion() const
{
return OperatingSystem.c_str();
}
//! copies text to the clipboard
void COSOperator::copyToClipboard(const c8* text) const
{
if (strlen(text)==0)
return;
// Windows version
#if defined(_IRR_XBOX_PLATFORM_)
#elif defined(_IRR_WINDOWS_API_)
if (!OpenClipboard(NULL) || text == 0)
return;
EmptyClipboard();
HGLOBAL clipbuffer;
wchar_t* buffer;
clipbuffer = GlobalAlloc(GMEM_DDESHARE, (wcslen((wchar_t*)text)+1) * sizeof(wchar_t*));
buffer = (wchar_t*)GlobalLock(clipbuffer);
wcscpy(buffer, (wchar_t*)text);
GlobalUnlock(clipbuffer);
SetClipboardData(CF_UNICODETEXT, clipbuffer);
CloseClipboard();
// MacOSX version
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
OSXCopyToClipboard(text);
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
if ( IrrDeviceLinux )
IrrDeviceLinux->copyToClipboard(text);
#else
#endif
}
//! gets text from the clipboard
//! \return Returns 0 if no string is in there.
const c8* COSOperator::getTextFromClipboard() const
{
#if defined(_IRR_XBOX_PLATFORM_)
return 0;
#elif defined(_IRR_WINDOWS_API_)
if (!OpenClipboard(NULL))
return 0;
char * buffer = 0;
HANDLE hData = GetClipboardData(CF_UNICODETEXT);
buffer = (char*)GlobalLock( hData );
GlobalUnlock( hData );
CloseClipboard();
return buffer;
#elif defined(_IRR_COMPILE_WITH_OSX_DEVICE_)
return (OSXCopyFromClipboard());
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
if ( IrrDeviceLinux )
return IrrDeviceLinux->getTextFromClipboard();
return 0;
#else
return 0;
#endif
}
bool COSOperator::getProcessorSpeedMHz(u32* MHz) const
{
#if defined(_IRR_WINDOWS_API_) && !defined(_WIN32_WCE ) && !defined (_IRR_XBOX_PLATFORM_)
LONG Error;
HKEY Key;
Error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
__TEXT("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0"),
0, KEY_READ, &Key);
if(Error != ERROR_SUCCESS)
return false;
DWORD Speed = 0;
DWORD Size = sizeof(Speed);
Error = RegQueryValueEx(Key, __TEXT("~MHz"), NULL, NULL, (LPBYTE)&Speed, &Size);
RegCloseKey(Key);
if (Error != ERROR_SUCCESS)
return false;
else if (MHz)
*MHz = Speed;
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return true;
#elif defined(_IRR_OSX_PLATFORM_)
struct clockinfo CpuClock;
size_t Size = sizeof(clockinfo);
if (!sysctlbyname("kern.clockrate", &CpuClock, &Size, NULL, 0))
return false;
else if (MHz)
*MHz = CpuClock.hz;
return true;
#else
// could probably be read from "/proc/cpuinfo" or "/proc/cpufreq"
return false;
#endif
}
bool COSOperator::getSystemMemory(u32* Total, u32* Avail) const
{
#if defined(_IRR_WINDOWS_API_) && !defined (_IRR_XBOX_PLATFORM_)
MEMORYSTATUS MemoryStatus;
MemoryStatus.dwLength = sizeof(MEMORYSTATUS);
// cannot fail
GlobalMemoryStatus(&MemoryStatus);
if (Total)
*Total = (u32)(MemoryStatus.dwTotalPhys>>10);
if (Avail)
*Avail = (u32)(MemoryStatus.dwAvailPhys>>10);
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return true;
#elif defined(_IRR_POSIX_API_) && !defined(__FreeBSD__)
#if defined(_SC_PHYS_PAGES) && defined(_SC_AVPHYS_PAGES)
long ps = sysconf(_SC_PAGESIZE);
long pp = sysconf(_SC_PHYS_PAGES);
long ap = sysconf(_SC_AVPHYS_PAGES);
if ((ps==-1)||(pp==-1)||(ap==-1))
return false;
if (Total)
*Total = (u32)((ps*(long long)pp)>>10);
if (Avail)
*Avail = (u32)((ps*(long long)ap)>>10);
return true;
#else
// TODO: implement for non-availablity of symbols/features
return false;
#endif
#else
// TODO: implement for OSX
return false;
#endif
}
} // end namespace
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_OS_OPERATOR_H_INCLUDED__
#define __C_OS_OPERATOR_H_INCLUDED__
#include "IOSOperator.h"
#include "irrString.h"
#include "IrrCompileConfig.h"
namespace irr
{
class CIrrDeviceLinux;
//! The Operating system operator provides operation system specific methods and informations.
class COSOperator : public IOSOperator
{
public:
// constructor
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
COSOperator(const c8* osversion, CIrrDeviceLinux* device);
#endif
COSOperator(const c8* osversion);
//! returns the current operation system version as string.
virtual const wchar_t* getOperationSystemVersion() const;
//! copies text to the clipboard
virtual void copyToClipboard(const c8* text) const;
//! gets text from the clipboard
//! \return Returns 0 if no string is in there.
virtual const c8* getTextFromClipboard() const;
//! gets the processor speed in megahertz
//! \param Mhz:
//! \return Returns true if successful, false if not
virtual bool getProcessorSpeedMHz(u32* MHz) const;
//! gets the total and available system RAM in kB
//! \param Total: will contain the total system memory
//! \param Avail: will contain the available memory
//! \return Returns true if successful, false if not
virtual bool getSystemMemory(u32* Total, u32* Avail) const;
private:
core::stringw OperatingSystem;
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
CIrrDeviceLinux * IrrDeviceLinux;
#endif
};
} // end namespace
#endif
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IRR_C_TIMER_H_INCLUDED__
#define __C_IRR_C_TIMER_H_INCLUDED__
#include "ITimer.h"
#include "os.h"
namespace irr
{
//! Device independent implementation of the timer
class CTimer : public ITimer
{
public:
CTimer()
{
os::Timer::initTimer();
}
//! Returns current real time in milliseconds of the system.
/** This value does not start with 0 when the application starts.
For example in one implementation the value returned could be the
amount of milliseconds which have elapsed since the system was started. */
virtual u32 getRealTime() const
{
return os::Timer::getRealTime();
}
//! Returns current virtual time in milliseconds.
/** This value starts with 0 and can be manipulated using setTime(), stopTimer(),
startTimer(), etc. This value depends on the set speed of the timer if the timer
is stopped, etc. If you need the system time, use getRealTime() */
virtual u32 getTime() const
{
return os::Timer::getTime();
}
//! sets current virtual time
virtual void setTime(u32 time)
{
os::Timer::setTime(time);
}
//! Stops the game timer.
/** The timer is reference counted, which means everything which calls
stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop
corretly again. */
virtual void stop()
{
os::Timer::stopTimer();
}
//! Starts the game timer.
/** The timer is reference counted, which means everything which calls
stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop
corretly again. */
virtual void start()
{
os::Timer::startTimer();
}
//! Sets the speed of the timer
/** The speed is the factor with which the time is running faster or slower then the
real system time. */
virtual void setSpeed(f32 speed = 1.0f)
{
os::Timer::setSpeed(speed);
}
//! Returns current speed of the timer
/** The speed is the factor with which the time is running faster or slower then the
real system time. */
virtual f32 getSpeed() const
{
return os::Timer::getSpeed();
}
//! Returns if game timer is currently stopped
virtual bool isStopped() const
{
bool ret = os::Timer::isStopped();
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return ret;
}
//! Advances the virtual time
/** Makes the virtual timer update the time value based on the real time. This is
called automaticly when calling IrrlichtDevice::run(), but you can call it manually
if you don't use this method. */
virtual void tick()
{
os::Timer::tick();
}
};
} // end namespace
#endif
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_C_VIDEO_MODE_LIST_H_INCLUDED__
#define __IRR_C_VIDEO_MODE_LIST_H_INCLUDED__
#include "IVideoModeList.h"
#include "dimension2d.h"
#include "irrArray.h"
namespace irr
{
namespace video
{
class CVideoModeList : public IVideoModeList
{
public:
//! constructor
CVideoModeList();
//! Gets amount of video modes in the list.
virtual s32 getVideoModeCount() const;
//! Returns the screen size of a video mode in pixels.
virtual core::dimension2d<u32> getVideoModeResolution(s32 modeNumber) const;
//! Returns the screen size of an optimal video mode in pixels.
virtual core::dimension2d<u32> getVideoModeResolution(const core::dimension2d<u32>& minSize, const core::dimension2d<u32>& maxSize) const;
//! Returns the pixel depth of a video mode in bits.
virtual s32 getVideoModeDepth(s32 modeNumber) const;
//! Returns current desktop screen resolution.
virtual const core::dimension2d<u32>& getDesktopResolution() const;
//! Returns the pixel depth of a video mode in bits.
virtual s32 getDesktopDepth() const;
//! adds a new mode to the list
void addMode(const core::dimension2d<u32>& size, s32 depth);
void setDesktop(s32 desktopDepth, const core::dimension2d<u32>& desktopSize);
private:
struct SVideoMode
{
core::dimension2d<u32> size;
s32 depth;
bool operator==(const SVideoMode& other) const
{
return size == other.size && depth == other.depth;
}
bool operator <(const SVideoMode& other) const
{
return (size.Width < other.size.Width ||
(size.Width == other.size.Width &&
size.Height < other.size.Height) ||
(size.Width == other.size.Width &&
size.Height == other.size.Height &&
depth < other.depth));
}
};
core::array<SVideoMode> VideoModes;
SVideoMode Desktop;
};
} // end namespace video
} // end namespace irr
#endif
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_IMAGE_PRESENTER_H_INCLUDED__
#define __I_IMAGE_PRESENTER_H_INCLUDED__
#include "IImage.h"
namespace irr
{
namespace video
{
/*!
Interface for a class which is able to present an IImage
an the Screen. Usually only implemented by an IrrDevice for
presenting Software Device Rendered images.
This class should be used only internally.
*/
class IImagePresenter
{
public:
virtual ~IImagePresenter() {};
//! presents a surface in the client area
virtual bool present(video::IImage* surface, void* windowId=0, core::rect<s32>* src=0 ) = 0;
};
} // end namespace video
} // end namespace irr
#endif
......@@ -11,7 +11,7 @@ namespace ygo {
struct CardData {
unsigned int code;
unsigned int alias;
unsigned int setcode;
unsigned long long setcode;
unsigned int type;
unsigned int level;
unsigned int attribute;
......@@ -22,7 +22,7 @@ struct CardData {
struct CardDataC {
unsigned int code;
unsigned int alias;
unsigned int setcode;
unsigned long long setcode;
unsigned int type;
unsigned int level;
unsigned int attribute;
......
......@@ -27,7 +27,7 @@ bool DataManager::LoadDB(const char* file) {
cd.code = sqlite3_column_int(pStmt, 0);
cd.ot = sqlite3_column_int(pStmt, 1);
cd.alias = sqlite3_column_int(pStmt, 2);
cd.setcode = sqlite3_column_int(pStmt, 3);
cd.setcode = sqlite3_column_int64(pStmt, 3);
cd.type = sqlite3_column_int(pStmt, 4);
cd.attack = sqlite3_column_int(pStmt, 5);
cd.defence = sqlite3_column_int(pStmt, 6);
......
......@@ -48,6 +48,7 @@ bool Game::Initialize() {
deckManager.LoadLFList();
driver = device->getVideoDriver();
driver->setTextureCreationFlag(irr::video::ETCF_CREATE_MIP_MAPS, false);
driver->setTextureCreationFlag(irr::video::ETCF_OPTIMIZED_FOR_QUALITY, true);
imageManager.SetDevice(device);
if(!imageManager.Initial())
return false;
......
......@@ -31,27 +31,27 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_JOIN_HOST: {
struct addrinfo hints, *servinfo;
memset(&hints, 0, sizeof(struct addrinfo));
hints.ai_family = AF_INET; /* Allow IPv4 or IPv6 */
hints.ai_socktype = SOCK_STREAM; /* Datagram socket */
hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */
hints.ai_protocol = 0; /* Any protocol */
hints.ai_canonname = NULL;
hints.ai_addr = NULL;
hints.ai_next = NULL;
// struct addrinfo hints, *servinfo;
// memset(&hints, 0, sizeof(struct addrinfo));
// hints.ai_family = AF_INET; /* Allow IPv4 or IPv6 */
// hints.ai_socktype = SOCK_STREAM; /* Datagram socket */
// hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */
// hints.ai_protocol = 0; /* Any protocol */
// hints.ai_canonname = NULL;
// hints.ai_addr = NULL;
// hints.ai_next = NULL;
int status;
char hostname[100];
char ip[20];
const wchar_t* pstr = mainGame->ebJoinIP->getText();
BufferIO::CopyWStr(pstr, hostname, 100);
if ((status = getaddrinfo(hostname, NULL, &hints, &servinfo)) == -1) {
//fprintf(stderr, "getaddrinfo error: %s\n", gai_strerror(status));
//error handling
// if ((status = getaddrinfo(hostname, NULL, &hints, &servinfo)) == -1) {
// //fprintf(stderr, "getaddrinfo error: %s\n", gai_strerror(status));
// //error handling
BufferIO::CopyWStr(pstr, ip, 16);
} else
inet_ntop(AF_INET, &(((struct sockaddr_in *)servinfo->ai_addr)->sin_addr), ip, 20);
freeaddrinfo(servinfo);
// } else
// inet_ntop(AF_INET, &(((struct sockaddr_in *)servinfo->ai_addr)->sin_addr), ip, 20);
// freeaddrinfo(servinfo);
unsigned int remote_addr = htonl(inet_addr(ip));
unsigned int remote_port = _wtoi(mainGame->ebJoinPort->getText());
BufferIO::CopyWStr(pstr, mainGame->gameConf.lastip, 20);
......
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_OS_H_INCLUDED__
#define __IRR_OS_H_INCLUDED__
#include "IrrCompileConfig.h" // for endian check
#include "irrTypes.h"
#include "irrString.h"
#include "path.h"
#include "ILogger.h"
namespace irr
{
namespace os
{
class Byteswap
{
public:
static u16 byteswap(u16 num);
static s16 byteswap(s16 num);
static u32 byteswap(u32 num);
static s32 byteswap(s32 num);
static f32 byteswap(f32 num);
// prevent accidental swapping of chars
static u8 byteswap(u8 num);
static c8 byteswap(c8 num);
};
class Printer
{
public:
// prints out a string to the console out stdout or debug log or whatever
static void print(const c8* message);
static void log(const c8* message, ELOG_LEVEL ll = ELL_INFORMATION);
static void log(const wchar_t* message, ELOG_LEVEL ll = ELL_INFORMATION);
static void log(const c8* message, const c8* hint, ELOG_LEVEL ll = ELL_INFORMATION);
static void log(const c8* message, const io::path& hint, ELOG_LEVEL ll = ELL_INFORMATION);
static ILogger* Logger;
};
class Randomizer
{
public:
//! resets the randomizer
static void reset();
//! generates a pseudo random number
static s32 rand();
private:
static s32 seed;
};
class Timer
{
public:
//! returns the current time in milliseconds
static u32 getTime();
//! initializes the real timer
static void initTimer();
//! sets the current virtual (game) time
static void setTime(u32 time);
//! stops the virtual (game) timer
static void stopTimer();
//! starts the game timer
static void startTimer();
//! sets the speed of the virtual timer
static void setSpeed(f32 speed);
//! gets the speed of the virtual timer
static f32 getSpeed();
//! returns if the timer currently is stopped
static bool isStopped();
//! makes the virtual timer update the time value based on the real time
static void tick();
//! returns the current real time in milliseconds
static u32 getRealTime();
private:
static void initVirtualTimer();
static f32 VirtualTimerSpeed;
static s32 VirtualTimerStopCounter;
static u32 StartRealTime;
static u32 LastVirtualTime;
static u32 StaticTime;
};
} // end namespace os
} // end namespace irr
#endif
......@@ -21,7 +21,7 @@ class group;
struct card_data {
uint32 code;
uint32 alias;
uint32 setcode;
uint64 setcode;
uint32 type;
uint32 level;
uint32 attribute;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment