Răsfoiți Sursa

Merge pull request #258 from CIB/documentation

Documentation stuff
Ivan Safrin 12 ani în urmă
părinte
comite
6d3bd82faf

+ 7 - 0
Bindings/Scripts/create_lua_library/CMakeLists.txt

@@ -6,12 +6,19 @@ IF(NOT PY_PLY)
 	MESSAGE(SEND_ERROR "The Python PLY (Python Lex-Yacc) module is required to generate Lua bindings.")
 ENDIF(NOT PY_PLY)
 
+FILE(GLOB HEADER_DEPENDENCIES_CORE ../../../Core/Contents/Include/*.h)
+FILE(GLOB HEADER_DEPENDENCIES_2DPHYSICS ../../../Modules/Contents/2DPhysics/Include/*.h)
+FILE(GLOB HEADER_DEPENDENCIES_3DPHYSICS ../../../Modules/Contents/3DPhysics/Include/*.h)
+FILE(GLOB HEADER_DEPENDENCIES_UI ../../../Modules/Contents/UI/Include/*.h)
+
 ADD_CUSTOM_COMMAND(
 OUTPUT luaGenerateCmd
 COMMAND ${PYTHON_EXECUTABLE} create_lua_library.py ../../../Core/Contents/Include Polycode Polycode.h polycore Polycore ../../Contents/LUA/API ../../Contents/LUA/API/Polycode ../../Contents/LUA/Include ../../Contents/LUA/Source
 COMMAND ${PYTHON_EXECUTABLE} create_lua_library.py ../../../Modules/Contents/2DPhysics/Include/ Physics2D Polycode2DPhysics.h physics2d Physics2D ../../../Modules/Bindings/2DPhysics/API ../../../Modules/Bindings/2DPhysics/API/Physics2D ../../../Modules/Bindings/2DPhysics/Include ../../../Modules/Bindings/2DPhysics/Source
 COMMAND ${PYTHON_EXECUTABLE} create_lua_library.py ../../../Modules/Contents/3DPhysics/Include/ Physics3D Polycode3DPhysics.h physics3d Physics3D ../../../Modules/Bindings/3DPhysics/API ../../../Modules/Bindings/3DPhysics/API/Physics3D ../../../Modules/Bindings/3DPhysics/Include ../../../Modules/Bindings/3DPhysics/Source 
 COMMAND ${PYTHON_EXECUTABLE} create_lua_library.py ../../../Modules/Contents/UI/Include/ UI PolycodeUI.h UI UI ../../../Modules/Bindings/UI/API ../../../Modules/Bindings/UI/API/UI ../../../Modules/Bindings/UI/Include ../../../Modules/Bindings/UI/Source
+COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/luaGenerateCmd # Generate the given output file(empty file), to keep track of whether we need to rebuild.
+DEPENDS ${HEADER_DEPENDENCIES_CORE} ${HEADER_DEPENDENCIES_2DPHYSICS} ${HEADER_DEPENDENCIES_3DPHYSICS} ${HEADER_DEPENDENCIES_UI} 
 WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
 )
 

+ 7 - 0
Documentation/CMakeLists.txt

@@ -4,12 +4,19 @@ FIND_PACKAGE(Doxygen)
 
 IF(DOXYGEN_FOUND)
 
+FILE(GLOB HEADER_DEPENDENCIES_CORE ${Polycode_SOURCE_DIR}/Core/Contents/Include/*.h)
+FILE(GLOB HEADER_DEPENDENCIES_2DPHYSICS ${Polycode_SOURCE_DIR}/Modules/Contents/2DPhysics/Include/*.h)
+FILE(GLOB HEADER_DEPENDENCIES_3DPHYSICS ${Polycode_SOURCE_DIR}/Modules/Contents/3DPhysics/Include/*.h)
+FILE(GLOB HEADER_DEPENDENCIES_UI ${Polycode_SOURCE_DIR}/Modules/Contents/UI/Include/*.h)
+
 ADD_CUSTOM_COMMAND(
 OUTPUT doc_cmd
 COMMAND ${DOXYGEN_EXECUTABLE} ${Polycode_SOURCE_DIR}/Documentation/Doxygen/Polycode.doxygen
 COMMAND ${DOXYGEN_EXECUTABLE} ${Polycode_SOURCE_DIR}/Documentation/Doxygen/Physics2D.doxygen
 COMMAND ${DOXYGEN_EXECUTABLE} ${Polycode_SOURCE_DIR}/Documentation/Doxygen/Physics3D.doxygen
+COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/doc_cmd # Generate the given output file(empty file), to keep track of whether we need to rebuild.
 WORKING_DIRECTORY ${Polycode_SOURCE_DIR}/Documentation/Doxygen/
+DEPENDS ${HEADER_DEPENDENCIES_CORE} ${HEADER_DEPENDENCIES_2DPHYSICS} ${HEADER_DEPENDENCIES_3DPHYSICS} ${HEADER_DEPENDENCIES_UI}
 COMMENT "Generating Polycode API documentation with Doxygen" VERBATIM
 )
 

+ 1 - 1
Documentation/Doxygen/Physics2D.doxygen

@@ -619,7 +619,7 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories 
 # with spaces.
 
-INPUT                  = ../../Modules/Contents/2DPhysics
+INPUT                  = ../../Modules/Contents/2DPhysics  index.dox
 
 # This tag can be used to specify the character encoding of the source files 
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 

+ 1 - 1
Documentation/Doxygen/Physics3D.doxygen

@@ -619,7 +619,7 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories 
 # with spaces.
 
-INPUT                  = ../../Modules/Contents/3DPhysics
+INPUT                  = ../../Modules/Contents/3DPhysics index.dox
 
 # This tag can be used to specify the character encoding of the source files 
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 

+ 1 - 1
Documentation/Doxygen/Polycode.doxygen

@@ -619,7 +619,7 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories 
 # with spaces.
 
-INPUT                  = ../../Core/Contents
+INPUT                  = ../../Core/Contents index.dox
 
 # This tag can be used to specify the character encoding of the source files 
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 

+ 1 - 1
Documentation/Doxygen/Polycode_ui.doxygen

@@ -619,7 +619,7 @@ WARN_LOGFILE           =
 # directories like "/usr/src/myproject". Separate the files or directories 
 # with spaces.
 
-INPUT                  = ../../Modules/Contents/UI
+INPUT                  = ../../Modules/Contents/UI index.dox
 
 # This tag can be used to specify the character encoding of the source files 
 # that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is 

+ 12 - 0
Documentation/Doxygen/index.dox

@@ -0,0 +1,12 @@
+// This file defines the index page for the doxygen documentation generated.
+
+/**
+\mainpage Polycode
+
+\section Modules
+<a href="../../Polycode/html/index.html">Core</a> <br>
+<a href="../../PolycodeUI/html/index.html">UI Module</a> <br> 
+<a href="../../Physics2D/html/index.html">Physics2D</a> <br>
+<a href="../../Physics3D/html/index.html">Physics3D</a> <br>
+
+*/

+ 4 - 0
Documentation/Lua/scripts/CMakeLists.txt

@@ -2,9 +2,13 @@ INCLUDE(FindPythonModule)
 
 FIND_PACKAGE(PythonInterp REQUIRED)
 
+FILE(GLOB XML_DEPENDENCIES ${CMAKE_CURRENT_SOURCE_DIR}/../xml/*.xml)
+
 ADD_CUSTOM_COMMAND(
 OUTPUT luaGenerateDocsCmd
 COMMAND ${PYTHON_EXECUTABLE} make_html.py
+COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/luaGenerateDocsCmd # Generate the given output file(empty file), to keep track of whether we need to rebuild.
+DEPENDS ${XML_DEPENDENCIES}
 WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
 )
 

+ 76 - 24
Modules/Contents/UI/Include/PolyUIScrollContainer.h

@@ -1,16 +1,16 @@
 /*
  Copyright (C) 2012 by Ivan Safrin
- 
+
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:
- 
+
  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.
- 
+
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -27,45 +27,97 @@
 #include "PolyUIElement.h"
 
 namespace Polycode {
-	
+
+	/**
+	 * A container for UI elements that adds scroll bars if necessary.
+	 *
+	 * Internally, this class simply moves the scrolled child, and uses scissorBox
+	 * to cut off the parts going over the edges.
+	 */
 	class _PolyExport UIScrollContainer : public UIElement {
 	public:
+        /**
+        * Create a scroll container.
+        * @param scrolledEntity The ScreenEntity that should be scrolled using this element.
+        * @param hScroll Whether the child should be scrolled horizontally.
+        * @param vScroll Whether the child should be scrolled vertically.
+        * @param width The width of the scroll container.
+        * @param height The height of the scroll container.
+        */
 		UIScrollContainer(ScreenEntity *scrolledEntity, bool hScroll, bool vScroll, Number width, Number height);
 		~UIScrollContainer();
-		
+
+        /**
+        * Update what size the content child is expected to have.
+        *
+        * This doesn't do anything to the child, it just updates scroll bar
+        * positions etc.
+        *
+        * @param newContentWidth Width of the content.
+        * @param newContentHeight Height of the content.
+        */
 		void setContentSize(Number newContentWidth, Number newContentHeight);
-		
-		void Resize(Number width, Number height);		
-		
+
+		void Resize(Number width, Number height);
+
+        /**
+        * Set how far the content child should be scrolled.
+        *
+        * @param xScroll New horizontal scroll position.
+        * @param yScroll New vertical scroll position.
+        */
 		void setScrollValue(Number xScroll, Number yScroll);
+
+        /**
+        * Set how far the content child should be scrolled.
+        *
+        * @param amount New vertical scroll position.
+        */
 		void scrollVertical(Number amount);
+
+        /**
+        * Set how far the content child should be scrolled.
+        *
+        * @param amount New horizontal scroll position.
+        */
 		void scrollHorizontal(Number amount);
-				
+
 		void Update();
-		
+
+        /** Get the assumed size of the content.
+        *
+        * Note that this doesn't actually look at the contained
+        * element, but rather just returns what was earlier set
+        * by setContentSize()
+        *
+        * @return The currently assumed size of the content.
+        */
 		Vector2 getContentSize();
-		
+
 		void onMouseWheelDown(Number x, Number y);
-		void onMouseWheelUp(Number x, Number y);	
-				
+		void onMouseWheelUp(Number x, Number y);
+
 		void handleEvent(Event *event);
-		
+
+        /**
+        * Get the width of the vertical scroll bar.
+        */
 		Number getVScrollWidth();
-		
-	private:		
-		
+
+	private:
+
 		Number defaultScrollSize;
-		
+
 		Number contentWidth;
 		Number contentHeight;
-		
-		ScreenEntity *scrollChild;		
-		
+
+		ScreenEntity *scrollChild;
+
 		bool hasHScroll;
 		bool hasVScroll;
-		
+
 		UIVScrollBar *vScrollBar;
 		UIHScrollBar *hScrollBar;
 	};
-	
-}
+
+}