Commit ba385262 authored by bitplane's avatar bitplane

Had to rename some reserved words in (maybe objc++ but possibly macros to do...

Had to rename some reserved words in (maybe objc++ but possibly macros to do with xcode?) IQ3Shader::id to ID, string::verify to validate.
Put casts back into OSX driver

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@2215 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 510bb72e
...@@ -637,12 +637,12 @@ namespace quake3 ...@@ -637,12 +637,12 @@ namespace quake3
struct IShader struct IShader
{ {
IShader () IShader ()
: id ( 0 ), VarGroup ( 0 ) {} : ID ( 0 ), VarGroup ( 0 ) {}
virtual ~IShader () {} virtual ~IShader () {}
void operator = (const IShader &other ) void operator = (const IShader &other )
{ {
id = other.id; ID = other.ID;
VarGroup = other.VarGroup; VarGroup = other.VarGroup;
name = other.name; name = other.name;
} }
...@@ -675,7 +675,7 @@ namespace quake3 ...@@ -675,7 +675,7 @@ namespace quake3
} }
// id // id
s32 id; s32 ID;
SVarGroupList *VarGroup; // reference SVarGroupList *VarGroup; // reference
// Shader: shader name ( also first variable in first Vargroup ) // Shader: shader name ( also first variable in first Vargroup )
......
// Copyright (C) 2002-2009 Nikolaus Gebhardt // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine". // This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h // For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_CORE_UTIL_H_INCLUDED__ #ifndef __IRR_CORE_UTIL_H_INCLUDED__
#define __IRR_CORE_UTIL_H_INCLUDED__ #define __IRR_CORE_UTIL_H_INCLUDED__
#include "irrString.h" #include "irrString.h"
namespace irr namespace irr
{ {
namespace core namespace core
{ {
/*! \file irrxml.h /*! \file irrxml.h
\brief File containing useful basic utility functions \brief File containing useful basic utility functions
*/ */
// ----------- some basic quite often used string functions ----------------- // ----------- some basic quite often used string functions -----------------
//! search if a filename has a proper extension //! search if a filename has a proper extension
inline s32 isFileExtension ( const core::string<c16>& filename, inline s32 isFileExtension ( const core::string<c16>& filename,
const core::string<c16>& ext0, const core::string<c16>& ext0,
const core::string<c16>& ext1, const core::string<c16>& ext1,
const core::string<c16>& ext2 const core::string<c16>& ext2
) )
{ {
s32 extPos = filename.findLast ( '.' ); s32 extPos = filename.findLast ( '.' );
if ( extPos < 0 ) if ( extPos < 0 )
return 0; return 0;
extPos += 1; extPos += 1;
if ( filename.equals_substring_ignore_case ( ext0, extPos ) ) return 1; if ( filename.equals_substring_ignore_case ( ext0, extPos ) ) return 1;
if ( filename.equals_substring_ignore_case ( ext1, extPos ) ) return 2; if ( filename.equals_substring_ignore_case ( ext1, extPos ) ) return 2;
if ( filename.equals_substring_ignore_case ( ext2, extPos ) ) return 3; if ( filename.equals_substring_ignore_case ( ext2, extPos ) ) return 3;
return 0; return 0;
} }
//! search if a filename has a proper extension //! search if a filename has a proper extension
inline bool hasFileExtension ( const core::string<c16>& filename, inline bool hasFileExtension ( const core::string<c16>& filename,
const core::string<c16>& ext0, const core::string<c16>& ext0,
const core::string<c16>& ext1 = "", const core::string<c16>& ext1 = "",
const core::string<c16>& ext2 = "" const core::string<c16>& ext2 = ""
) )
{ {
return isFileExtension ( filename, ext0, ext1, ext2 ) > 0; return isFileExtension ( filename, ext0, ext1, ext2 ) > 0;
} }
//! cut the filename extension from a source string and stores in the dest string //! cut the filename extension from a source string and stores in the dest string
inline stringc& cutFilenameExtension ( stringc &dest, const stringc &source ) inline stringc& cutFilenameExtension ( stringc &dest, const stringc &source )
{ {
s32 endPos = source.findLast ( '.' ); s32 endPos = source.findLast ( '.' );
dest = source.subString ( 0, endPos < 0 ? source.size () : endPos ); dest = source.subString ( 0, endPos < 0 ? source.size () : endPos );
return dest; return dest;
} }
//! cut the filename extension from a source string and stores in the dest string //! cut the filename extension from a source string and stores in the dest string
inline stringw& cutFilenameExtension ( stringw &dest, const stringw &source ) inline stringw& cutFilenameExtension ( stringw &dest, const stringw &source )
{ {
s32 endPos = source.findLast ( '.' ); s32 endPos = source.findLast ( '.' );
dest = source.subString ( 0, endPos < 0 ? source.size () : endPos ); dest = source.subString ( 0, endPos < 0 ? source.size () : endPos );
return dest; return dest;
} }
//! get the filename extension from a string //! get the filename extension from a string
inline stringc& getFileNameExtension ( stringc &dest, const stringc &source ) inline stringc& getFileNameExtension ( stringc &dest, const stringc &source )
{ {
s32 endPos = source.findLast ( '.' ); s32 endPos = source.findLast ( '.' );
if ( endPos < 0 ) if ( endPos < 0 )
dest = ""; dest = "";
else else
dest = source.subString ( endPos, source.size () ); dest = source.subString ( endPos, source.size () );
return dest; return dest;
} }
//! delete path from filename //! delete path from filename
inline core::stringw& deletePathFromFilename(core::stringw& filename) inline core::stringw& deletePathFromFilename(core::stringw& filename)
{ {
// delete path from filename // delete path from filename
const wchar_t *s = filename.c_str(); const wchar_t *s = filename.c_str();
const wchar_t* p = s + filename.size(); const wchar_t* p = s + filename.size();
// search for path separator or beginning // search for path separator or beginning
while ( *p != '/' && *p != '\\' && p != s ) while ( *p != '/' && *p != '\\' && p != s )
p--; p--;
if ( p != s ) if ( p != s )
{ {
++p; ++p;
filename = p; filename = p;
} }
return filename; return filename;
} }
//! delete path from filename //! delete path from filename
inline core::stringc& deletePathFromFilename(core::stringc& filename) inline core::stringc& deletePathFromFilename(core::stringc& filename)
{ {
// delete path from filename // delete path from filename
const c8 *s = filename.c_str(); const c8 *s = filename.c_str();
const c8* p = s + filename.size(); const c8* p = s + filename.size();
// search for path separator or beginning // search for path separator or beginning
while ( *p != '/' && *p != '\\' && p != s ) while ( *p != '/' && *p != '\\' && p != s )
p--; p--;
if ( p != s ) if ( p != s )
{ {
++p; ++p;
filename = p; filename = p;
} }
return filename; return filename;
} }
//! trim paths //! trim paths
inline core::string<c16>& deletePathFromPath(core::string<c16>& filename, s32 pathCount) inline core::string<c16>& deletePathFromPath(core::string<c16>& filename, s32 pathCount)
{ {
// delete path from filename // delete path from filename
s32 i = filename.size(); s32 i = filename.size();
// search for path separator or beginning // search for path separator or beginning
while ( i ) while ( i )
{ {
if ( filename[i] == '/' || filename[i] == '\\' ) if ( filename[i] == '/' || filename[i] == '\\' )
{ {
if ( --pathCount <= 0 ) if ( --pathCount <= 0 )
break; break;
} }
i -= 1; i -= 1;
} }
if ( i ) if ( i )
{ {
filename [ i + 1 ] = 0; filename [ i + 1 ] = 0;
filename.verify(); filename.validate();
} }
return filename; return filename;
} }
//! gets the last char of a string or null //! gets the last char of a string or null
inline c16 lastChar( const core::string<c16>& s) inline c16 lastChar( const core::string<c16>& s)
{ {
return s.size() ? s [ s.size() - 1 ] : 0; return s.size() ? s [ s.size() - 1 ] : 0;
} }
//! looks if file is in the same directory of path. returns offset of directory. //! looks if file is in the same directory of path. returns offset of directory.
//! 0 means in same directory. 1 means file is direct child of path //! 0 means in same directory. 1 means file is direct child of path
inline s32 isInSameDirectory ( const core::string<c16>& path, const core::string<c16>& file ) inline s32 isInSameDirectory ( const core::string<c16>& path, const core::string<c16>& file )
{ {
s32 subA = 0; s32 subA = 0;
s32 subB = 0; s32 subB = 0;
s32 pos; s32 pos;
if ( path.size() && !path.equalsn ( file, path.size() ) ) if ( path.size() && !path.equalsn ( file, path.size() ) )
return -1; return -1;
pos = 0; pos = 0;
while ( (pos = path.findNext ( '/', pos )) >= 0 ) while ( (pos = path.findNext ( '/', pos )) >= 0 )
{ {
subA += 1; subA += 1;
pos += 1; pos += 1;
} }
pos = 0; pos = 0;
while ( (pos = file.findNext ( '/', pos )) >= 0 ) while ( (pos = file.findNext ( '/', pos )) >= 0 )
{ {
subB += 1; subB += 1;
pos += 1; pos += 1;
} }
return subB - subA; return subB - subA;
} }
//! some standard function ( to remove dependencies ) //! some standard function ( to remove dependencies )
#undef isdigit #undef isdigit
#undef isspace #undef isspace
#undef isupper #undef isupper
inline s32 isdigit(s32 c) { return c >= '0' && c <= '9'; } inline s32 isdigit(s32 c) { return c >= '0' && c <= '9'; }
inline s32 isspace(s32 c) { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v'; } inline s32 isspace(s32 c) { return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v'; }
inline s32 isupper(s32 c) { return c >= 'A' && c <= 'Z'; } inline s32 isupper(s32 c) { return c >= 'A' && c <= 'Z'; }
} // end namespace core } // end namespace core
} // end namespace irr } // end namespace irr
#endif #endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -83,7 +83,7 @@ namespace irr ...@@ -83,7 +83,7 @@ namespace irr
{ {
public: public:
CCursorControl(const core::dimension2d<s32>& wsize, CIrrDeviceMacOSX *device) : WindowSize(wsize), IsVisible(true), InvWindowSize(0.0f, 0.0f), _device(device), UseReferenceRect(false) CCursorControl(const core::dimension2d<u32>& wsize, CIrrDeviceMacOSX *device) : WindowSize(wsize), IsVisible(true), InvWindowSize(0.0f, 0.0f), _device(device), UseReferenceRect(false)
{ {
CursorPos.X = CursorPos.Y = 0; CursorPos.X = CursorPos.Y = 0;
if (WindowSize.Width!=0) InvWindowSize.Width = 1.0f / WindowSize.Width; if (WindowSize.Width!=0) InvWindowSize.Width = 1.0f / WindowSize.Width;
......
...@@ -432,30 +432,31 @@ bool CIrrDeviceMacOSX::createWindow() ...@@ -432,30 +432,31 @@ bool CIrrDeviceMacOSX::createWindow()
_screenWidth = (int) CGDisplayPixelsWide(display); _screenWidth = (int) CGDisplayPixelsWide(display);
_screenHeight = (int) CGDisplayPixelsHigh(display); _screenHeight = (int) CGDisplayPixelsHigh(display);
VideoModeList.setDesktop(CreationParams.Bits,core::dimension2d<s32>(_screenWidth, _screenHeight)); VideoModeList.setDesktop(CreationParams.Bits, core::dimension2d<u32>(_screenWidth, _screenHeight));
if (!CreationParams.Fullscreen) if (!CreationParams.Fullscreen)
{ {
_window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,CreationParams.WindowSize.Width,CreationParams.WindowSize.Height) styleMask:NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask backing:NSBackingStoreBuffered defer:FALSE]; _window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0,0,CreationParams.WindowSize.Width,CreationParams.WindowSize.Height) styleMask:NSTitledWindowMask+NSClosableWindowMask+NSResizableWindowMask backing:NSBackingStoreBuffered defer:FALSE];
if (_window != NULL) if (_window != NULL)
{ {
NSOpenGLPixelFormatAttribute windowattribs[] = { NSOpenGLPixelFormatAttribute windowattribs[] =
{
NSOpenGLPFANoRecovery, NSOpenGLPFANoRecovery,
NSOpenGLPFAAccelerated, NSOpenGLPFAAccelerated,
NSOpenGLPFADepthSize, depthSize, NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)depthSize,
NSOpenGLPFAColorSize, CreationParams.Bits, NSOpenGLPFAColorSize, (NSOpenGLPixelFormatAttribute)CreationParams.Bits,
NSOpenGLPFAAlphaSize, alphaSize, NSOpenGLPFAAlphaSize, (NSOpenGLPixelFormatAttribute)alphaSize,
NSOpenGLPFASampleBuffers, 1, NSOpenGLPFASampleBuffers, (NSOpenGLPixelFormatAttribute)1,
NSOpenGLPFASamples, CreationParams.AntiAlias, NSOpenGLPFASamples, (NSOpenGLPixelFormatAttribute)CreationParams.AntiAlias,
NSOpenGLPFAStencilSize, CreationParams.Stencilbuffer?1:0, NSOpenGLPFAStencilSize, (NSOpenGLPixelFormatAttribute)(CreationParams.Stencilbuffer?1:0),
NSOpenGLPFADoubleBuffer, NSOpenGLPFADoubleBuffer,
(NSOpenGLPixelFormatAttribute)nil (NSOpenGLPixelFormatAttribute)nil
}; };
if (CreationParams.AntiAlias<2) if (CreationParams.AntiAlias<2)
{ {
windowattribs[9] = 0; windowattribs[9] = (NSOpenGLPixelFormatAttribute)0;
windowattribs[11] = 0; windowattribs[11] = (NSOpenGLPixelFormatAttribute)0;
} }
NSOpenGLPixelFormat *format; NSOpenGLPixelFormat *format;
...@@ -466,7 +467,7 @@ bool CIrrDeviceMacOSX::createWindow() ...@@ -466,7 +467,7 @@ bool CIrrDeviceMacOSX::createWindow()
// Second try without stencilbuffer // Second try without stencilbuffer
if (CreationParams.Stencilbuffer) if (CreationParams.Stencilbuffer)
{ {
windowattribs[13]=0; windowattribs[13]=(NSOpenGLPixelFormatAttribute)0;
} }
else else
continue; continue;
...@@ -485,19 +486,19 @@ bool CIrrDeviceMacOSX::createWindow() ...@@ -485,19 +486,19 @@ bool CIrrDeviceMacOSX::createWindow()
{ {
while (!format && windowattribs[12]>1) while (!format && windowattribs[12]>1)
{ {
windowattribs -= 1; windowattribs[12] = (NSOpenGLPixelFormatAttribute)((int)windowattribs[12]-1);
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs]; format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs];
} }
if (!format) if (!format)
{ {
windowattribs[9] = 0; windowattribs[9] = (NSOpenGLPixelFormatAttribute)0;
windowattribs[11] = 0; windowattribs[11] = (NSOpenGLPixelFormatAttribute)0;
format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs]; format = [[NSOpenGLPixelFormat alloc] initWithAttributes:windowattribs];
if (!format) if (!format)
{ {
// reset values for next try // reset values for next try
windowattribs[9] = 1; windowattribs[9] = (NSOpenGLPixelFormatAttribute)1;
windowattribs[11] = CreationParams.AntiAlias; windowattribs[11] = (NSOpenGLPixelFormatAttribute)CreationParams.AntiAlias;
} }
else else
{ {
...@@ -626,7 +627,7 @@ void CIrrDeviceMacOSX::setResize(int width, int height) ...@@ -626,7 +627,7 @@ void CIrrDeviceMacOSX::setResize(int width, int height)
// resize the driver to the inner pane size // resize the driver to the inner pane size
NSRect driverFrame = [(NSWindow*)_window contentRectForFrameRect:[(NSWindow*)_window frame]]; NSRect driverFrame = [(NSWindow*)_window contentRectForFrameRect:[(NSWindow*)_window frame]];
getVideoDriver()->OnResize(core::dimension2d<s32>( (s32)driverFrame.size.width, (s32)driverFrame.size.height)); getVideoDriver()->OnResize(core::dimension2d<u32>( (s32)driverFrame.size.width, (s32)driverFrame.size.height));
} }
void CIrrDeviceMacOSX::createDriver() void CIrrDeviceMacOSX::createDriver()
...@@ -1308,7 +1309,7 @@ video::IVideoModeList* CIrrDeviceMacOSX::getVideoModeList() ...@@ -1308,7 +1309,7 @@ video::IVideoModeList* CIrrDeviceMacOSX::getVideoModeList()
long width = GetDictionaryLong(mode, kCGDisplayWidth); long width = GetDictionaryLong(mode, kCGDisplayWidth);
long height = GetDictionaryLong(mode, kCGDisplayHeight); long height = GetDictionaryLong(mode, kCGDisplayHeight);
// long refresh = GetDictionaryLong((mode), kCGDisplayRefreshRate); // long refresh = GetDictionaryLong((mode), kCGDisplayRefreshRate);
VideoModeList.addMode(core::dimension2d<s32>(width, height), VideoModeList.addMode(core::dimension2d<u32>(width, height),
bitsPerPixel); bitsPerPixel);
} }
} }
......
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