class Bullet {
int32 x, y, z; // Location
int32 vx, vy, vz; // Speed
int32 damage;
}
[Bullet(x=133,y=415,z=0,damage=6)]
[Bullet(x=13,y=158,z=20,damage=3)]
[Bullet(x=0,y=0,z=0,vx=33,vy=16,damage=12)]
[Bullet(vx=0,vy=0,vz=100)]
class Bullet {
int32 x, y, z; // Location
int32 vx, vy, vz; // Speed
int32 damage;
}
[Bullet(x=133,y=415,z=0,damage=6)]
[Bullet(x=13,y=158,z=20,damage=3)]
[Bullet(x=0,y=0,z=0,vx=33,vy=16,damage=12)]
[Bullet(vx=0,vy=0,vz=100)]
Quote:
In your to-do list I found this line: "TypeId and asIObjectType should be removed. asITypeInfo should be introduced instead". How is this modification going to affect the type handling (i.e. will all typeID's and asIObjectType's simply be replaced with asITypeInfo)? Will primitive types fit in here as well?
Quote:
The asIObjectType and asIScriptObject interfaces have a number of functions with a common name (GetPropertyCount, GetPropertyTypeId, GetPropertyName). These are identical, right? And GetAddressOfProperty and GetPropertyOffset are related like: GetAddressOfProperty(...) == CreateScriptObject(...) + GetPropertyOffset(...) yes?
Quote:
A bit offtopic though. Do you have any plans to add support for CMake for easier project files generation?
Quote:Original post by WitchLord
SiCrane is correct. CreateScriptObject can be used to create both script class instances and instances of application registered types, which is why it returns a void pointer.
Quote:Original post by WitchLord
If the type is a script class instance you can statically cast the pointer to asIScriptClass* or asIScriptClass** depending on the bit asTYPEID_OBJHANDLE.
Quote:Original post by WitchLord
Yes, primitive types will fit in here as well. The idea is to unify the way the types are identified. I'm not sure if I'll actually do this change though, as it may not bring much benefit. I still need to investigate that.
Quote:Original post by Bismuth
asIScriptClass? I've never heard of that one before. Did you mean asIScriptObject?
Quote:Original post by Bismuth
By the looks of your ToDo list, I had this sensation that you *wanted* to get rid of both Id's (FuncID and TypeID), having asIScriptFunction in favor of FuncId and asITypeInfo in favor of TypeId + asIObjectType. Although I partially agree that removing the Id's will make the interface a bit cleaner, I'll let you be the judge and decide whether this is necessary. I'll just settle down with the Id's for now.
Quote:Original post by Bismuth
I don't think Angelscript supports this, but I had this idea about dynamic class loading.
Suppose the engine loads some scripts that define a number of different classes. Next, the module is built and some of these classes are put to use, as the scripting engine creates a few instances of each class (they are Addref()'ed and become persistent). Finally, the script engine notices that one object just called a registered function, which is supposed to spawn a new persistent instance of a particular class on the stage. The problem is that the referenced class definition is missing because it has not been loaded. Is there a way to dynamically load this class into the engine without having to rebuild the whole script module or damage any of the existing class instances?
cmake_minimum_required(VERSION 2.6)set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)cmake_policy(SET CMP0003 NEW)project(Angelscript)set(ANGELSCRIPT_SOURCE source/as_arrayobject.cpp source/as_atomic.cpp source/as_builder.cpp source/as_bytecode.cpp source/as_callfunc.cpp source/as_callfunc_mips.cpp source/as_callfunc_sh4.cpp source/as_callfunc_x86.cpp source/as_compiler.cpp source/as_configgroup.cpp source/as_context.cpp source/as_datatype.cpp source/as_gc.cpp source/as_generic.cpp source/as_globalproperty.cpp source/as_memory.cpp source/as_module.cpp source/as_objecttype.cpp source/as_outputbuffer.cpp source/as_parser.cpp source/as_restore.cpp source/as_scriptcode.cpp source/as_scriptengine.cpp source/as_scriptfunction.cpp source/as_scriptnode.cpp source/as_scriptobject.cpp source/as_string.cpp source/as_string_util.cpp source/as_thread.cpp source/as_tokenizer.cpp source/as_typeinfo.cpp source/as_variablescope.cpp)set(ANGELSCRIPT_HEADERS include/angelscript.h source/as_array.h source/as_arrayobject.h source/as_builder.h source/as_bytecode.h source/as_bytecode.h source/as_callfunc.h source/as_compiler.h source/as_config.h source/as_configgroup.h source/as_context.h source/as_datatype.h source/as_debug.h source/as_generic.h source/as_map.h source/as_memory.h source/as_module.h source/as_objecttype.h source/as_outputbuffer.h source/as_parser.h source/as_property.h source/as_restore.h source/as_scriptcode.h source/as_scriptengine.h source/as_scriptfunction.h source/as_scriptnode.h source/as_scriptobject.h source/as_string.h source/as_string_util.h source/as_texts.h source/as_thread.h source/as_tokendef.h source/as_tokenizer.h source/as_typeinfo.h source/as_variablescope.h)set(ANGELSCRIPT_ADDON_HEADERS add_on/scriptany/scriptany.h add_on/scriptdictionary/scriptdictionary.h add_on/scriptmath/scriptmath.h add_on/scriptmath3d/scriptmath3d.h add_on/scriptstring/scriptstring.h add_on/scriptstdstring/scriptstdstring.h add_on/scriptbuilder/scriptbuilder.h add_on/vector3/as_ScriptOgreVector3.h add_on/quaternion/as_ScriptOgreQuaternion.h)set(ANGELSCRIPT_ADDON_SOURCE add_on/scriptany/scriptany.cpp add_on/scriptdictionary/scriptdictionary.cpp add_on/scriptmath/scriptmath.cpp add_on/scriptmath3d/scriptmath3d.cpp add_on/scriptstring/scriptstring.cpp add_on/scriptstring/scriptstring_utils.cpp add_on/scriptstdstring/scriptstdstring.cpp add_on/scriptbuilder/scriptbuilder.cpp add_on/vector3/as_ScriptOgreVector3.cpp add_on/quaternion/as_ScriptOgreQuaternion.cpp)include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/add_on/scriptdictionary ${CMAKE_CURRENT_SOURCE_DIR}/add_on/scriptmath ${CMAKE_CURRENT_SOURCE_DIR}/add_on/scriptmath3d ${CMAKE_CURRENT_SOURCE_DIR}/add_on/scriptstring ${CMAKE_CURRENT_SOURCE_DIR}/add_on/scriptstdstring)add_definitions("-D_CRT_SECURE_NO_WARNINGS -DANGELSCRIPT_EXPORT -D_LIB")# Fix x64 issues on Linuxif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE) add_definitions(-fPIC)endif()add_library(Angelscript STATIC ${ANGELSCRIPT_ADDON_SOURCE} ${ANGELSCRIPT_ADDON_HEADERS} ${ANGELSCRIPT_SOURCE} ${ANGELSCRIPT_HEADERS})SET(LIBRARY_OUTPUT_PATH ../lib)IF(WIN32) SET_TARGET_PROPERTIES(Angelscript PROPERTIES COMPILE_FLAGS "/MP")ENDIF(WIN32)
cmake_minimum_required(VERSION 2.6)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE)
cmake_policy(SET CMP0003 NEW)
project(Angelscript)
set(ANGELSCRIPT_SOURCE
source/as_arrayobject.cpp
source/as_atomic.cpp
source/as_builder.cpp
source/as_bytecode.cpp
source/as_callfunc.cpp
source/as_compiler.cpp
source/as_configgroup.cpp
source/as_context.cpp
source/as_datatype.cpp
source/as_gc.cpp
source/as_generic.cpp
source/as_globalproperty.cpp
source/as_memory.cpp
source/as_module.cpp
source/as_objecttype.cpp
source/as_outputbuffer.cpp
source/as_parser.cpp
source/as_restore.cpp
source/as_scriptcode.cpp
source/as_scriptengine.cpp
source/as_scriptfunction.cpp
source/as_scriptnode.cpp
source/as_scriptobject.cpp
source/as_string.cpp
source/as_string_util.cpp
source/as_thread.cpp
source/as_tokenizer.cpp
source/as_typeinfo.cpp
source/as_variablescope.cpp
)
include(CheckTypeSize)
CHECK_TYPE_SIZE("void*" ANGELSCRIPT_PTR_SIZE BUILTIN_TYPES_ONLY)
if (ANGELSCRIPT_PTR_SIZE EQUAL 8)
set(ANGELSCRIPT_PLATFORM_X64 TRUE)
else ()
set(ANGELSCRIPT_PLATFORM_X64 FALSE)
endif ()
if(ANGELSCRIPT_PLATFORM_X64)
if (WIN32)
list(APPEND ANGELSCRIPT_SOURCE source/as_callfunc_x64_msvc.cpp)
elseif (UNIX)
list(APPEND ANGELSCRIPT_SOURCE src/as_callfunc_x64_gcc.cpp)
endif ()
else()
list(APPEND ANGELSCRIPT_SOURCE source/as_callfunc_x86.cpp)
endif(ANGELSCRIPT_PLATFORM_X64)
set(ANGELSCRIPT_HEADERS
include/angelscript.h
source/as_array.h
source/as_arrayobject.h
source/as_builder.h
source/as_bytecode.h
source/as_bytecode.h
source/as_callfunc.h
source/as_compiler.h
source/as_config.h
source/as_configgroup.h
source/as_context.h
source/as_datatype.h
source/as_debug.h
source/as_generic.h
source/as_map.h
source/as_memory.h
source/as_module.h
source/as_objecttype.h
source/as_outputbuffer.h
source/as_parser.h
source/as_property.h
source/as_restore.h
source/as_scriptcode.h
source/as_scriptengine.h
source/as_scriptfunction.h
source/as_scriptnode.h
source/as_scriptobject.h
source/as_string.h
source/as_string_util.h
source/as_texts.h
source/as_thread.h
source/as_tokendef.h
source/as_tokenizer.h
source/as_typeinfo.h
source/as_variablescope.h
)
set(ANGELSCRIPT_ADDON_HEADERS
add_on/scriptany/scriptany.h
add_on/scriptdictionary/scriptdictionary.h
add_on/scriptmath/scriptmath.h
add_on/scriptmath3d/scriptmath3d.h
add_on/scriptstring/scriptstring.h
add_on/scriptstdstring/scriptstdstring.h
add_on/scriptbuilder/scriptbuilder.h
add_on/vector3/as_ScriptOgreVector3.h
add_on/quaternion/as_ScriptOgreQuaternion.h
)
set(ANGELSCRIPT_ADDON_SOURCE
add_on/scriptany/scriptany.cpp
add_on/scriptdictionary/scriptdictionary.cpp
add_on/scriptmath/scriptmath.cpp
add_on/scriptmath3d/scriptmath3d.cpp
add_on/scriptstring/scriptstring.cpp
add_on/scriptstring/scriptstring_utils.cpp
add_on/scriptstdstring/scriptstdstring.cpp
add_on/scriptbuilder/scriptbuilder.cpp
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/add_on/scriptdictionary
${CMAKE_CURRENT_SOURCE_DIR}/add_on/scriptmath
${CMAKE_CURRENT_SOURCE_DIR}/add_on/scriptmath3d
${CMAKE_CURRENT_SOURCE_DIR}/add_on/scriptstring
${CMAKE_CURRENT_SOURCE_DIR}/add_on/scriptstdstring
)
add_definitions("-D_CRT_SECURE_NO_WARNINGS -DANGELSCRIPT_EXPORT -D_LIB")
# Fix x64 issues on Linux
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE)
add_definitions(-fPIC)
endif()
add_library(Angelscript STATIC ${ANGELSCRIPT_ADDON_SOURCE} ${ANGELSCRIPT_ADDON_HEADERS} ${ANGELSCRIPT_SOURCE} ${ANGELSCRIPT_HEADERS})
set(LIBRARY_OUTPUT_PATH ../lib)
if(WIN32)
set_target_properties(Angelscript PROPERTIES COMPILE_FLAGS "/MP")
endif(WIN32)