Răsfoiți Sursa

Normalize whitespace, update documentation.

Lasse Öörni 12 ani în urmă
părinte
comite
679007d1b5

+ 1 - 0
Docs/Reference.dox

@@ -133,6 +133,7 @@ The full list of supported parameters, their datatypes and default values:
 - ResourcePackages (string) A semicolon-separated list of resource paths to use. Default empty.
 - ForceSM2 (bool) Whether to force %Shader %Model 2, effective in Direct3D9 mode only. Default false.
 - ExternalWindow (void ptr) External window handle to use instead of creating an application window. Default null.
+- WindowIcon (string) %Window icon image resource name. Default empty (use application default icon.)
 - WindowTitle (string) %Window title. Default "Urho3D".
 - WindowWidth (int) %Window horizontal dimension. Default 0 (use desktop resolution, or 1024 in windowed mode.)
 - WindowHeight (int) %Window vertical dimension. Default 0 (use desktop resolution, or 768 in windowed mode.)

+ 1 - 0
Docs/Urho3D.dox

@@ -66,6 +66,7 @@ Urho3D development, contributions and bugfixes by:
 - Ali Kämäräinen
 - Pete Leigh
 - Paul Noome
+- Alex Parlett
 - Vladimir Pobedinsky
 - Miika Santala
 - Steven Zhang

+ 2 - 1
Readme.txt

@@ -25,6 +25,7 @@ Urho3D development, contributions and bugfixes by:
 - Ali Kämäräinen
 - Pete Leigh
 - Paul Noome
+- Alex Parlett
 - Vladimir Pobedinsky
 - Miika Santala
 - Steven Zhang
@@ -548,4 +549,4 @@ V1.1    - Object and scene model refactoring.
         - Added OpenGL and cross-platform support.
         - Switched to kNet library for networking.
 
-V1.0    - Original release.
+V1.0    - Original release.

+ 1 - 1
Source/Engine/Engine/Engine.cpp

@@ -269,7 +269,7 @@ bool Engine::Initialize(const VariantMap& parameters)
             graphics->SetExternalWindow(GetParameter(parameters, "ExternalWindow").GetPtr());
         graphics->SetForceSM2(GetParameter(parameters, "ForceSM2", false).GetBool());
         graphics->SetWindowTitle(GetParameter(parameters, "WindowTitle", "Urho3D").GetString());
-		graphics->SetWindowIcon(cache->GetResource<Image>(GetParameter(parameters, "WindowIcon", "Textures/Icon.png").GetString()));
+        graphics->SetWindowIcon(cache->GetResource<Image>(GetParameter(parameters, "WindowIcon", "Textures/Icon.png").GetString()));
         if (!graphics->SetMode(
             GetParameter(parameters, "WindowWidth", 0).GetInt(),
             GetParameter(parameters, "WindowHeight", 0).GetInt(),

+ 26 - 26
Source/Engine/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -170,7 +170,7 @@ static unsigned depthStencilFormat = D3DFMT_D24S8;
 Graphics::Graphics(Context* context) :
     Object(context),
     impl_(new GraphicsImpl()),
-	windowIcon_(0),
+    windowIcon_(0),
     externalWindow_(0),
     width_(0),
     height_(0),
@@ -270,11 +270,11 @@ void Graphics::SetWindowTitle(const String& windowTitle)
 
 void Graphics::SetWindowIcon(Image* windowIcon)
 {
-	windowIcon_ = windowIcon;
-	if (impl_->window_)
-	{
-		CreateWindowIcon();
-	}
+    windowIcon_ = windowIcon;
+    if (impl_->window_)
+    {
+        CreateWindowIcon();
+    }
 }
 
 void Graphics::SetWindowPosition(const IntVector2& position)
@@ -2212,32 +2212,32 @@ bool Graphics::OpenWindow(int width, int height, bool resizable)
         return false;
     }
 
-	CreateWindowIcon();
+    CreateWindowIcon();
 
     return true;
 }
 
 void Graphics::CreateWindowIcon()
 {
-	if (windowIcon_)
-	{
-		SDL_Surface*  surface = SDL_CreateRGBSurface(0, windowIcon_->GetWidth(), windowIcon_->GetHeight(), windowIcon_->GetComponents() * BITS_PER_COMPONENT, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
-
-		if (windowIcon_->GetMemoryUse() > 0)
-		{
-			SDL_LockSurface(surface);
-			memcpy(surface->pixels, windowIcon_->GetData(), windowIcon_->GetMemoryUse());
-			SDL_UnlockSurface(surface);
-
-			SDL_SetWindowIcon(impl_->window_, surface);
-		}
-
-		SDL_FreeSurface(surface);
-	}
-	else
-	{
-		LOGERROR("Unable to load icon windowIcon_ " + windowIcon_->GetName());
-	}
+    if (windowIcon_)
+    {
+        SDL_Surface*  surface = SDL_CreateRGBSurface(0, windowIcon_->GetWidth(), windowIcon_->GetHeight(), windowIcon_->GetComponents() * BITS_PER_COMPONENT, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
+
+        if (windowIcon_->GetMemoryUse() > 0)
+        {
+            SDL_LockSurface(surface);
+            memcpy(surface->pixels, windowIcon_->GetData(), windowIcon_->GetMemoryUse());
+            SDL_UnlockSurface(surface);
+
+            SDL_SetWindowIcon(impl_->window_, surface);
+        }
+
+        SDL_FreeSurface(surface);
+    }
+    else
+    {
+        LOGERROR("Unable to load icon windowIcon_ " + windowIcon_->GetName());
+    }
 }
 
 void Graphics::AdjustWindow(int& newWidth, int& newHeight, bool& newFullscreen)

+ 6 - 6
Source/Engine/Graphics/Direct3D9/D3D9Graphics.h

@@ -83,8 +83,8 @@ public:
     void SetExternalWindow(void* window);
     /// Set window title.
     void SetWindowTitle(const String& windowTitle);
-	/// Set window icon.
-	void SetWindowIcon(Image* windowIcon);
+    /// Set window icon.
+    void SetWindowIcon(Image* windowIcon);
     /// Set window position.
     void SetWindowPosition(const IntVector2& position);
     /// Set window position.
@@ -394,8 +394,8 @@ public:
 private:
     /// Create the application window.
     bool OpenWindow(int width, int height, bool resizable);
-	/// Create the application window icon.
-	void CreateWindowIcon();
+    /// Create the application window icon.
+    void CreateWindowIcon();
     /// Adjust the window for new resolution and fullscreen mode.
     void AdjustWindow(int& newWidth, int& newHeight, bool& newFullscreen);
     /// Create the Direct3D interface.
@@ -419,8 +419,8 @@ private:
     GraphicsImpl* impl_;
     /// Window title.
     String windowTitle_;
-	/// Window Icon File Name
-	Image* windowIcon_;
+    /// Window Icon File Name
+    Image* windowIcon_;
     /// External window, null if not in use (default.)
     void* externalWindow_;
     /// Window width.

+ 26 - 26
Source/Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -150,7 +150,7 @@ bool CheckExtension(String& extensions, const String& name)
 Graphics::Graphics(Context* context_) :
     Object(context_),
     impl_(new GraphicsImpl()),
-	windowIcon_(0),
+    windowIcon_(0),
     externalWindow_(0),
     width_(0),
     height_(0),
@@ -215,11 +215,11 @@ void Graphics::SetWindowTitle(const String& windowTitle)
 
 void Graphics::SetWindowIcon(Image* windowIcon)
 {
-	windowIcon_ = windowIcon;
-	if (impl_->window_)
-	{
-		CreateWindowIcon();
-	}
+    windowIcon_ = windowIcon;
+    if (impl_->window_)
+    {
+        CreateWindowIcon();
+    }
 }
 
 void Graphics::SetWindowPosition(const IntVector2& position)
@@ -367,7 +367,7 @@ bool Graphics::SetMode(int width, int height, bool fullscreen, bool resizable, b
             }
         }
 
-		CreateWindowIcon();
+        CreateWindowIcon();
         
         // Create/restore context and GPU objects and set initial renderstate
         Restore();
@@ -2400,25 +2400,25 @@ unsigned Graphics::GetFormat(const String& formatName)
 
 void Graphics::CreateWindowIcon()
 {
-	if (windowIcon_)
-	{
-		SDL_Surface*  surface = SDL_CreateRGBSurface(0, windowIcon_->GetWidth(), windowIcon_->GetHeight(), windowIcon_->GetComponents() * BITS_PER_COMPONENT, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
-
-		if (windowIcon_->GetMemoryUse() > 0)
-		{
-			SDL_LockSurface(surface);
-			memcpy(surface->pixels, windowIcon_->GetData(), windowIcon_->GetMemoryUse());
-			SDL_UnlockSurface(surface);
-
-			SDL_SetWindowIcon(impl_->window_, surface);
-		}
-
-		SDL_FreeSurface(surface);
-	}
-	else
-	{
-		LOGERROR("Unable to load icon windowIcon_ " + windowIcon_->GetName());
-	}
+    if (windowIcon_)
+    {
+        SDL_Surface*  surface = SDL_CreateRGBSurface(0, windowIcon_->GetWidth(), windowIcon_->GetHeight(), windowIcon_->GetComponents() * BITS_PER_COMPONENT, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000);
+
+        if (windowIcon_->GetMemoryUse() > 0)
+        {
+            SDL_LockSurface(surface);
+            memcpy(surface->pixels, windowIcon_->GetData(), windowIcon_->GetMemoryUse());
+            SDL_UnlockSurface(surface);
+
+            SDL_SetWindowIcon(impl_->window_, surface);
+        }
+
+        SDL_FreeSurface(surface);
+    }
+    else
+    {
+        LOGERROR("Unable to load icon windowIcon_ " + windowIcon_->GetName());
+    }
 }
 
 void Graphics::CheckFeatureSupport(String& extensions)

+ 6 - 6
Source/Engine/Graphics/OpenGL/OGLGraphics.h

@@ -88,8 +88,8 @@ public:
     void SetExternalWindow(void* window);
     /// Set window icon.
     void SetWindowIcon(Image* windowIcon);
-	/// Set window title.
-	void SetWindowTitle(const String& windowTitle);
+    /// Set window title.
+    void SetWindowTitle(const String& windowTitle);
     /// Set window position.
     void SetWindowPosition(const IntVector2& position);
     /// Set window position.
@@ -413,8 +413,8 @@ public:
     static unsigned GetFormat(const String& formatName);
     
 private:
-	/// Create the application window icon.
-	void CreateWindowIcon();
+    /// Create the application window icon.
+    void CreateWindowIcon();
     /// Check supported rendering features.
     void CheckFeatureSupport(String& extensions);
     /// Select FBO and commit changes.
@@ -432,8 +432,8 @@ private:
     GraphicsImpl* impl_;
     /// Window title.
     String windowTitle_;
-	/// Window Icon File Name
-	Image* windowIcon_;
+    /// Window Icon File Name
+    Image* windowIcon_;
     /// External window, null if not in use (default.)
     void* externalWindow_;
     /// Window width.

+ 1 - 1
Source/Engine/IO/FileSystem.cpp

@@ -401,7 +401,7 @@ bool FileSystem::DirExists(const String& pathName) const
     #ifndef WIN32
     // Always return true for the root directory
     if (pathName == "/")
-	return true;
+        return true;
     #endif
 
     String fixedName = GetNativePath(RemoveTrailingSlash(pathName));

+ 1 - 1
Source/Engine/Physics/RigidBody.cpp

@@ -645,7 +645,7 @@ float RigidBody::GetFriction() const
 
 Vector3 RigidBody::GetAnisotropicFriction() const
 {
-	return body_ ? ToVector3(body_->getAnisotropicFriction()) : Vector3::ZERO;
+    return body_ ? ToVector3(body_->getAnisotropicFriction()) : Vector3::ZERO;
 }
 
 float RigidBody::GetRollingFriction() const

+ 9 - 9
Source/Engine/Resource/XMLElement.cpp

@@ -224,16 +224,16 @@ XPathResultSet XMLElement::SelectPrepared(const XPathQuery& query) const
 
 bool XMLElement::SetValue(const String& value)
 {
-	return SetValue(value.CString());
+    return SetValue(value.CString());
 }
 
 bool XMLElement::SetValue(const char* value)
 {
-	if (!file_ || (!node_ && !xpathNode_))
-		return false;
+    if (!file_ || (!node_ && !xpathNode_))
+        return false;
 
-	pugi::xml_node& node = xpathNode_ ? xpathNode_->node() : pugi::xml_node(node_);
-	return node.append_child(pugi::node_pcdata).set_value(value);
+    pugi::xml_node& node = xpathNode_ ? xpathNode_->node() : pugi::xml_node(node_);
+    return node.append_child(pugi::node_pcdata).set_value(value);
 }
 
 bool XMLElement::SetAttribute(const String& name, const String& value)
@@ -579,11 +579,11 @@ bool XMLElement::HasAttribute(const char* name) const
 
 String XMLElement::GetValue() const
 {
-	if (!file_ || (!node_ && !xpathNode_))
-		return String::EMPTY;
+    if (!file_ || (!node_ && !xpathNode_))
+        return String::EMPTY;
 
-	const pugi::xml_node& node = xpathNode_ ? xpathNode_->node() : pugi::xml_node(node_);
-	return String(node.child_value());
+    const pugi::xml_node& node = xpathNode_ ? xpathNode_->node() : pugi::xml_node(node_);
+    return String(node.child_value());
 }
 
 String XMLElement::GetAttribute(const String& name) const

+ 8 - 8
Source/Engine/Resource/XMLElement.h

@@ -88,11 +88,11 @@ public:
     /// Select elements/attributes using XPath query.
     XPathResultSet SelectPrepared(const XPathQuery& query) const;
 
-	/// Set the value for an inner node in the following format <node>value</node>.
-	bool SetValue(const String& value);
-	/// Set the value for an inner node in the following format
-	/// <node>value</node>. Must be used on the <node> element.
-	bool SetValue(const char* value);
+    /// Set the value for an inner node in the following format <node>value</node>.
+    bool SetValue(const String& value);
+    /// Set the value for an inner node in the following format
+    /// <node>value</node>. Must be used on the <node> element.
+    bool SetValue(const char* value);
     /// Set an attribute.
     bool SetAttribute(const String& name, const String& value);
     /// Set an attribute.
@@ -176,9 +176,9 @@ public:
     bool HasAttribute(const String& name) const;
     /// Return whether has an attribute.
     bool HasAttribute(const char* name) const;
-	/// Return inner value, or empty if missing for nodes like <node>value</node>
-	String GetValue() const;
-	/// Return attribute, or empty if missing.
+    /// Return inner value, or empty if missing for nodes like <node>value</node>
+    String GetValue() const;
+    /// Return attribute, or empty if missing.
     String GetAttribute(const String& name = String::EMPTY) const;
     /// Return attribute, or empty if missing.
     String GetAttribute(const char* name) const;

+ 1 - 1
Source/Engine/Script/GraphicsAPI.cpp

@@ -1195,7 +1195,7 @@ static void RegisterGraphics(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Graphics", "bool TakeScreenShot(Image@+)", asMETHOD(Graphics, TakeScreenShot), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "void set_windowTitle(const String&in)", asMETHOD(Graphics, SetWindowTitle), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "const String& get_windowTitle() const", asMETHOD(Graphics, GetWindowTitle), asCALL_THISCALL);
-	engine->RegisterObjectMethod("Graphics", "void set_windowIcon(Image@+)", asMETHOD(Graphics, SetWindowIcon), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Graphics", "void set_windowIcon(Image@+)", asMETHOD(Graphics, SetWindowIcon), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "void set_windowPosition(const IntVector2&in)", asMETHODPR(Graphics, SetWindowPosition, (const IntVector2&), void), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "IntVector2 get_windowPosition() const", asMETHOD(Graphics, GetWindowPosition), asCALL_THISCALL);
     engine->RegisterObjectMethod("Graphics", "void set_sRGB(bool)", asMETHOD(Graphics, SetSRGB), asCALL_THISCALL);

+ 2 - 2
Source/Engine/Script/ResourceAPI.cpp

@@ -225,7 +225,7 @@ static void RegisterXMLElement(asIScriptEngine* engine)
     engine->RegisterObjectMethod("XMLElement", "XMLElement SelectSinglePrepared(const XPathQuery&in)", asMETHOD(XMLElement, SelectSinglePrepared), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "XPathResultSet Select(const String&in)", asMETHOD(XMLElement, Select), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "XPathResultSet SelectPrepared(const XPathQuery&in)", asMETHOD(XMLElement, SelectPrepared), asCALL_THISCALL);
-	engine->RegisterObjectMethod("XMLElement", "bool SetValue(const String&in)", asMETHODPR(XMLElement, SetValue, (const String&), bool), asCALL_THISCALL);
+    engine->RegisterObjectMethod("XMLElement", "bool SetValue(const String&in)", asMETHODPR(XMLElement, SetValue, (const String&), bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "bool SetAttribute(const String&in, const String&in)", asMETHODPR(XMLElement, SetAttribute, (const String&, const String&), bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "bool SetAttribute(const String&in)", asMETHODPR(XMLElement, SetAttribute, (const String&), bool), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "bool SetBool(const String&in, bool)", asMETHOD(XMLElement, SetBool), asCALL_THISCALL);
@@ -245,7 +245,7 @@ static void RegisterXMLElement(asIScriptEngine* engine)
     engine->RegisterObjectMethod("XMLElement", "bool SetVector4(const String&in, const Vector4&in)", asMETHOD(XMLElement, SetVector4), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "bool SetVectorVariant(const String&in, const Variant&in)", asMETHOD(XMLElement, SetVectorVariant), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "bool HasAttribute(const String&in) const", asMETHODPR(XMLElement, HasAttribute, (const String&) const, bool), asCALL_THISCALL);
-	engine->RegisterObjectMethod("XMLElement", "String GetValue() const", asMETHOD(XMLElement, GetValue), asCALL_THISCALL);
+    engine->RegisterObjectMethod("XMLElement", "String GetValue() const", asMETHOD(XMLElement, GetValue), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "String GetAttribute(const String&in arg0 = String()) const", asMETHODPR(XMLElement, GetAttribute, (const String&) const, String), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "String GetAttributeLower(const String&in) const", asMETHODPR(XMLElement, GetAttributeLower, (const String&) const, String), asCALL_THISCALL);
     engine->RegisterObjectMethod("XMLElement", "String GetAttributeUpper(const String&in) const", asMETHODPR(XMLElement, GetAttributeUpper, (const String&) const, String), asCALL_THISCALL);