* Geometry reflection 4.x-dev

Tue, 22 Dec 2020 21:45:51 +0200

author
cemkalyoncu
date
Tue, 22 Dec 2020 21:45:51 +0200
branch
4.x-dev
changeset 1525
ab43d641c7c4
parent 1524
22b7b47127d4
child 1526
591c159018bc

* Geometry reflection
* A small fix in compile script for windows

Source/Gorgon/Geometry.h file | annotate | diff | comparison | revisions
Source/Gorgon/Geometry/Scripting.cpp file | annotate | diff | comparison | revisions
Source/Gorgon/Geometry/dir.cmake file | annotate | diff | comparison | revisions
Source/Gorgon/OS/dir.cmake file | annotate | diff | comparison | revisions
Source/Gorgon/Scripting/Reflection.h file | annotate | diff | comparison | revisions
Source/Gorgon/Widgets/Checkbox.h file | annotate | diff | comparison | revisions
Testing/Source/Manual/Gscript.cpp file | annotate | diff | comparison | revisions
Testing/Source/Manual/UI_Generate.cpp file | annotate | diff | comparison | revisions
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Source/Gorgon/Geometry.h	Tue Dec 22 21:45:51 2020 +0200
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "Scripting/Reflection.h"
+
+namespace Gorgon { namespace Geometry {
+
+    extern Scripting::Library LibGeometry;
+    
+    namespace Types {
+#define DEFTYPE(name) \
+        inline const Scripting::Type &name() { \
+            static const Scripting::Type *type = LibGeometry.GetType(#name); \
+            return *type; \
+        }
+
+        DEFTYPE(Point)
+        
+#undef DEFTYPE
+    }
+    
+    void InitializeScripting();
+    
+} }
--- a/Source/Gorgon/Geometry/Scripting.cpp	Mon Dec 21 14:58:25 2020 +0200
+++ b/Source/Gorgon/Geometry/Scripting.cpp	Tue Dec 22 21:45:51 2020 +0200
@@ -10,7 +10,7 @@
 	Scripting::Library LibGeometry("Geometry",
 								   "Data types under geometry module and their member functions and operators");
 
-	void init_scripting() { 
+    void InitializeScripting() { 
 		if(LibGeometry.Members.GetCount()) return;
 
 		auto point = new Scripting::MappedValueType<Point>(
--- a/Source/Gorgon/Geometry/dir.cmake	Mon Dec 21 14:58:25 2020 +0200
+++ b/Source/Gorgon/Geometry/dir.cmake	Tue Dec 22 21:45:51 2020 +0200
@@ -1,4 +1,6 @@
 SET(Local
+	../Geometry.h
+	
 	Bounds.h
 	Margin.h
 	Line.h
--- a/Source/Gorgon/OS/dir.cmake	Mon Dec 21 14:58:25 2020 +0200
+++ b/Source/Gorgon/OS/dir.cmake	Tue Dec 22 21:45:51 2020 +0200
@@ -7,10 +7,8 @@
 		Win32.cpp
 	)
 	
-	FIND_LIBRARY(Secur32.lib REQUIRED)
 	LIST(APPEND Libs Secur32)
 	
-	FIND_LIBRARY(Netapi32.lib REQUIRED)
 	LIST(APPEND Libs Netapi32)
 ELSE()
 	LIST(APPEND Local
--- a/Source/Gorgon/Scripting/Reflection.h	Mon Dec 21 14:58:25 2020 +0200
+++ b/Source/Gorgon/Scripting/Reflection.h	Tue Dec 22 21:45:51 2020 +0200
@@ -1077,7 +1077,7 @@
 			}
 			
 			virtual MemberType GetMemberType() const override {
-				return StaticMember::DataMember;
+				return StaticMember::Namespace;
 			}
 			
 			virtual Data Get() const override {
--- a/Source/Gorgon/Widgets/Checkbox.h	Mon Dec 21 14:58:25 2020 +0200
+++ b/Source/Gorgon/Widgets/Checkbox.h	Tue Dec 22 21:45:51 2020 +0200
@@ -102,8 +102,6 @@
         Checkbox(const UI::Template &temp, const char *text, bool state) : Checkbox(temp, std::string(text), state) { }
         
         Checkbox &operator =(bool value) { SetState(value); return *this; }
-        
-        operator bool() { return GetState(); }
 
         virtual ~Checkbox();
 
--- a/Testing/Source/Manual/Gscript.cpp	Mon Dec 21 14:58:25 2020 +0200
+++ b/Testing/Source/Manual/Gscript.cpp	Tue Dec 22 21:45:51 2020 +0200
@@ -9,6 +9,7 @@
 #include <Gorgon/Filesystem.h>
 #include <Gorgon/Enum.h>
 #include <Gorgon/Time.h>
+#include <Gorgon/Geometry.h>
 
 using namespace Gorgon::Scripting;
 
@@ -52,11 +53,6 @@
 	return out;
 }
 
-namespace Gorgon { namespace Geometry {
-	extern Scripting::Library LibGeometry;
-	void init_scripting();
-	
-} }
 
 void test() {
 	std::string scriptdir="../Source/Unit/Scripts";
@@ -178,7 +174,7 @@
 
 int main() {
 	VirtualMachine vm;
-	Gorgon::Geometry::init_scripting();
+	Gorgon::Geometry::InitializeScripting();
 	vm.AddLibrary(Gorgon::Geometry::LibGeometry);
 	vm.SetSpecialIdentifierHandler(SpecHandler);
     
--- a/Testing/Source/Manual/UI_Generate.cpp	Mon Dec 21 14:58:25 2020 +0200
+++ b/Testing/Source/Manual/UI_Generate.cpp	Tue Dec 22 21:45:51 2020 +0200
@@ -311,7 +311,7 @@
     btn.Move(0,0);
     Widgets::Checkbox enableclosebtn("Enable close button", true);
     enableclosebtn.SetAutosize(Gorgon::UI::Autosize::Unit, Gorgon::UI::Autosize::Automatic);
-    enableclosebtn.ChangedEvent.Register([&] { wind.SetCloseButtonEnabled(enableclosebtn); });
+    enableclosebtn.ChangedEvent.Register([&] { wind.SetCloseButtonEnabled(bool(enableclosebtn)); });
     wind.Add(enableclosebtn);
     wind.CreateOrganizer<UI::Organizers::List>() 
         << "Try resize"

mercurial