Initial Commit
This commit is contained in:
+232
@@ -0,0 +1,232 @@
|
||||
;----------------------------------------------------------------
|
||||
;-- Vector2
|
||||
;----------------------------------------------------------------
|
||||
Type Vector2
|
||||
Field X#, Y#
|
||||
End Type
|
||||
|
||||
Function Vector2_Create.Vector2(X#, Y#)
|
||||
Local vec.Vector2 = New Vector2
|
||||
vec\X = X
|
||||
vec\Y = Y
|
||||
Return vec
|
||||
End Function
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;-- Vector3
|
||||
;----------------------------------------------------------------
|
||||
Type Vector3
|
||||
Field X#, Y#, Z#
|
||||
End Type
|
||||
|
||||
Function Vector3_Create.Vector3(X#, Y#, Z#)
|
||||
Local vec.Vector3 = New Vector3
|
||||
vec\X = X
|
||||
vec\Y = Y
|
||||
vec\Z = Z
|
||||
Return vec
|
||||
End Function
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;-- SQLite3
|
||||
;----------------------------------------------------------------
|
||||
;[Block] Return Codes / Error Codes
|
||||
; Many SQLite functions return an integer result code from the set shown
|
||||
; here in order to indicate success or failure.
|
||||
;
|
||||
; New error codes may be added in future versions of SQLite.
|
||||
Const SQLITE_OK% = 0 ; Successful result
|
||||
Const SQLITE_ERROR% = 1 ; SQL error or missing database
|
||||
Const SQLITE_INTERNAL% = 2 ; Internal logic error in SQLite
|
||||
Const SQLITE_PERM% = 3 ; Access permission denied
|
||||
Const SQLITE_ABORT% = 4 ; Callback routine requested an abort
|
||||
Const SQLITE_BUSY% = 5 ; The database file is locked
|
||||
Const SQLITE_LOCKED% = 6 ; A table in the database is locked
|
||||
Const SQLITE_NOMEM% = 7 ; A malloc() failed
|
||||
Const SQLITE_READONLY% = 8 ; Attempt to write a readonly database
|
||||
Const SQLITE_INTERRUPT% = 9 ; Operation terminated by SQLite3_Interrupt()
|
||||
Const SQLITE_IOERR% = 10 ; Some kind of disk I/O error occurred
|
||||
Const SQLITE_CORRUPT% = 11 ; The database disk image is malformed
|
||||
Const SQLITE_NOTFOUND% = 12 ; Unknown opcode in sqlite3_file_control()
|
||||
Const SQLITE_FULL% = 13 ; Insertion failed because database is full
|
||||
Const SQLITE_CANTOPEN% = 14 ; Unable to open the database file
|
||||
Const SQLITE_PROTOCOL% = 15 ; Database lock protocol error
|
||||
Const SQLITE_EMPTY% = 16 ; Database is empty
|
||||
Const SQLITE_SCHEMA% = 17 ; The database schema changed
|
||||
Const SQLITE_TOOBIG% = 18 ; String or BLOB exceeds size limit
|
||||
Const SQLITE_CONSTRAINT% = 19 ; Abort due to constraint violation
|
||||
Const SQLITE_MISMATCH% = 20 ; Data type mismatch
|
||||
Const SQLITE_MISUSE% = 21 ; Library used incorrectly
|
||||
Const SQLITE_NOLFS% = 22 ; Uses OS features not supported on host
|
||||
Const SQLITE_AUTH% = 23 ; Authorization denied
|
||||
Const SQLITE_FORMAT% = 24 ; Auxiliary database format error
|
||||
Const SQLITE_RANGE% = 25 ; 2nd parameter to sqlite3_bind out of range
|
||||
Const SQLITE_NOTADB% = 26 ; File opened that is not a database file
|
||||
Const SQLITE_NOTICE% = 27 ; Notifications from sqlite3_log()
|
||||
Const SQLITE_WARNING% = 28 ; Warnings from sqlite3_log()
|
||||
Const SQLITE_ROW% = 100 ; sqlite3_step() has another row ready
|
||||
Const SQLITE_DONE% = 101 ; sqlite3_step() has finished executing
|
||||
;[End Block]
|
||||
|
||||
;[Block] SQLite_Open Flags
|
||||
; These bit values are intended for use in the
|
||||
; 3rd parameter to the [sqlite3_open_v2()] interface.
|
||||
Const SQLITE_OPEN_READONLY% = $00000001
|
||||
Const SQLITE_OPEN_READWRITE% = $00000002
|
||||
Const SQLITE_OPEN_CREATE% = $00000004
|
||||
Const SQLITE_OPEN_URI% = $00000040
|
||||
Const SQLITE_OPEN_MEMORY% = $00000080
|
||||
Const SQLITE_OPEN_NOMUTEX% = $00008000
|
||||
Const SQLITE_OPEN_FULLMUTEX% = $00010000
|
||||
Const SQLITE_OPEN_SHAREDCACHE% = $00020000
|
||||
Const SQLITE_OPEN_PRIVATECACHE% = $00040000
|
||||
;[End Block]
|
||||
|
||||
;[Block] Column Type
|
||||
Const SQLITE_UNKNOWN = 0
|
||||
Const SQLITE_INTEGER = 1
|
||||
Const SQLITE_REAL = 2
|
||||
Const SQLITE_FLOAT = 2
|
||||
Const SQLITE_DOUBLE = 2
|
||||
Const SQLITE_TEXT = 3
|
||||
Const SQLITE_STRING = 3
|
||||
Const SQLITE_BLOB = 4
|
||||
Const SQLITE_NULL = 5
|
||||
;[End Block]
|
||||
|
||||
;[Block] Internal Types
|
||||
Type SQLite_Container
|
||||
Field Pointer%
|
||||
End Type
|
||||
|
||||
Type SQLite_Int64
|
||||
Field Left%, Right%
|
||||
End Type
|
||||
;[End Block]
|
||||
|
||||
Function SQLite_Open%(File$, Flags% = $00000006)
|
||||
; Create a Container to hold the database pointer.
|
||||
Local Container.SQLite_Container = New SQLite_Container
|
||||
Local ErrCode = SQLite3_Open_V2(File, Container, Flags, 0)
|
||||
Local Database = Container\Pointer
|
||||
Delete Container
|
||||
|
||||
If ErrCode = SQLITE_OK
|
||||
Return Database
|
||||
Else
|
||||
Return False
|
||||
EndIf
|
||||
End Function
|
||||
|
||||
Function SQLite_Execute(Database, SQL$)
|
||||
Return SQLite3_Exec(Database, SQL, 0, 0, 0)
|
||||
End Function
|
||||
|
||||
Function SQLite_Prepare(Database, SQL$)
|
||||
Local Container.SQLite_Container = New SQLite_Container
|
||||
Local ErrCode = SQLite3_Prepare(Database, SQL$, -1, Container, 0)
|
||||
Local Statement = Container\Pointer
|
||||
Delete Container
|
||||
|
||||
If ErrCode = SQLITE_OK
|
||||
Return Statement
|
||||
Else
|
||||
Return False
|
||||
EndIf
|
||||
End Function
|
||||
|
||||
Global SQLite_Column_Int64_L%, SQLite_Column_Int64_R%
|
||||
Function SQLite_Column_Int64(Statement, ColumnIndex%)
|
||||
Local Result.SQLite_Int64 = New SQLite_Int64
|
||||
SQLite3_Column_Int64(Statement, ColumnIndex, Result)
|
||||
SQLite_Column_Int64_L = Result\Left
|
||||
SQLite_Column_Int64_R = Result\Right
|
||||
Delete Result
|
||||
End Function
|
||||
|
||||
Function SQLite_Bind_Text(Statement, ColumnIndex%, Value$)
|
||||
Return SQLite3_Bind_Text(Statement, ColumnIndex, Value, -1, -1)
|
||||
End Function
|
||||
|
||||
Function SQLite_Bind_Blob(Statement, ColumnIndex%, Bank)
|
||||
If Bank <> 0 Then
|
||||
Local Size% = BankSize(Bank)
|
||||
Return SQLite3_Bind_Blob(Statement, ColumnIndex, Bank, Size, 0)
|
||||
EndIf
|
||||
End Function
|
||||
|
||||
;----------------------------------------------------------------
|
||||
;-- Helpers
|
||||
;----------------------------------------------------------------
|
||||
Type BlitzUtility_Rectangle
|
||||
Field X,Y,X2,Y2
|
||||
End Type
|
||||
|
||||
Type BlitzUtility_Point
|
||||
Field X,Y
|
||||
End Type
|
||||
|
||||
Global BlitzUtility_Rect.BlitzUtility_Rectangle = New BlitzUtility_Rectangle
|
||||
Global BlitzUtility_Point.BlitzUtility_Point = New BlitzUtility_Point
|
||||
|
||||
Function BlitzUtility_LockPointerToWindow(hwnd=0)
|
||||
If hwnd = 0 Then
|
||||
BlitzUtility_User32_ClipCursorI(0)
|
||||
Else
|
||||
BlitzUtility_User32_GetWindowRect(hwnd, BlitzUtility_Rect)
|
||||
|
||||
;Grab TopLeft
|
||||
BlitzUtility_Point\X = BlitzUtility_Rect\X
|
||||
BlitzUtility_Point\Y = BlitzUtility_Rect\Y
|
||||
BlitzUtility_Rect\X = BlitzUtility_Point\X
|
||||
BlitzUtility_Rect\Y = BlitzUtility_Point\Y
|
||||
|
||||
;Grab BottomRight
|
||||
BlitzUtility_Point\X = BlitzUtility_Rect\X2 - 1
|
||||
BlitzUtility_Point\Y = BlitzUtility_Rect\Y2 - 1
|
||||
BlitzUtility_Rect\X2 = BlitzUtility_Point\X
|
||||
BlitzUtility_Rect\Y2 = BlitzUtility_Point\Y
|
||||
|
||||
BlitzUtility_User32_ClipCursor(BlitzUtility_Rect)
|
||||
EndIf
|
||||
End Function
|
||||
|
||||
Function BlitzUtility_LockPointerToWindowAuto(hwnd=0)
|
||||
If BlitzUtility_User32_GetActiveWindow() = hwnd Then
|
||||
BlitzUtility_LockPointerToWindow(hwnd)
|
||||
Else
|
||||
BlitzUtility_LockPointerToWindow(0)
|
||||
EndIf
|
||||
End Function
|
||||
|
||||
Function BlitzUtility_BorderlessWindowmode(hwnd=0, MonitorId=0, Width=0, Height=0)
|
||||
If hwnd = 0 Then hwnd = SystemProperty("AppHwnd")
|
||||
|
||||
BlitzUtility_EnumerateDisplays()
|
||||
Local dispCnt = BlitzUtility_GetDisplayCount()
|
||||
If MonitorId < 0 Then MonitorId = 0
|
||||
If MonitorId >= dispCnt Then MonitorId = dispCnt - 1
|
||||
|
||||
Local rct.BlitzUtility_Rectangle = New BlitzUtility_Rectangle
|
||||
BlitzUtility_GetDisplay(MonitorId, rct)
|
||||
Local rctW, rctH
|
||||
rctW = (rct\X2 - rct\X)
|
||||
rctH = (rct\Y2 - rct\Y)
|
||||
|
||||
|
||||
rct\X = rct\X + (rctW / 2.0) - Width / 2.0
|
||||
rct\Y = rct\Y + (rctH / 2.0) - Height / 2.0
|
||||
rct\X2 = Width
|
||||
rct\Y2 = Height
|
||||
BlitzUtility_User32_SetWindowLong hwnd, -16, $01000000
|
||||
BlitzUtility_User32_SetWindowPos hwnd, 0, rct\X, rct\Y, rct\X2, rct\Y2, 64
|
||||
Delete rct
|
||||
End Function
|
||||
|
||||
Function FlushFile(File%)
|
||||
Return BlitzUtility_Kernel32_FlushFileBuffers(File)
|
||||
End Function
|
||||
|
||||
;~IDEal Editor Parameters:
|
||||
;~F#20#46#54
|
||||
;~C#Blitz3D
|
||||
@@ -0,0 +1,224 @@
|
||||
.lib "User32.dll"
|
||||
BlitzUtility_User32_ClientToScreen%(hwnd%, point*) : "ClientToScreen"
|
||||
BlitzUtility_User32_ClipCursor%(rect*) : "ClipCursor"
|
||||
BlitzUtility_User32_ClipCursorI%(ptr%) : "ClipCursor"
|
||||
BlitzUtility_User32_GetActiveWindow%() : "GetActiveWindow"
|
||||
BlitzUtility_User32_GetSystemMetrics%(index%) : "GetSystemMetrics"
|
||||
BlitzUtility_User32_SetWindowLong%(hwnd%, nIndex%, dwNewLong%) : "SetWindowLongA"
|
||||
BlitzUtility_User32_GetWindowLong%(hwnd%, index%) : "GetWindowLongA"
|
||||
BlitzUtility_User32_GetWindowRect%(hwnd%, rect*) : "GetWindowRect"
|
||||
BlitzUtility_User32_GetClientRect%(hwnd%, rect*) : "GetClientRect"
|
||||
BlitzUtility_User32_SetWindowPos%(hwnd%, hWndInsertAfter%, x%, y%, cx%, cy%, wFlags%) : "SetWindowPos"
|
||||
|
||||
.lib "Kernel32.dll"
|
||||
BlitzUtility_Kernel32_FlushFileBuffers%(hFile%) : "FlushFileBuffers"
|
||||
|
||||
.lib "BlitzUtility.dll"
|
||||
; Containers - BlitzList
|
||||
BU_BlitzList_New%(obj*) : "BlitzList_New"
|
||||
BU_BlitzList_Activate(list%) : "BlitzList_Activate"
|
||||
BU_BlitzList_Deactivate(list%) : "BlitzList_Deactivate"
|
||||
BU_BlitzList_Destroy(list%) : "BlitzList_Delete"
|
||||
; Containers - BlitzList - Backward Compatability
|
||||
BlitzUtility_List_New%(obj*) : "BlitzList_New"
|
||||
BlitzUtility_List_Activate(list%) : "BlitzList_Activate"
|
||||
BlitzUtility_List_Deactivate(list%) : "BlitzList_Deactivate"
|
||||
BlitzUtility_List_Destroy(list%) : "BlitzList_Delete"
|
||||
|
||||
; Database - SQLite3
|
||||
SQLite3_LibVersion$() : "sqlite3_libversion"
|
||||
; Opening and Closing ------------------------------------------------
|
||||
SQLite3_Open%(Filename$, DatabaseHandle*) : "sqlite3_open"
|
||||
SQLite3_Open_V2%(Filename$, DatabaseHandle*, Flags%, VFS%) : "sqlite3_open_v2"
|
||||
SQLite3_Close%(DatabaseHandle) : "sqlite3_close"
|
||||
; Misc ---------------------------------------------------------------
|
||||
SQLite3_Busy_TimeOut%(DatabaseHandle, TimeOut) : "sqlite3_busy_timeout"
|
||||
SQLite3_Get_AutoCommit%(DatabaseHandle) : "sqlite3_get_autocommit"
|
||||
SQLite3_Interrupt(DatabaseHandle) : "sqlite3_interrupt"
|
||||
; Errors -------------------------------------------------------------
|
||||
SQLite3_ErrCode%(DatabaseHandle) : "sqlite3_errcode"
|
||||
SQLite3_ErrMsg$(DatabaseHandle) : "sqlite3_errmsg"
|
||||
; Executing SQL without results --------------------------------------
|
||||
; As Blitz3D doesn't have function pointers the CallBack is pointless
|
||||
; and this can only really be used for result-less SQL statements.
|
||||
; Also, I've never got the Error return to work. So just pass in
|
||||
; zeros for the last three parameters and use SQLite3_ErrMsg if you
|
||||
; need to get the error message.
|
||||
SQLite3_Exec%(DatabaseHandle, SQL$, CallBack, FirstParam, Error) : "sqlite3_exec"
|
||||
SQLite3_Changes%(DatabaseHandle) : "sqlite3_changes"
|
||||
SQLite3_Total_Changes%(DatabaseHandle) : "sqlite3_total_changes"
|
||||
SQLite3_Last_Insert_RowID%(DatabaseHandle) : "sqlite3_last_insert_rowid"
|
||||
; Executing SQL with results -----------------------------------------
|
||||
; Never got the SQLTail to work so just pass in a zero.
|
||||
SQLite3_Prepare%(DatabaseHandle, SQL$, LengthOfSQL, StatementHandle*, SQLTail) : "sqlite3_prepare"
|
||||
SQLite3_Step%(StatementHandle) : "sqlite3_step"
|
||||
SQLite3_Reset%(StatementHandle) : "sqlite3_reset"
|
||||
SQLite3_Finalize%(StatementHandle) : "sqlite3_finalize"
|
||||
SQLite3_Data_Count%(StatementHandle) : "sqlite3_data_count"
|
||||
SQLite3_DB_Handle%(StatementHandle) : "sqlite3_db_handle"
|
||||
; SQL Parameter Binding ----------------------------------------------
|
||||
SQLite3_Bind_Parameter_Count%(StatementHandle) : "sqlite3_bind_parameter_count"
|
||||
SQLite3_Bind_Parameter_Index%(StatementHandle, ParameterName$) : "sqlite3_bind_parameter_index"
|
||||
SQLite3_Bind_Parameter_Name$(StatementHandle, ParameterIndex) : "sqlite3_bind_parameter_name"
|
||||
; Never tested this for real, but it should work.
|
||||
SQLite3_Transfer_Bindings%(StatementHandle1, StatementHandle2) : "sqlite3_transfer_bindings"
|
||||
SQLite3_Bind_Null%(StatementHandle, Index) : "sqlite3_bind_null"
|
||||
SQLite3_Bind_Int%(StatementHandle, Index, Value) : "sqlite3_bind_int"
|
||||
; If you pass -1 for LengthOfText it will work it out for itself. Pass a zero in for Destructor.
|
||||
SQLite3_Bind_Text%(StatementHandle, Index, Value$, LengthOfText, Destructor) : "sqlite3_bind_text"
|
||||
; Never tried this so it probably won't work. Pass a zero in for Destructor.
|
||||
SQLite3_Bind_Blob%(StatementHandle, Index, Value, LengthOfBlob, Destructor) : "sqlite3_bind_blob"
|
||||
; Doesn't seem to work unfortunately.
|
||||
SQLite3_Bind_Double%(StatementHandle, Index, Value#) : "sqlite3_bind_double"
|
||||
; Helpers
|
||||
SQLite3_Bind_Int64%(StatementHandle, Index, Left, Right) : "sqlite3_bind_int64_ex"
|
||||
SQLite3_Bind_Float%(StatementHandle, Index, Value#) : "sqlite3_bind_float"
|
||||
; Getting values from executed SQL ----------------------------------
|
||||
SQLite3_Column_Count%(StatementHandle) : "sqlite3_column_count"
|
||||
SQLite3_Column_Name$(StatementHandle, ColumnIndex) : "sqlite3_column_name"
|
||||
SQLite3_Column_Type%(StatementHandle, ColumnIndex) : "sqlite3_column_type"
|
||||
SQLite3_Column_DeclType$(StatementHandle, ColumnIndex) : "sqlite3_column_decltype"
|
||||
SQLite3_Column_Int%(StatementHandle, ColumnIndex) : "sqlite3_column_int"
|
||||
SQLite3_Column_Double#(StatementHandle, ColumnIndex) : "sqlite3_column_double"
|
||||
SQLite3_Column_Text$(StatementHandle, ColumnIndex) : "sqlite3_column_text"
|
||||
SQLite3_Column_Bytes%(StatementHandle, ColumnIndex) : "sqlite3_column_bytes"
|
||||
; Never tried this so it probably won't work.
|
||||
SQLite3_Column_Blob%(StatementHandle, ColumnIndex) : "sqlite3_column_blob"
|
||||
; Helpers
|
||||
SQLite3_Column_Int64(StatementHandle, ColumnIndex, outPtr*) : "sqlite3_column_int64_ex"
|
||||
SQLite3_Column_Float#(StatementHandle, ColumnIndex) : "sqlite3_column_float"
|
||||
; Helpers ------------------------------------------------------------
|
||||
SQLite_Version$() : "sqlite3_libversion"
|
||||
SQLite_Close%(DatabaseHandle) : "sqlite3_close"
|
||||
SQLite_SetTimeOut%(DatabaseHandle, TimeOut) : "sqlite3_busy_timeout"
|
||||
SQLite_Get_AutoCommit%(DatabaseHandle) : "sqlite3_get_autocommit"
|
||||
SQLite_Interrupt(DatabaseHandle) : "sqlite3_interrupt"
|
||||
SQLite_ErrCode%(DatabaseHandle) : "sqlite3_errcode"
|
||||
SQLite_ErrMsg$(DatabaseHandle) : "sqlite3_errmsg"
|
||||
SQLite_Changes%(DatabaseHandle) : "sqlite3_changes"
|
||||
SQLite_Total_Changes%(DatabaseHandle) : "sqlite3_total_changes"
|
||||
SQLite_Last_Insert_RowID%(DatabaseHandle) : "sqlite3_last_insert_rowid"
|
||||
SQLite_Step%(StatementHandle) : "sqlite3_step"
|
||||
SQLite_Reset%(StatementHandle) : "sqlite3_reset"
|
||||
SQLite_Finalize%(StatementHandle) : "sqlite3_finalize"
|
||||
SQLite_Data_Count%(StatementHandle) : "sqlite3_data_count"
|
||||
SQLite_DB_Handle%(StatementHandle) : "sqlite3_db_handle"
|
||||
SQLite_Bind_Parameter_Count%(StatementHandle) : "sqlite3_bind_parameter_count"
|
||||
SQLite_Bind_Parameter_Index%(StatementHandle, ParameterName$) : "sqlite3_bind_parameter_index"
|
||||
SQLite_Bind_Parameter_Name$(StatementHandle, ParameterIndex) : "sqlite3_bind_parameter_name"
|
||||
SQLite_Transfer_Bindings%(StatementHandle1, StatementHandle2) : "sqlite3_transfer_bindings"
|
||||
SQLite_Bind_Null%(StatementHandle, Index) : "sqlite3_bind_null"
|
||||
SQLite_Bind_Int%(StatementHandle, Index, Value) : "sqlite3_bind_int"
|
||||
SQLite_Bind_Int64%(StatementHandle, Index, Left, Right) : "sqlite3_bind_int64_ex"
|
||||
;SQLite_Bind_Text%(StatementHandle, Index, Value$, LengthOfText, Destructor) : "sqlite3_bind_text"
|
||||
;SQLite_Bind_Blob%(StatementHandle, Index, Value, LengthOfBlob, Destructor) : "sqlite3_bind_blob"
|
||||
SQLite_Bind_Double%(StatementHandle, Index, Value#) : "sqlite3_bind_double"
|
||||
SQLite_Bind_Float%(StatementHandle, Index, Value#) : "sqlite3_bind_float"
|
||||
SQLite_Column_Count%(StatementHandle) : "sqlite3_column_count"
|
||||
SQLite_Column_Name$(StatementHandle, ColumnIndex) : "sqlite3_column_name"
|
||||
SQLite_Column_Type%(StatementHandle, ColumnIndex) : "sqlite3_column_type"
|
||||
SQLite_Column_DeclType$(StatementHandle, ColumnIndex) : "sqlite3_column_decltype"
|
||||
SQLite_Column_Int%(StatementHandle, ColumnIndex) : "sqlite3_column_int"
|
||||
SQLite_Column_Double#(StatementHandle, ColumnIndex) : "sqlite3_column_double"
|
||||
SQLite_Column_Text$(StatementHandle, ColumnIndex) : "sqlite3_column_text"
|
||||
SQLite_Column_Bytes%(StatementHandle, ColumnIndex) : "sqlite3_column_bytes"
|
||||
SQLite_Column_Blob%(StatementHandle, ColumnIndex) : "sqlite3_column_blob"
|
||||
SQLite_Column_Float#(StatementHandle, ColumnIndex) : "sqlite3_column_float"
|
||||
|
||||
; Math - Vector2
|
||||
Vector2_Set(vector*, value#) : "Vector2_Set"
|
||||
Vector2_SetP(vector*, x#, y#) : "Vector2_SetP"
|
||||
Vector2_SetV(vector*, other*) : "Vector2_SetV"
|
||||
Vector2_Add(vector*, value#) : "Vector2_Add"
|
||||
Vector2_AddP(vector*, x#, y#) : "Vector2_AddP"
|
||||
Vector2_AddV(vector*, other*) : "Vector2_AddV"
|
||||
Vector2_Sub(vector*, value#) : "Vector2_Sub"
|
||||
Vector2_SubP(vector*, x#, y#) : "Vector2_SubP"
|
||||
Vector2_SubV(vector*, other*) : "Vector2_SubV"
|
||||
Vector2_Mul(vector*, value#) : "Vector2_Mul"
|
||||
Vector2_MulP(vector*, x#, y#) : "Vector2_MulP"
|
||||
Vector2_MulV(vector*, other*) : "Vector2_MulV"
|
||||
Vector2_Div(vector*, value#) : "Vector2_Div"
|
||||
Vector2_DivP(vector*, x#, y#) : "Vector2_DivP"
|
||||
Vector2_DivV(vector*, other*) : "Vector2_DivV"
|
||||
Vector2_Length#(vector*) : "Vector2_Length"
|
||||
Vector2_DistanceP#(vector*, x#, y#) : "Vector2_DistanceP"
|
||||
Vector2_DistanceV#(vector*, other*) : "Vector2_DistanceV"
|
||||
Vector2_DotP#(vector*, x#, y#) : "Vector2_DotP"
|
||||
Vector2_DotV#(vector*, other*) : "Vector2_DotV"
|
||||
Vector2_Normalize(vector*) : "Vector2_Normalize"
|
||||
Vector2_Rotate(vector*, rotation#) : "Vector2_Rotate"
|
||||
Vector2_RotateAroundP(vector*, x#, y#, rotation#) : "Vector2_RotateAroundP"
|
||||
Vector2_RotateAroundV(vector*, other*, rotation#) : "Vector2_RotateAroundV"
|
||||
Vector2_DeltaRotation#(vector*) : "Vector2_DeltaRotation"
|
||||
Vector2_DeltaRotationP#(vector*, x#, y#) : "Vector2_DeltaRotationP"
|
||||
Vector2_DeltaRotationV#(vector*, other*) : "Vector2_DeltaRotationV"
|
||||
Vector2_Serialize$(vector*) : "Vector2_Serialize"
|
||||
Vector2_Deserialize(vector*, serial$) : "Vector2_Deserialize"
|
||||
|
||||
; Math - Vector3
|
||||
Vector3_Set(vector*, value#) : "Vector3_Set"
|
||||
Vector3_SetP(vector*, x#, y#, z#) : "Vector3_SetP"
|
||||
Vector3_SetV(vector*, other*) : "Vector3_SetV"
|
||||
Vector3_Add(vector*, value#) : "Vector3_Add"
|
||||
Vector3_AddP(vector*, x#, y#, z#) : "Vector3_AddP"
|
||||
Vector3_AddV(vector*, other*) : "Vector3_AddV"
|
||||
Vector3_Sub(vector*, value#) : "Vector3_Sub"
|
||||
Vector3_SubP(vector*, x#, y#, z#) : "Vector3_SubP"
|
||||
Vector3_SubV(vector*, other*) : "Vector3_SubV"
|
||||
Vector3_Mul(vector*, value#) : "Vector3_Mul"
|
||||
Vector3_MulP(vector*, x#, y#, z#) : "Vector3_MulP"
|
||||
Vector3_MulV(vector*, other*) : "Vector3_MulV"
|
||||
Vector3_Div(vector*, value#) : "Vector3_Div"
|
||||
Vector3_DivP(vector*, x#, y#, z#) : "Vector3_DivP"
|
||||
Vector3_DivV(vector*, other*) : "Vector3_DivV"
|
||||
Vector3_Length#(vector*) : "Vector3_Length"
|
||||
Vector3_DistanceP#(vector*, x#, y#, z#) : "Vector3_DistanceP"
|
||||
Vector3_DistanceV#(vector*, other*) : "Vector3_DistanceV"
|
||||
Vector3_DotP#(vector*, x#, y#, z#) : "Vector3_DotP"
|
||||
Vector3_DotV#(vector*, other*) : "Vector3_DotV"
|
||||
Vector3_CrossP(vector*, x#, y#, z#, out*) : "Vector3_CrossP"
|
||||
Vector3_CrossV(vector*, other*, out*) : "Vector3_CrossV"
|
||||
Vector3_Normalize(vector*) : "Vector3_Normalize"
|
||||
Vector3_Rotate(vector*, pitch#, yaw#, roll#) : "Vector3_Rotate"
|
||||
Vector3_RotateAroundP(vector*, x#, y#, z#, pitch#, yaw#, roll#) : "Vector3_RotateAroundP"
|
||||
Vector3_RotateAroundV(vector*, other*, pitch#, yaw#, roll#) : "Vector3_RotateAroundV"
|
||||
Vector3_DeltaPitch#(vector*) : "Vector3_DeltaPitch"
|
||||
Vector3_DeltaPitchP#(vector*, x#, y#, z#) : "Vector3_DeltaPitchP"
|
||||
Vector3_DeltaPitchV#(vector*, other*) : "Vector3_DeltaPitchV"
|
||||
Vector3_DeltaYaw#(vector*) : "Vector3_DeltaYaw"
|
||||
Vector3_DeltaYawP#(vector*, x#, y#, z#) : "Vector3_DeltaYawP"
|
||||
Vector3_DeltaYawV#(vector*, other*) : "Vector3_DeltaYawV"
|
||||
Vector3_Serialize$(vector*) : "Vector3_Serialize"
|
||||
Vector3_Deserialize(vector*, serial$) : "Vector3_Deserialize"
|
||||
|
||||
; Utility - Displays
|
||||
BU_Display_Enumerate() : "Display_Enumerate"
|
||||
BU_Display_Count%() : "Display_Count"
|
||||
BU_Display_Get(id%, rectangle*) : "Display_Get"
|
||||
; Utility - Displays - Backward Compatability
|
||||
BlitzUtility_EnumerateDisplays() : "Display_Enumerate"
|
||||
BlitzUtility_GetDisplayCount%() : "Display_Count"
|
||||
BlitzUtility_GetDisplay(id%, rectangle*) : "Display_Get"
|
||||
|
||||
; Utility - Indexing
|
||||
BU_Indexer_Create%() : "Indexer_Create"
|
||||
BU_Indexer_GetFreeIndex%(indexer%) : "Indexer_GetFreeIndex"
|
||||
BU_Indexer_MarkFreeIndex(indexer%, index%) : "Indexer_MarkFreeIndex"
|
||||
BU_Indexer_Destroy(indexer%) : "Indexer_Destroy"
|
||||
; Utility - Indexing - Backward Compatability
|
||||
Indexer_Create%() : "Indexer_Create"
|
||||
Indexer_GetFreeIndex%(indexer%) : "Indexer_GetFreeIndex"
|
||||
Indexer_MarkFreeIndex(indexer%, index%) : "Indexer_MarkFreeIndex"
|
||||
Indexer_Destroy(indexer%) : "Indexer_Destroy"
|
||||
|
||||
; Utility - Window Messages
|
||||
BU_WindowMessageHandler_InstallHandler(hwnd%) : "WindowMessageHandler_Install"
|
||||
BU_WindowMessageHandler_UninstallHandler(hwnd%) : "WindowMessageHandler_Uninstall"
|
||||
BU_WindowMessageHandler_Message_Close%(hwnd%) : "WindowMessageHandler_Message_Close"
|
||||
BU_WindowMessageHandler_Message_Destroy%(hwnd%) : "WindowMessageHandler_Message_Destroy"
|
||||
BU_WindowMessageHandler_Message_Resize%(hwnd%, point*) : "WindowMessageHandler_Message_Resize"
|
||||
; Utility - Window Messages - Backward Compatability
|
||||
BlitzUtility_InstallCloseHandler(hwnd%) : "WindowMessageHandler_InstallHandler"
|
||||
BlitzUtility_UninstallCloseHandler(hwnd%) : "WindowMessageHandler_UninstallHandler"
|
||||
BlitzUtility_GetCloseCount%(hwnd%) : "WindowMessageHandler_CountCloseMessages"
|
||||
@@ -0,0 +1,171 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C08C5F9A-0C63-4798-A93F-FE96C014074B}</ProjectGuid>
|
||||
<RootNamespace>BlitzUtility</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)\#Build\$(ProjectName)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\#Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(ProjectDir);$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)\#Build\$(ProjectName)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(SolutionDir)\#Intermediate\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(ProjectDir);$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<SDLCheck>
|
||||
</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(ProjectDir)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>SQLITE_ENABLE_FTS4;SQLITE_ENABLE_RTREE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<StructMemberAlignment>4Bytes</StructMemberAlignment>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<ForcedIncludeFiles>
|
||||
</ForcedIncludeFiles>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<MultiProcessorCompilation>false</MultiProcessorCompilation>
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<Version>1.0</Version>
|
||||
<LinkStatus>
|
||||
</LinkStatus>
|
||||
</Link>
|
||||
<CustomBuildStep>
|
||||
<Message>Copying Resources</Message>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Full</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>
|
||||
</SDLCheck>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir);$(ProjectDir)</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PreprocessorDefinitions>SQLITE_ENABLE_FTS4;SQLITE_ENABLE_RTREE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<StructMemberAlignment>4Bytes</StructMemberAlignment>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<ForcedIncludeFiles>
|
||||
</ForcedIncludeFiles>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<OpenMPSupport>false</OpenMPSupport>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration>
|
||||
<MultiProcessorCompilation>false</MultiProcessorCompilation>
|
||||
<CompileAsManaged>false</CompileAsManaged>
|
||||
<CompileAsWinRT>false</CompileAsWinRT>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>
|
||||
</EnableCOMDATFolding>
|
||||
<OptimizeReferences>
|
||||
</OptimizeReferences>
|
||||
<Version>1.0</Version>
|
||||
<LinkStatus>
|
||||
</LinkStatus>
|
||||
</Link>
|
||||
<CustomBuildStep>
|
||||
<Message>Copying Resources</Message>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="dllmain.h" />
|
||||
<ClInclude Include="Containers\BlitzList.h" />
|
||||
<ClInclude Include="Utility\Indexer.h" />
|
||||
<ClInclude Include="Database\SQLite\SQLite.h" />
|
||||
<ClInclude Include="Database\SQLite\sqlite3.h" />
|
||||
<ClInclude Include="Math\Matrix3.h" />
|
||||
<ClInclude Include="Math\Vector2.h" />
|
||||
<ClInclude Include="Math\Vector3.h" />
|
||||
<ClInclude Include="Utility\Display.h" />
|
||||
<ClInclude Include="Utility\WindowMessageHandler.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Containers\BlitzList.cpp" />
|
||||
<ClCompile Include="Database\SQLite\sqlite3.c">
|
||||
<CallingConvention Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Cdecl</CallingConvention>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">CompileAsC</CompileAs>
|
||||
<CallingConvention Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Cdecl</CallingConvention>
|
||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">CompileAsC</CompileAs>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utility\Indexer.cpp" />
|
||||
<ClCompile Include="Database\SQLite\SQLite.cpp" />
|
||||
<ClCompile Include="Math\Matrix3.cpp" />
|
||||
<ClCompile Include="Math\Vector3.cpp" />
|
||||
<ClCompile Include="Math\Vector2.cpp" />
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="Utility\Display.cpp" />
|
||||
<ClCompile Include="Utility\WindowMessageHandler.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="BlitzUtility.bb">
|
||||
<Link>BlitzUtility.bb</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="BlitzUtility.decls">
|
||||
<Link>BlitzUtility.decls</Link>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Utility">
|
||||
<UniqueIdentifier>{48292af9-63a5-40ae-a447-ad7cecfddd8a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Containers">
|
||||
<UniqueIdentifier>{ff6bcb4d-9140-40a9-80dd-3698b63bd1c1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Database">
|
||||
<UniqueIdentifier>{4b84c339-4e83-489c-b421-2cf9fd9e72d1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Database\SQLite">
|
||||
<UniqueIdentifier>{3ac37a01-a835-479c-b0b0-ecfd04640134}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files\Math">
|
||||
<UniqueIdentifier>{38444b44-ebf1-4cae-a1a3-1a0b80b045a1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Containers\BlitzList.cpp">
|
||||
<Filter>Source Files\Containers</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Database\SQLite\SQLite.cpp">
|
||||
<Filter>Source Files\Database\SQLite</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Math\Matrix3.cpp">
|
||||
<Filter>Source Files\Math</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Math\Vector2.cpp">
|
||||
<Filter>Source Files\Math</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Math\Vector3.cpp">
|
||||
<Filter>Source Files\Math</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utility\Display.cpp">
|
||||
<Filter>Source Files\Utility</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utility\Indexer.cpp">
|
||||
<Filter>Source Files\Utility</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Utility\WindowMessageHandler.cpp">
|
||||
<Filter>Source Files\Utility</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Database\SQLite\sqlite3.c">
|
||||
<Filter>Source Files\Database\SQLite</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="dllmain.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Containers\BlitzList.h">
|
||||
<Filter>Source Files\Containers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Database\SQLite\SQLite.h">
|
||||
<Filter>Source Files\Database\SQLite</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Database\SQLite\sqlite3.h">
|
||||
<Filter>Source Files\Database\SQLite</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Math\Matrix3.h">
|
||||
<Filter>Source Files\Math</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Math\Vector2.h">
|
||||
<Filter>Source Files\Math</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Math\Vector3.h">
|
||||
<Filter>Source Files\Math</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utility\Display.h">
|
||||
<Filter>Source Files\Utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utility\Indexer.h">
|
||||
<Filter>Source Files\Utility</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Utility\WindowMessageHandler.h">
|
||||
<Filter>Source Files\Utility</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="BlitzUtility.decls" />
|
||||
<None Include="BlitzUtility.bb" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup />
|
||||
</Project>
|
||||
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
#include "BlitzList.h"
|
||||
|
||||
std::list<BlitzTypeInfo*>* BlitzUtility_Lists;
|
||||
|
||||
void BlitzList_OnProcessAttach() {
|
||||
BlitzUtility_Lists = new std::list<BlitzTypeInfo*>();
|
||||
}
|
||||
|
||||
void BlitzList_OnProcessDetach() {
|
||||
BlitzUtility_Lists->clear();
|
||||
delete BlitzUtility_Lists;
|
||||
}
|
||||
|
||||
DLL_EXPORT void* BlitzList_New(void* elementPtr) {
|
||||
BBVarElement* element = (BBVarElement*)(((int*)elementPtr) - 5);
|
||||
BBVarType* type = (BBVarType*)(*(((int*)elementPtr) - 2));
|
||||
|
||||
// Create and initialize structure to hold information about this change.
|
||||
BlitzTypeInfo* bti = new BlitzTypeInfo();
|
||||
bti->type = type;
|
||||
|
||||
// Store list pointers.
|
||||
bti->ourNextPtr = element;
|
||||
bti->ourPrevPtr = element;
|
||||
|
||||
// Remove passed object from the flow of the old list.
|
||||
element->prevPtr->nextPtr = element->nextPtr;
|
||||
element->nextPtr->prevPtr = element->prevPtr;
|
||||
|
||||
// Correct element next/prev pointers to no longer be inside the old list.
|
||||
element->prevPtr = (BBVarElement*)((int*)type + 1);
|
||||
element->nextPtr = (BBVarElement*)((int*)type + 1);
|
||||
|
||||
BlitzUtility_Lists->push_back(bti);
|
||||
return bti;
|
||||
}
|
||||
|
||||
DLL_EXPORT void BlitzList_Activate(void* list) {
|
||||
BlitzTypeInfo* bti = (BlitzTypeInfo*)list;
|
||||
|
||||
// Store current pointers
|
||||
bti->lastNextPtr = bti->type->used.nextPtr;
|
||||
bti->lastPrevPtr = bti->type->used.prevPtr;
|
||||
|
||||
// ... and replace them.
|
||||
bti->type->used.nextPtr = bti->ourNextPtr;
|
||||
bti->type->used.prevPtr = bti->ourPrevPtr;
|
||||
}
|
||||
|
||||
DLL_EXPORT void BlitzList_Deactivate(void* list) {
|
||||
BlitzTypeInfo* bti = (BlitzTypeInfo*)list;
|
||||
|
||||
// Store current pointers
|
||||
bti->ourNextPtr = bti->type->used.nextPtr;
|
||||
bti->ourPrevPtr = bti->type->used.prevPtr;
|
||||
|
||||
// ... and replace them.
|
||||
bti->type->used.nextPtr = bti->lastNextPtr;
|
||||
bti->type->used.prevPtr = bti->lastPrevPtr;
|
||||
}
|
||||
|
||||
DLL_EXPORT void BlitzList_Delete(void* list) {
|
||||
BlitzTypeInfo* bti = (BlitzTypeInfo*)list;
|
||||
BlitzUtility_Lists->remove(bti);
|
||||
delete bti;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
#include "dllmain.h"
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <list>
|
||||
|
||||
// Rev-engineered from https://github.com/blitz-research/blitz3d/blob/master/compiler/declnode.cpp
|
||||
#define BBVARTYPE_GLOBAL 0
|
||||
#define BBVARTYPE_INT 1
|
||||
#define BBVARTYPE_FLOAT 2
|
||||
#define BBVARTYPE_UNUSED 3
|
||||
#define BBVARTYPE_STRING 4
|
||||
#define BBVARTYPE_TYPE 5
|
||||
#define BBVARTYPE_ARRAY 6
|
||||
|
||||
struct BBVar {
|
||||
unsigned int Type;
|
||||
};
|
||||
|
||||
struct BBVarElement {
|
||||
int* currentPtr; // Points towards fields.
|
||||
BBVarElement* nextPtr;
|
||||
BBVarElement* prevPtr;
|
||||
void* BBVarTypePtr;
|
||||
unsigned int refCount; // Fields usually follow here, may be at another location, see currentPtr.
|
||||
};
|
||||
|
||||
struct BBVarType : BBVar {
|
||||
BBVarElement used, free;
|
||||
unsigned int fieldCount; // Field Info follows (Exactly <fieldCount> int pointers to variable struct)
|
||||
//BBVar* fields[];
|
||||
};
|
||||
|
||||
struct BlitzTypeInfo {
|
||||
BBVarType *type;
|
||||
BBVarElement *lastNextPtr, *lastPrevPtr;
|
||||
BBVarElement *ourNextPtr, *ourPrevPtr;
|
||||
};
|
||||
|
||||
void BlitzList_OnProcessAttach();
|
||||
void BlitzList_OnProcessDetach();
|
||||
|
||||
DLL_EXPORT void* BlitzList_New(void* type);
|
||||
DLL_EXPORT void BlitzList_Activate(void* list);
|
||||
DLL_EXPORT void BlitzList_Deactivate(void* list);
|
||||
DLL_EXPORT void BlitzList_Delete(void* list);
|
||||
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
#include "SQLite.h"
|
||||
|
||||
void SQLite3_OnProcessAttach() {
|
||||
sqlite3_initialize();
|
||||
}
|
||||
|
||||
void SQLite3_OnProcessDetach() {
|
||||
sqlite3_shutdown();
|
||||
}
|
||||
|
||||
DLL_EXPORT int sqlite3_bind_int64_ex(void* stmtPtr, uint32_t index, uint32_t low, uint32_t high) {
|
||||
return sqlite3_bind_int64((sqlite3_stmt*)stmtPtr, index, (((uint64_t)low << 32) + (uint64_t)high));
|
||||
}
|
||||
|
||||
DLL_EXPORT int sqlite3_bind_float(void* stmtPtr, uint32_t index, float value) {
|
||||
return sqlite3_bind_double((sqlite3_stmt*)stmtPtr, index, (double)value);
|
||||
}
|
||||
|
||||
DLL_EXPORT void sqlite3_column_int64_ex(void* stmtPtr, uint32_t index, void* outPtr) {
|
||||
sqlite3_int64 out = sqlite3_column_int64((sqlite3_stmt*)stmtPtr, index);
|
||||
int* ourPtr = (int*)outPtr;
|
||||
(*ourPtr) = (int)(out & 0xFFFFFFFF);
|
||||
(*(ourPtr + 1)) = (int)(out >> 32);
|
||||
}
|
||||
|
||||
DLL_EXPORT float sqlite3_column_float(void* stmtPtr, uint32_t index) {
|
||||
double out = sqlite3_column_double((sqlite3_stmt*)stmtPtr, index);
|
||||
return (float)out;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
#include "dllmain.h"
|
||||
#include <list>
|
||||
#include "sqlite3.h"
|
||||
|
||||
void SQLite3_OnProcessAttach();
|
||||
void SQLite3_OnProcessDetach();
|
||||
|
||||
extern "C" {
|
||||
DLL_EXPORT int sqlite3_bind_int64_ex(void* stmtPtr, uint32_t index, uint32_t low, uint32_t high);
|
||||
DLL_EXPORT int sqlite3_bind_float(void* stmtPtr, uint32_t index, float value);
|
||||
|
||||
DLL_EXPORT void sqlite3_column_int64_ex(void* stmtPtr, uint32_t index, void* outPtr);
|
||||
DLL_EXPORT float sqlite3_column_float(void* stmtPtr, uint32_t index);
|
||||
}
|
||||
+155865
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,132 @@
|
||||
#include "Common.h"
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
|
||||
// Rev-engineered from https://github.com/blitz-research/blitz3d/blob/master/compiler/declnode.cpp
|
||||
#define BBVARTYPE_GLOBAL 0
|
||||
#define BBVARTYPE_INT 1
|
||||
#define BBVARTYPE_FLOAT 2
|
||||
#define BBVARTYPE_UNUSED 3
|
||||
#define BBVARTYPE_STRING 4
|
||||
#define BBVARTYPE_TYPE 5
|
||||
#define BBVARTYPE_ARRAY 6
|
||||
|
||||
struct BBVar {
|
||||
int Type = -1;
|
||||
};
|
||||
|
||||
struct BBVarGlobal {
|
||||
int GlobalType = -1;
|
||||
int* Value;
|
||||
};
|
||||
|
||||
struct BBVarInt : BBVar {
|
||||
int Value;
|
||||
};
|
||||
|
||||
struct BBVarFloat : BBVar {
|
||||
float Value;
|
||||
};
|
||||
|
||||
struct BBVarUnused : BBVar {
|
||||
// Not a Dim, as you can see here:
|
||||
// https://github.com/blitz-research/blitz3d/blob/master/compiler/stmtnode.cpp#L86
|
||||
};
|
||||
|
||||
struct BBVarString : BBVar {
|
||||
int Length;
|
||||
char* Value;
|
||||
};
|
||||
|
||||
struct BBVarElement;
|
||||
struct BBVarType : BBVar {
|
||||
BBVarElement used, free;
|
||||
int fieldCount; // Field Info follows (Exactly <fieldCount> int pointers to variable struct)
|
||||
int* fields[];
|
||||
};
|
||||
|
||||
struct BBVarElement {
|
||||
int* currentPtr; // Points towards fields.
|
||||
int* nextPtr, prevPtr;
|
||||
BBVarType* BBStructPtr;
|
||||
int refCount; // Fields usually follow here, may be at another location, see currentPtr.
|
||||
//BBVar* fields[];
|
||||
};
|
||||
|
||||
struct BBVarArray : BBVar {
|
||||
int Size; //???
|
||||
BBVar* ArrayType;
|
||||
};
|
||||
|
||||
std::string BBVar_Serialize(void* obj) {
|
||||
std::stringstream myStream;
|
||||
|
||||
BBVar* var = (BBVar*)obj;
|
||||
switch (var->Type) {
|
||||
case BBVARTYPE_GLOBAL:
|
||||
BBVarGlobal* varGlobal = (BBVarGlobal*)obj;
|
||||
myStream << "[Global] " << BBVar_Serialize(varGlobal->Value) << std::endl;
|
||||
break;
|
||||
case BBVARTYPE_INT:
|
||||
BBVarInt* varInt = (BBVarInt*)obj;
|
||||
myStream << "Int" << std::endl;
|
||||
break;
|
||||
case BBVARTYPE_FLOAT:
|
||||
BBVarFloat* varFloat = (BBVarFloat*)obj;
|
||||
myStream << "Float" << std::endl;
|
||||
break;
|
||||
case BBVARTYPE_UNUSED:
|
||||
BBVarUnused* varUnused = (BBVarUnused*)obj;
|
||||
myStream << "Unused" << std::endl;
|
||||
break;
|
||||
case BBVARTYPE_STRING:
|
||||
BBVarString* varString = (BBVarString*)obj;
|
||||
myStream << "String" << std::endl;
|
||||
break;
|
||||
case BBVARTYPE_TYPE:
|
||||
BBVarType* varType = (BBVarType*)obj;
|
||||
myStream << BBVarType_Serialize(varType);
|
||||
break;
|
||||
case BBVARTYPE_ARRAY:
|
||||
BBVarArray* varArray = (BBVarArray*)obj;
|
||||
myStream << "Array = " << std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
return myStream.str();
|
||||
}
|
||||
|
||||
std::string BBVarType_Serialize(BBVarType* obj, unsigned int indent = 0) {
|
||||
std::stringstream myStream;
|
||||
|
||||
std::stringstream myPaddingSS;
|
||||
for (unsigned int pad = 0; pad < indent; pad++) {
|
||||
myPaddingSS << " ";
|
||||
}
|
||||
std::string myPadding = myPaddingSS.str();
|
||||
|
||||
myStream << myPadding << "Type {" << std::endl;
|
||||
for (unsigned int fld = 0; fld < obj->fieldCount; fld++) {
|
||||
myStream << myPadding << " (" << fld << ") => " << BBVar_Serialize(obj->fields[fld]) << std::endl;
|
||||
}
|
||||
myStream << myPadding << "}" << std::endl;
|
||||
|
||||
return myStream.str();
|
||||
}
|
||||
|
||||
DLL_EXPORT(char*) SerializeObject(void* obj) {
|
||||
return strdup(BBVar_Serialize(obj).c_str());
|
||||
}
|
||||
|
||||
// Laut Mark Sibly:
|
||||
struct BBType {
|
||||
int obj_size;
|
||||
BBObj usedList, freeList;
|
||||
};
|
||||
|
||||
struct BBObj {
|
||||
BBObj *curr;
|
||||
BBObj *next, *prev;
|
||||
int* bbtype;
|
||||
int ref_cnt;
|
||||
};
|
||||
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
#include "Matrix3.h"
|
||||
|
||||
|
||||
void Matrix3::set(Matrix3 &M)
|
||||
{
|
||||
if (this != &M) {
|
||||
this->X.set(M.X);
|
||||
this->Y.set(M.Y);
|
||||
this->Z.set(M.Z);
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix3::set(Vector3 &X, Vector3 &Y, Vector3 &Z)
|
||||
{
|
||||
this->X.set(X);
|
||||
this->Y.set(Y);
|
||||
this->Z.set(Z);
|
||||
}
|
||||
|
||||
void Matrix3::set(float &XX, float &XY, float &XZ, float &YX, float &YY, float &YZ, float &ZX, float &ZY, float &ZZ)
|
||||
{
|
||||
this->X.set(XX, XY, XZ);
|
||||
this->Y.set(YX, YY, YZ);
|
||||
this->Z.set(ZX, ZY, ZZ);
|
||||
}
|
||||
|
||||
void Matrix3::rotate(float &pitch, float &yaw, float &roll)
|
||||
{
|
||||
this->X.mul(cos(yaw) * cos(roll), -sin(roll), sin(yaw));
|
||||
this->Y.mul(sin(roll), cos(pitch) * cos(roll), -sin(pitch));
|
||||
this->Z.mul(-sin(yaw), sin(pitch), cos(pitch) * cos(yaw));
|
||||
}
|
||||
|
||||
void Matrix3::angles(float &pitch, float &yaw, float &roll)
|
||||
{
|
||||
// ToDo
|
||||
}
|
||||
|
||||
void Matrix3::transpose()
|
||||
{
|
||||
Matrix3 temp;
|
||||
|
||||
temp.set(*this);
|
||||
this->X.set(temp.X.X, temp.Y.X, temp.Z.X);
|
||||
this->Y.set(temp.X.Y, temp.Y.Y, temp.Z.Y);
|
||||
this->Z.set(temp.X.Z, temp.Y.Z, temp.Z.Z);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <math.h>
|
||||
#include "dllmain.h"
|
||||
#include "Vector3.h"
|
||||
|
||||
struct Matrix3 {
|
||||
Vector3 X, Y, Z;
|
||||
|
||||
void set(Matrix3 &M);
|
||||
void set(Vector3 &X, Vector3 &Y, Vector3 &Z);
|
||||
void set(float &XX, float &XY, float &XZ, float &YX, float &YY, float &YZ, float &ZX, float &ZY, float &ZZ);
|
||||
|
||||
void rotate(float &pitch, float &yaw, float &roll);
|
||||
void angles(float &pitch, float &yaw, float &roll);
|
||||
|
||||
void transpose();
|
||||
};
|
||||
|
||||
@@ -0,0 +1,261 @@
|
||||
#pragma once
|
||||
#include "Vector2.h"
|
||||
|
||||
void Vector2::set(const float &o)
|
||||
{
|
||||
this->X = o;
|
||||
this->Y = o;
|
||||
}
|
||||
void Vector2::set(const float &x, const float &y)
|
||||
{
|
||||
this->X = x;
|
||||
this->Y = y;
|
||||
}
|
||||
void Vector2::set(const Vector2 &o)
|
||||
{
|
||||
if (this != &o) {
|
||||
this->X = o.X;
|
||||
this->Y = o.Y;
|
||||
}
|
||||
}
|
||||
|
||||
void Vector2::add(const float &o)
|
||||
{
|
||||
this->X += o;
|
||||
this->Y += o;
|
||||
}
|
||||
void Vector2::add(const float &x, const float &y)
|
||||
{
|
||||
this->X += x;
|
||||
this->Y += y;
|
||||
}
|
||||
void Vector2::add(const Vector2 &o)
|
||||
{
|
||||
this->X += o.X;
|
||||
this->Y += o.Y;
|
||||
}
|
||||
|
||||
void Vector2::sub(const float &o)
|
||||
{
|
||||
this->X -= o;
|
||||
this->Y -= o;
|
||||
}
|
||||
void Vector2::sub(const float &x, const float &y)
|
||||
{
|
||||
this->X -= x;
|
||||
this->Y -= y;
|
||||
}
|
||||
void Vector2::sub(const Vector2 &o)
|
||||
{
|
||||
this->X -= o.X;
|
||||
this->Y -= o.Y;
|
||||
}
|
||||
|
||||
void Vector2::mul(const float &o)
|
||||
{
|
||||
this->X *= o;
|
||||
this->Y *= o;
|
||||
}
|
||||
void Vector2::mul(const float &x, const float &y)
|
||||
{
|
||||
this->X *= x;
|
||||
this->Y *= y;
|
||||
}
|
||||
void Vector2::mul(const Vector2 &o)
|
||||
{
|
||||
this->X *= o.X;
|
||||
this->Y *= o.Y;
|
||||
}
|
||||
|
||||
void Vector2::div(const float &o)
|
||||
{
|
||||
this->X /= o;
|
||||
this->Y /= o;
|
||||
}
|
||||
void Vector2::div(const float &x, const float &y)
|
||||
{
|
||||
this->X /= x;
|
||||
this->Y /= y;
|
||||
}
|
||||
void Vector2::div(const Vector2 &o)
|
||||
{
|
||||
this->X /= o.X;
|
||||
this->Y /= o.Y;
|
||||
}
|
||||
|
||||
float Vector2::length()
|
||||
{
|
||||
return (float)sqrt((this->X * this->X) + (this->Y * this->Y));
|
||||
}
|
||||
float Vector2::distance(const float &x, const float &y)
|
||||
{
|
||||
float X = this->X - x;
|
||||
float Y = this->Y - y;
|
||||
return (float)sqrt((X * X) + (Y * Y));
|
||||
}
|
||||
float Vector2::distance(const Vector2 &o)
|
||||
{
|
||||
float X = this->X - o.X;
|
||||
float Y = this->Y - o.Y;
|
||||
return (float)sqrt((X * X) + (Y * Y));
|
||||
}
|
||||
|
||||
float Vector2::dot(const float &x, const float &y)
|
||||
{
|
||||
return (this->X * x) + (this->Y * y);
|
||||
}
|
||||
float Vector2::dot(const Vector2 &o)
|
||||
{
|
||||
return (this->X * o.X) + (this->Y * o.Y);
|
||||
}
|
||||
void Vector2::normalize()
|
||||
{
|
||||
this->div(this->length());
|
||||
}
|
||||
|
||||
void Vector2::rotate(const float rotation)
|
||||
{
|
||||
float mX = cos(rotation);
|
||||
float mY = sin(rotation);
|
||||
|
||||
float X = this->X * mX + this->Y * mY; this->X = X;
|
||||
float Y = this->X * mY + this->X * mX; this->Y = Y;
|
||||
}
|
||||
void Vector2::rotateAround(const float &x, const float &y, const float &rotation)
|
||||
{
|
||||
this->sub(x, y);
|
||||
this->rotate(rotation);
|
||||
this->add(x, y);
|
||||
}
|
||||
void Vector2::rotateAround(const Vector2 &o, const float &rotation)
|
||||
{
|
||||
this->sub(o);
|
||||
this->rotate(rotation);
|
||||
this->add(o);
|
||||
}
|
||||
|
||||
float Vector2::deltaRotation() {
|
||||
return (float)(atan2(this->Y, this->X) * (180.0 / M_PI));
|
||||
}
|
||||
float Vector2::deltaRotation(const float &x, const float &y)
|
||||
{
|
||||
return (float)(atan2(this->Y - y, this->X - x) * (180.0 / M_PI));
|
||||
}
|
||||
float Vector2::deltaRotation(const Vector2 &o)
|
||||
{
|
||||
return (float)(atan2(this->Y - o.Y, this->X - o.X) * (180.0 / M_PI));
|
||||
}
|
||||
|
||||
char* Vector2::serialize()
|
||||
{
|
||||
char* data = new char[9];
|
||||
|
||||
memcpy(data, this->Xc, 4);
|
||||
memcpy(data + 4, this->Yc, 4);
|
||||
data[8] = 0;
|
||||
|
||||
return data;
|
||||
}
|
||||
void Vector2::deserialize(char* o)
|
||||
{
|
||||
memcpy(o, this->Xc, 4);
|
||||
memcpy(o + 4, this->Yc, 4);
|
||||
}
|
||||
|
||||
/* ------------------------- Exported Functionality ------------------------- */
|
||||
DLL_EXPORT void Vector2_Set(Vector2* a, float o) {
|
||||
a->set(o);
|
||||
}
|
||||
DLL_EXPORT void Vector2_SetP(Vector2* a, float x, float y) {
|
||||
a->set(x, y);
|
||||
}
|
||||
DLL_EXPORT void Vector2_SetV(Vector2* a, Vector2* b) {
|
||||
a->set(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT void Vector2_Add(Vector2* a, float o) {
|
||||
a->add(o);
|
||||
}
|
||||
DLL_EXPORT void Vector2_AddP(Vector2* a, float x, float y) {
|
||||
a->add(x, y);
|
||||
}
|
||||
DLL_EXPORT void Vector2_AddV(Vector2* a, Vector2* b) {
|
||||
a->add(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT void Vector2_Sub(Vector2* a, float o) {
|
||||
a->sub(o);
|
||||
}
|
||||
DLL_EXPORT void Vector2_SubP(Vector2* a, float x, float y) {
|
||||
a->sub(x, y);
|
||||
}
|
||||
DLL_EXPORT void Vector2_SubV(Vector2* a, Vector2* b) {
|
||||
a->sub(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT void Vector2_Mul(Vector2* a, float o) {
|
||||
a->mul(o);
|
||||
}
|
||||
DLL_EXPORT void Vector2_MulP(Vector2* a, float x, float y) {
|
||||
a->mul(x, y);
|
||||
}
|
||||
DLL_EXPORT void Vector2_MulV(Vector2* a, Vector2* b) {
|
||||
a->mul(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT void Vector2_Div(Vector2* a, float o) {
|
||||
a->div(o);
|
||||
}
|
||||
DLL_EXPORT void Vector2_DivP(Vector2* a, float x, float y) {
|
||||
a->div(x, y);
|
||||
}
|
||||
DLL_EXPORT void Vector2_DivV(Vector2* a, Vector2* b) {
|
||||
a->div(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT float Vector2_Length(Vector2* a) {
|
||||
return (float)a->length();
|
||||
}
|
||||
DLL_EXPORT float Vector2_DistanceP(Vector2* a, float x, float y) {
|
||||
return (float)a->distance(x, y);
|
||||
}
|
||||
DLL_EXPORT float Vector2_DistanceV(Vector2* a, Vector2* b) {
|
||||
return (float)a->distance(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT float Vector2_DotP(Vector2* a, float x, float y) {
|
||||
return (float)a->dot(x, y);
|
||||
}
|
||||
DLL_EXPORT float Vector2_DotV(Vector2* a, Vector2* b) {
|
||||
return (float)a->dot(*b);
|
||||
}
|
||||
DLL_EXPORT void Vector2_Normalize(Vector2* a) {
|
||||
a->normalize();
|
||||
}
|
||||
|
||||
DLL_EXPORT void Vector2_Rotate(Vector2* a, float rotation) {
|
||||
a->rotate(rotation);
|
||||
}
|
||||
DLL_EXPORT void Vector2_RotateAroundP(Vector2* a, float x, float y, float rotation) {
|
||||
a->rotateAround(x, y, rotation);
|
||||
}
|
||||
DLL_EXPORT void Vector2_RotateAroundV(Vector2* a, Vector2* b, float rotation) {
|
||||
a->rotateAround(*b, rotation);
|
||||
}
|
||||
|
||||
DLL_EXPORT float Vector2_DeltaRotation(Vector2* a) {
|
||||
return (float)a->deltaRotation();
|
||||
}
|
||||
DLL_EXPORT float Vector2_DeltaRotationP(Vector2* a, float x, float y) {
|
||||
return (float)a->deltaRotation(x, y);
|
||||
}
|
||||
DLL_EXPORT float Vector2_DeltaRotationV(Vector2* a, Vector2* b) {
|
||||
return (float)a->deltaRotation(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT char* Vector2_Serialize(Vector2* a) {
|
||||
return a->serialize();
|
||||
}
|
||||
DLL_EXPORT void Vector2_Deserialize(Vector2* a, char* o) {
|
||||
a->deserialize(o);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
#include "dllmain.h"
|
||||
#ifndef _USE_MATH_DEFINES
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#undef _USE_MATH_DEFINES
|
||||
#endif
|
||||
|
||||
struct Vector2 {
|
||||
union {
|
||||
float X;
|
||||
char Xc[4];
|
||||
};
|
||||
union {
|
||||
float Y;
|
||||
char Yc[4];
|
||||
};
|
||||
|
||||
void set(const float &o);
|
||||
void set(const float &x, const float &y);
|
||||
void set(const Vector2 &o);
|
||||
|
||||
void add(const float &o);
|
||||
void add(const float &x, const float &y);
|
||||
void add(const Vector2 &o);
|
||||
|
||||
void sub(const float &o);
|
||||
void sub(const float &x, const float &y);
|
||||
void sub(const Vector2 &o);
|
||||
|
||||
void mul(const float &o);
|
||||
void mul(const float &x, const float &y);
|
||||
void mul(const Vector2 &o);
|
||||
|
||||
void div(const float &o);
|
||||
void div(const float &x, const float &y);
|
||||
void div(const Vector2 &o);
|
||||
|
||||
float length();
|
||||
float distance(const float &x, const float &y);
|
||||
float distance(const Vector2 &o);
|
||||
|
||||
float dot(const float &x, const float &y);
|
||||
float dot(const Vector2 &o);
|
||||
void normalize();
|
||||
|
||||
void rotate(const float rotation);
|
||||
void rotateAround(const float &x, const float &y, const float &rotation);
|
||||
void rotateAround(const Vector2 &o, const float &rotation);
|
||||
float deltaRotation();
|
||||
float deltaRotation(const float &x, const float &y);
|
||||
float deltaRotation(const Vector2 &o);
|
||||
|
||||
char* serialize();
|
||||
void deserialize(char* o);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
#pragma once
|
||||
#include "Vector3.h"
|
||||
|
||||
void Vector3::set(const float &o)
|
||||
{
|
||||
this->X = o;
|
||||
this->Y = o;
|
||||
this->Z = o;
|
||||
}
|
||||
void Vector3::set(const float &x, const float &y, const float &z)
|
||||
{
|
||||
this->X = x;
|
||||
this->Y = y;
|
||||
this->Z = z;
|
||||
}
|
||||
void Vector3::set(const Vector3 &o)
|
||||
{
|
||||
if (this != &o) {
|
||||
this->X = o.X;
|
||||
this->Y = o.Y;
|
||||
this->Z = o.Z;
|
||||
}
|
||||
}
|
||||
|
||||
void Vector3::add(const float &o)
|
||||
{
|
||||
this->X += o;
|
||||
this->Y += o;
|
||||
this->Z += o;
|
||||
}
|
||||
void Vector3::add(const float &x, const float &y, const float &z)
|
||||
{
|
||||
this->X += x;
|
||||
this->Y += y;
|
||||
this->Z += z;
|
||||
}
|
||||
void Vector3::add(const Vector3 &o)
|
||||
{
|
||||
this->X += o.X;
|
||||
this->Y += o.Y;
|
||||
this->Z += o.Z;
|
||||
}
|
||||
|
||||
void Vector3::sub(const float &o)
|
||||
{
|
||||
this->X -= o;
|
||||
this->Y -= o;
|
||||
this->Z -= o;
|
||||
}
|
||||
void Vector3::sub(const float &x, const float &y, const float &z)
|
||||
{
|
||||
this->X -= x;
|
||||
this->Y -= y;
|
||||
this->Z -= z;
|
||||
}
|
||||
void Vector3::sub(const Vector3 &o)
|
||||
{
|
||||
this->X -= o.X;
|
||||
this->Y -= o.Y;
|
||||
this->Z -= o.Z;
|
||||
}
|
||||
|
||||
void Vector3::mul(const float &o)
|
||||
{
|
||||
this->X *= o;
|
||||
this->Y *= o;
|
||||
this->Z *= o;
|
||||
}
|
||||
void Vector3::mul(const float &x, const float &y, const float &z)
|
||||
{
|
||||
this->X *= x;
|
||||
this->Y *= y;
|
||||
this->Z *= z;
|
||||
}
|
||||
void Vector3::mul(const Vector3 &o)
|
||||
{
|
||||
this->X *= o.X;
|
||||
this->Y *= o.Y;
|
||||
this->Z *= o.Z;
|
||||
}
|
||||
|
||||
void Vector3::div(const float &o)
|
||||
{
|
||||
this->X /= o;
|
||||
this->Y /= o;
|
||||
this->Z /= o;
|
||||
}
|
||||
void Vector3::div(const float &x, const float &y, const float &z)
|
||||
{
|
||||
this->X /= x;
|
||||
this->Y /= y;
|
||||
this->Z /= z;
|
||||
}
|
||||
void Vector3::div(const Vector3 &o)
|
||||
{
|
||||
this->X /= o.X;
|
||||
this->Y /= o.Y;
|
||||
this->Z /= o.Z;
|
||||
}
|
||||
|
||||
float Vector3::length()
|
||||
{
|
||||
return sqrt(this->X * this->X + this->Y * this->Y + this->Z * this->Z);
|
||||
}
|
||||
float Vector3::distance(const float &x, const float &y, const float &z)
|
||||
{
|
||||
float X = (this->X - x);
|
||||
float Y = (this->Y - y);
|
||||
float Z = (this->Z - z);
|
||||
return sqrt(X * X + Y * Y + Z * Z);
|
||||
}
|
||||
float Vector3::distance(const Vector3 &o)
|
||||
{
|
||||
float X = (this->X - o.X);
|
||||
float Y = (this->Y - o.Y);
|
||||
float Z = (this->Z - o.Z);
|
||||
return sqrt(X * X + Y * Y + Z * Z);
|
||||
}
|
||||
|
||||
float Vector3::dot(const float &x, const float &y, const float &z)
|
||||
{
|
||||
return (this->X * x) + (this->Y * y) + (this->Z * z);
|
||||
}
|
||||
float Vector3::dot(const Vector3 &o)
|
||||
{
|
||||
return (this->X * o.X) + (this->Y * o.Y) + (this->Z * o.Z);
|
||||
}
|
||||
Vector3 Vector3::cross(const float &x, const float &y, const float &z)
|
||||
{
|
||||
Vector3* data = new Vector3();
|
||||
data->X = (this->Y * z) - (this->Z * y);
|
||||
data->Y = (this->Z * x) - (this->X * z);
|
||||
data->Z = (this->X * y) - (this->Y * x);
|
||||
return *data;
|
||||
}
|
||||
Vector3 Vector3::cross(const Vector3 &o)
|
||||
{
|
||||
Vector3* data = new Vector3();
|
||||
data->X = (this->Y * o.Z) - (this->Z * o.Y);
|
||||
data->Y = (this->Z * o.X) - (this->X * o.Z);
|
||||
data->Z = (this->X * o.Y) - (this->Y * o.X);
|
||||
return *data;
|
||||
}
|
||||
void Vector3::normalize()
|
||||
{
|
||||
this->div(this->length());
|
||||
}
|
||||
|
||||
void Vector3::rotate(float &pitch, float &yaw, float &roll)
|
||||
{
|
||||
float** matrix = new float*[3];
|
||||
matrix[0] = new float[3]; matrix[1] = new float[3]; matrix[2] = new float[3];
|
||||
matrix[0][0] = cos(yaw) * cos(roll); matrix[0][1] = -sin(roll); matrix[0][2] = sin(yaw);
|
||||
matrix[1][0] = sin(roll); matrix[1][1] = cos(pitch) * cos(roll); matrix[1][2] = -sin(pitch);
|
||||
matrix[2][0] = -sin(yaw); matrix[2][1] = sin(pitch); matrix[2][2] = cos(pitch) * cos(yaw);
|
||||
|
||||
float X = (this->X * matrix[0][0]) + (this->Y * matrix[0][1]) + (this->Z * matrix[0][2]);
|
||||
float Y = (this->X * matrix[1][0]) + (this->Y * matrix[1][1]) + (this->Z * matrix[1][2]);
|
||||
float Z = (this->X * matrix[2][0]) + (this->Y * matrix[2][1]) + (this->Z * matrix[2][2]);
|
||||
this->X = X; this->Y = Y; this->Z = Z;
|
||||
}
|
||||
void Vector3::rotateAround(const float &x, const float &y, const float &z, float &pitch, float &yaw, float &roll)
|
||||
{
|
||||
this->sub(x, y, z);
|
||||
this->rotate(pitch, yaw, roll);
|
||||
this->add(x, y, z);
|
||||
}
|
||||
void Vector3::rotateAround(Vector3 &o, float &pitch, float &yaw, float &roll)
|
||||
{
|
||||
this->sub(o);
|
||||
this->rotate(pitch, yaw, roll);
|
||||
this->add(o);
|
||||
}
|
||||
float Vector3::deltaPitch() {
|
||||
return (float)(atan(this->X / -this->Y) * (180.0 / M_PI));
|
||||
}
|
||||
float Vector3::deltaPitch(const float &x, const float &y, const float &z)
|
||||
{
|
||||
return (float)(atan((this->X - x) / (-(this->Y - y))) * (180.0 / M_PI));
|
||||
}
|
||||
float Vector3::deltaPitch(Vector3 &o)
|
||||
{
|
||||
return (float)(atan((this->X - o.X) / (-(this->Y - o.Y))) * (180.0 / M_PI));
|
||||
}
|
||||
float Vector3::deltaYaw() {
|
||||
return (float)(atan(sqrt((this->X * this->X) + (this->Y * this->Y)) / this->Z) * (180.0 / M_PI));
|
||||
}
|
||||
float Vector3::deltaYaw(const float &x, const float &y, const float &z)
|
||||
{
|
||||
float X = (this->X - x);
|
||||
float Y = (this->Y - y);
|
||||
return (float)(atan(sqrt((X * X) + (Y * Y)) / (this->Z - z)) * (180.0 / M_PI));
|
||||
}
|
||||
float Vector3::deltaYaw(Vector3 &o)
|
||||
{
|
||||
float X = (this->X - o.X);
|
||||
float Y = (this->Y - o.Y);
|
||||
return (float)(atan(sqrt((X * X) + (Y * Y)) / (this->Z - o.Z)) * (180.0 / M_PI));
|
||||
}
|
||||
|
||||
char* Vector3::serialize()
|
||||
{
|
||||
char* data = new char[13];
|
||||
|
||||
memcpy(data, this->Xc, 4);
|
||||
memcpy(data + 4, this->Yc, 4);
|
||||
memcpy(data + 8, this->Zc, 4);
|
||||
data[12] = 0;
|
||||
|
||||
return data;
|
||||
}
|
||||
void Vector3::deserialize(char* o)
|
||||
{
|
||||
memcpy(o, this->Xc, 4);
|
||||
memcpy(o + 4, this->Yc, 4);
|
||||
memcpy(o + 8, this->Zc, 4);
|
||||
}
|
||||
|
||||
/* ------------------------- Exported Functionality ------------------------- */
|
||||
DLL_EXPORT void Vector3_Set(Vector3* a, float o) {
|
||||
a->set(o);
|
||||
}
|
||||
DLL_EXPORT void Vector3_SetP(Vector3* a, float x, float y, float z) {
|
||||
a->set(x, y, z);
|
||||
}
|
||||
DLL_EXPORT void Vector3_SetV(Vector3* a, Vector3* b) {
|
||||
a->set(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT void Vector3_Add(Vector3* a, float o) {
|
||||
a->add(o);
|
||||
}
|
||||
DLL_EXPORT void Vector3_AddP(Vector3* a, float x, float y, float z) {
|
||||
a->add(x, y, z);
|
||||
}
|
||||
DLL_EXPORT void Vector3_AddV(Vector3* a, Vector3* b) {
|
||||
a->add(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT void Vector3_Sub(Vector3* a, float o) {
|
||||
a->sub(o);
|
||||
}
|
||||
DLL_EXPORT void Vector3_SubP(Vector3* a, float x, float y, float z) {
|
||||
a->sub(x, y, z);
|
||||
}
|
||||
DLL_EXPORT void Vector3_SubV(Vector3* a, Vector3* b) {
|
||||
a->sub(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT void Vector3_Mul(Vector3* a, float o) {
|
||||
a->mul(o);
|
||||
}
|
||||
DLL_EXPORT void Vector3_MulP(Vector3* a, float x, float y, float z) {
|
||||
a->mul(x, y, z);
|
||||
}
|
||||
DLL_EXPORT void Vector3_MulV(Vector3* a, Vector3* b) {
|
||||
a->mul(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT void Vector3_Div(Vector3* a, float o) {
|
||||
a->div(o);
|
||||
}
|
||||
DLL_EXPORT void Vector3_DivP(Vector3* a, float x, float y, float z) {
|
||||
a->div(x, y, z);
|
||||
}
|
||||
DLL_EXPORT void Vector3_DivV(Vector3* a, Vector3* b) {
|
||||
a->div(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT float Vector3_Length(Vector3* a) {
|
||||
return (float)a->length();
|
||||
}
|
||||
DLL_EXPORT float Vector3_DistanceP(Vector3* a, float x, float y, float z) {
|
||||
return (float)a->distance(x, y, z);
|
||||
}
|
||||
DLL_EXPORT float Vector3_DistanceV(Vector3* a, Vector3* b) {
|
||||
return (float)a->distance(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT float Vector3_DotP(Vector3* a, float x, float y, float z) {
|
||||
return (float)a->dot(x, y, z);
|
||||
}
|
||||
DLL_EXPORT float Vector3_DotV(Vector3* a, Vector3* b) {
|
||||
return (float)a->dot(*b);
|
||||
}
|
||||
DLL_EXPORT void Vector3_CrossP(Vector3* a, float x, float y, float z, Vector3* out) {
|
||||
Vector3 temp = a->cross(x, y, z);
|
||||
*out = temp;
|
||||
}
|
||||
DLL_EXPORT void Vector3_CrossV(Vector3* a, Vector3* b, Vector3* out) {
|
||||
Vector3 temp = a->cross(*b);
|
||||
*out = temp;
|
||||
}
|
||||
DLL_EXPORT void Vector3_Normalize(Vector3* a) {
|
||||
a->normalize();
|
||||
}
|
||||
|
||||
DLL_EXPORT void Vector3_Rotate(Vector3* a, float pitch, float yaw, float roll) {
|
||||
a->rotate(pitch, yaw, roll);
|
||||
}
|
||||
DLL_EXPORT void Vector3_RotateAroundP(Vector3* a, float x, float y, float z, float pitch, float yaw, float roll) {
|
||||
a->rotateAround(x, y, z, pitch, yaw, roll);
|
||||
}
|
||||
DLL_EXPORT void Vector3_RotateAroundV(Vector3* a, Vector3* b, float pitch, float yaw, float roll) {
|
||||
a->rotateAround(*b, pitch, yaw, roll);
|
||||
}
|
||||
|
||||
DLL_EXPORT float Vector3_DeltaPitchP(Vector3* a, float x, float y, float z) {
|
||||
return (float)a->deltaPitch(x, y, z);
|
||||
}
|
||||
DLL_EXPORT float Vector3_DeltaPitchV(Vector3* a, Vector3* b) {
|
||||
return (float)a->deltaPitch(*b);
|
||||
}
|
||||
DLL_EXPORT float Vector3_DeltaYawP(Vector3* a, float x, float y, float z) {
|
||||
return (float)a->deltaYaw(x, y, z);
|
||||
}
|
||||
DLL_EXPORT float Vector3_DeltaYawV(Vector3* a, Vector3* b) {
|
||||
return (float)a->deltaYaw(*b);
|
||||
}
|
||||
|
||||
DLL_EXPORT char* Vector3_Serialize(Vector3* a) {
|
||||
return a->serialize();
|
||||
}
|
||||
DLL_EXPORT void Vector3_Deserialize(Vector3* a, char* s) {
|
||||
a->deserialize(s);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
#pragma once
|
||||
#include "dllmain.h"
|
||||
#ifndef _USE_MATH_DEFINES
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
#undef _USE_MATH_DEFINES
|
||||
#endif
|
||||
|
||||
struct Vector3 {
|
||||
union {
|
||||
float X;
|
||||
char Xc[4];
|
||||
};
|
||||
union {
|
||||
float Y;
|
||||
char Yc[4];
|
||||
};
|
||||
union {
|
||||
float Z;
|
||||
char Zc[4];
|
||||
};
|
||||
|
||||
void set(const float &o);
|
||||
void set(const float &x, const float &y, const float &z);
|
||||
void set(const Vector3 &o);
|
||||
|
||||
void add(const float &o);
|
||||
void add(const float &x, const float &y, const float &z);
|
||||
void add(const Vector3 &o);
|
||||
|
||||
void sub(const float &o);
|
||||
void sub(const float &x, const float &y, const float &z);
|
||||
void sub(const Vector3 &o);
|
||||
|
||||
void mul(const float &o);
|
||||
void mul(const float &x, const float &y, const float &z);
|
||||
void mul(const Vector3 &o);
|
||||
|
||||
void div(const float &o);
|
||||
void div(const float &x, const float &y, const float &z);
|
||||
void div(const Vector3 &o);
|
||||
|
||||
float length();
|
||||
float distance(const float &x, const float &y, const float &z);
|
||||
float distance(const Vector3 &o);
|
||||
|
||||
float dot(const float &x, const float &y, const float &z);
|
||||
float dot(const Vector3 &o);
|
||||
Vector3 cross(const float &x, const float &y, const float &z);
|
||||
Vector3 cross(const Vector3 &o);
|
||||
void normalize();
|
||||
|
||||
void rotate(float &pitch, float &yaw, float &roll);
|
||||
void rotateAround(const float &x, const float &y, const float &z, float &pitch, float &yaw, float &roll);
|
||||
void rotateAround(Vector3 &o, float &pitch, float &yaw, float &roll);
|
||||
float deltaPitch();
|
||||
float deltaPitch(const float &x, const float &y, const float &z);
|
||||
float deltaPitch(Vector3 &o);
|
||||
float deltaYaw();
|
||||
float deltaYaw(const float &x, const float &y, const float &z);
|
||||
float deltaYaw(Vector3 &o);
|
||||
|
||||
char* serialize();
|
||||
void deserialize(char* o);
|
||||
};
|
||||
@@ -0,0 +1,54 @@
|
||||
#include "Display.h"
|
||||
|
||||
std::list<Display>* Display_List = NULL;
|
||||
|
||||
void Display_OnProcessAttach() {
|
||||
Display_List = new std::list<Display>();
|
||||
}
|
||||
|
||||
void Display_OnProcessDetach() {
|
||||
Display_List->clear();
|
||||
delete Display_List;
|
||||
}
|
||||
|
||||
DLL_EXPORT void Display_Enumerate() {
|
||||
if (Display_List == NULL)
|
||||
return;
|
||||
|
||||
Display_List->clear();
|
||||
|
||||
EnumDisplayMonitors(NULL, NULL, Display_EnumerateProcedure, 0);
|
||||
}
|
||||
|
||||
BOOL CALLBACK Display_EnumerateProcedure(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData) {
|
||||
Display *thisDisplay = new Display;
|
||||
|
||||
thisDisplay->left = lprcMonitor->left;
|
||||
thisDisplay->top = lprcMonitor->top;
|
||||
thisDisplay->right = lprcMonitor->right;
|
||||
thisDisplay->bottom = lprcMonitor->bottom;
|
||||
|
||||
Display_List->push_back(*thisDisplay);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DLL_EXPORT int Display_Count() {
|
||||
return Display_List->size();
|
||||
}
|
||||
|
||||
DLL_EXPORT void Display_Get(int displayId, LPRECT display) {
|
||||
if (Display_List->size() > (unsigned)displayId) {
|
||||
auto iterator = Display_List->begin();
|
||||
|
||||
std::advance(iterator, displayId);
|
||||
|
||||
if (display != NULL) {
|
||||
display->left = iterator->left;
|
||||
display->top = iterator->top;
|
||||
display->right = iterator->right;
|
||||
display->bottom = iterator->bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "dllmain.h"
|
||||
#include <list>
|
||||
|
||||
struct Display {
|
||||
int left;
|
||||
int top;
|
||||
int right;
|
||||
int bottom;
|
||||
};
|
||||
|
||||
void Display_OnProcessAttach();
|
||||
void Display_OnProcessDetach();
|
||||
|
||||
BOOL CALLBACK Display_EnumerateProcedure(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMonitor, LPARAM dwData);
|
||||
|
||||
extern "C" {
|
||||
DLL_EXPORT void Display_Enumerate();
|
||||
DLL_EXPORT int Display_Count();
|
||||
DLL_EXPORT void Display_Get(int displayId, LPRECT display);
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
#pragma once
|
||||
#include "Indexer.h"
|
||||
|
||||
#define INDEX_OFF_0 0x00000000
|
||||
#define INDEX_OFF_1 0x10000000
|
||||
#define INDEX_OFF_2 0x20000000
|
||||
#define INDEX_OFF_3 0x30000000
|
||||
#define INDEX_OFF_4 0x40000000
|
||||
#define INDEX_OFF_5 0x50000000
|
||||
#define INDEX_OFF_6 0x60000000
|
||||
#define INDEX_OFF_7 0x70000000
|
||||
#define INDEX_OFF_8 0x80000000
|
||||
#define INDEX_OFF_9 0x90000000
|
||||
#define INDEX_OFF_A 0xA0000000
|
||||
#define INDEX_OFF_B 0xB0000000
|
||||
#define INDEX_OFF_C 0xC0000000
|
||||
#define INDEX_OFF_D 0xD0000000
|
||||
#define INDEX_OFF_E 0xE0000000
|
||||
#define INDEX_OFF_F 0xF0000000
|
||||
|
||||
unsigned int Indexer::GetFreeIndex()
|
||||
{
|
||||
unsigned int index = lastAssignedIndex + 1;
|
||||
|
||||
bool foundIndex = false;
|
||||
char indexBitOffset = 0;
|
||||
|
||||
// We use 16 offsets here to speed up the search for a free index.
|
||||
while (foundIndex == false) {
|
||||
index = index + 64;
|
||||
|
||||
uint64_t toCheck = this->indexes[index >> 6];
|
||||
for (indexBitOffset = 0; indexBitOffset < 64; indexBitOffset++) {
|
||||
if ((toCheck & (1ULL << indexBitOffset)) == false) {
|
||||
foundIndex = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
index = index + indexBitOffset;
|
||||
|
||||
// Mark Index as in use.
|
||||
this->indexes[index >> 6] |= 1ULL << indexBitOffset;
|
||||
lastAssignedIndex = index;
|
||||
|
||||
return lastAssignedIndex;
|
||||
}
|
||||
|
||||
void Indexer::MarkFreeIndex(int index)
|
||||
{
|
||||
unsigned short bitFlip = index % 64;
|
||||
|
||||
// Mark index as unused.
|
||||
this->indexes[index >> 6] &= ~(1ULL << bitFlip);
|
||||
}
|
||||
|
||||
DLL_EXPORT void* Indexer_Create() {
|
||||
Indexer* indexer = new Indexer();
|
||||
return indexer;
|
||||
}
|
||||
|
||||
DLL_EXPORT int Indexer_GetFreeIndex(void* indexerPtr) {
|
||||
Indexer* indexer = (Indexer*)indexerPtr;
|
||||
return indexer->GetFreeIndex();
|
||||
}
|
||||
|
||||
DLL_EXPORT void Indexer_MarkFreeIndex(void* indexerPtr, int Index) {
|
||||
Indexer* indexer = (Indexer*)indexerPtr;
|
||||
indexer->MarkFreeIndex(Index);
|
||||
}
|
||||
|
||||
DLL_EXPORT void Indexer_Destroy(void* indexerPtr) {
|
||||
Indexer* indexer = (Indexer*)indexerPtr;
|
||||
delete indexer;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
#include <cstdlib>
|
||||
#include <list>
|
||||
#include "dllmain.h"
|
||||
|
||||
// 67108864 = 2 ^ 32 / 64
|
||||
#define INDEXER_INDEXES 67108864
|
||||
|
||||
/** Indexer structure helps with getting unique, unused Indexes (Ids).
|
||||
* Doing this natively would be too slow, so I'm using a DLL for this.
|
||||
*/
|
||||
struct Indexer {
|
||||
uint64_t indexes[67108864];
|
||||
uint32_t lastAssignedIndex;
|
||||
|
||||
unsigned int GetFreeIndex();
|
||||
void MarkFreeIndex(int index);
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
DLL_EXPORT void* Indexer_Create();
|
||||
DLL_EXPORT int Indexer_GetFreeIndex(void* index);
|
||||
DLL_EXPORT void Indexer_MarkFreeIndex(void* index, int Index);
|
||||
DLL_EXPORT void Indexer_Destroy(void* index);
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
#pragma once
|
||||
#include "WindowMessageHandler.h"
|
||||
|
||||
std::list<WindowUserData>* WindowMessageHandler_List;
|
||||
|
||||
void WindowMessageHandler_OnProcessAttach() {
|
||||
WindowMessageHandler_List = new std::list<WindowUserData>();
|
||||
}
|
||||
|
||||
void WindowMessageHandler_OnProcessDetach() {
|
||||
for (auto iterator = WindowMessageHandler_List->begin(), end = WindowMessageHandler_List->end(); iterator != end; iterator++) {
|
||||
WindowMessageHandler_Uninstall(iterator->hwnd);
|
||||
}
|
||||
|
||||
WindowMessageHandler_List->clear();
|
||||
delete WindowMessageHandler_List;
|
||||
}
|
||||
|
||||
LRESULT CALLBACK WindowMessageHandler_Procedure(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
WindowUserData* UserData = (WindowUserData*)GetWindowLong(hwnd, GWL_USERDATA);
|
||||
if (UserData) {
|
||||
switch (uMsg) {
|
||||
case WM_SIZE:
|
||||
UserData->WindowWasResized = true;
|
||||
UserData->WindowClientWidth = lParam & 0xFFFF;
|
||||
UserData->WindowClientHeight = lParam & 0xFFFF0000 >> 16;
|
||||
|
||||
return CallWindowProc(UserData->oWindowProcedure, hwnd, uMsg, wParam, lParam);
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
UserData->DestroyCount++;
|
||||
return false;
|
||||
|
||||
case WM_DESTROY:
|
||||
UserData->CloseCount++;
|
||||
return false;
|
||||
|
||||
default:
|
||||
return CallWindowProc(UserData->oWindowProcedure, hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
} else {
|
||||
return DefWindowProc(hwnd, uMsg, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
DLL_EXPORT void WindowMessageHandler_Install(HWND hwnd) {
|
||||
if (hwnd) {
|
||||
WindowUserData* UserData = new WindowUserData;
|
||||
ZeroMemory(UserData, sizeof(UserData));
|
||||
UserData->oWindowProcedure = (WNDPROC)SetWindowLong(hwnd, GWL_WNDPROC, (LONG)&WindowMessageHandler_Procedure);
|
||||
UserData->oUserData = SetWindowLong(hwnd, GWL_USERDATA, (LONG)UserData);
|
||||
}
|
||||
}
|
||||
#pragma comment(linker, "/EXPORT:WindowMessageHandler_Install=_WindowMessageHandler_Install@4")
|
||||
|
||||
DLL_EXPORT void WindowMessageHandler_Uninstall(HWND hwnd) {
|
||||
if (hwnd) {
|
||||
WindowUserData* UserData = (WindowUserData*)GetWindowLong(hwnd, GWL_USERDATA);
|
||||
if (UserData) {
|
||||
SetWindowLong(hwnd, GWL_USERDATA, UserData->oUserData);
|
||||
SetWindowLong(hwnd, GWL_WNDPROC, (LONG)(UserData->oWindowProcedure));
|
||||
delete UserData;
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma comment(linker, "/EXPORT:WindowMessageHandler_Uninstall=_WindowMessageHandler_Uninstall@4")
|
||||
|
||||
DLL_EXPORT int WindowMessageHandler_Message_Resize(HWND hwnd, LPPOINT point) {
|
||||
if (hwnd) {
|
||||
WindowUserData* UserData = (WindowUserData*)GetWindowLong(hwnd, GWL_USERDATA);
|
||||
if (UserData) {
|
||||
int toReturn = UserData->WindowWasResized;
|
||||
point->x = UserData->WindowClientWidth;
|
||||
point->y = UserData->WindowClientHeight;
|
||||
UserData->WindowWasResized = false;
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#pragma comment(linker, "/EXPORT:WindowMessageHandler_Message_Resize=_WindowMessageHandler_Message_Resize@8")
|
||||
|
||||
DLL_EXPORT int WindowMessageHandler_Message_Destroy(HWND hwnd) {
|
||||
if (hwnd) {
|
||||
WindowUserData* UserData = (WindowUserData*)GetWindowLong(hwnd, GWL_USERDATA);
|
||||
if (UserData) {
|
||||
int toReturn = UserData->DestroyCount;
|
||||
UserData->DestroyCount = 0;
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#pragma comment(linker, "/EXPORT:WindowMessageHandler_Message_Destroy=_WindowMessageHandler_Message_Destroy@4")
|
||||
|
||||
DLL_EXPORT int WindowMessageHandler_Message_Close(HWND hwnd) {
|
||||
if (hwnd) {
|
||||
WindowUserData* UserData = (WindowUserData*)GetWindowLong(hwnd, GWL_USERDATA);
|
||||
if (UserData) {
|
||||
int toReturn = UserData->CloseCount;
|
||||
UserData->CloseCount = 0;
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#pragma comment(linker, "/EXPORT:WindowMessageHandler_Message_Close=_WindowMessageHandler_Message_Close@4")
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include "dllmain.h"
|
||||
#include <list>
|
||||
|
||||
struct WindowUserData {
|
||||
HWND hwnd;
|
||||
|
||||
WNDPROC oWindowProcedure;
|
||||
LONG oUserData;
|
||||
|
||||
// WM_SIZE
|
||||
bool WindowWasResized;
|
||||
uint32_t WindowClientWidth, WindowClientHeight;
|
||||
|
||||
// WM_DESTROY, WM_CLOSE
|
||||
uint32_t DestroyCount, CloseCount;
|
||||
};
|
||||
|
||||
|
||||
void WindowMessageHandler_OnProcessAttach();
|
||||
void WindowMessageHandler_OnProcessDetach();
|
||||
|
||||
LRESULT CALLBACK WindowMessageHandler_Procedure(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
extern "C" {
|
||||
DLL_EXPORT void WindowMessageHandler_Install(HWND hwnd);
|
||||
DLL_EXPORT void WindowMessageHandler_Uninstall(HWND hwnd);
|
||||
DLL_EXPORT int WindowMessageHandler_Message_Resize(HWND hwnd, LPPOINT point);
|
||||
DLL_EXPORT int WindowMessageHandler_Message_Destroy(HWND hwnd);
|
||||
DLL_EXPORT int WindowMessageHandler_Message_Close(HWND hwnd);
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
#include "dllmain.h"
|
||||
|
||||
#include <list>
|
||||
#include "Containers\BlitzList.h"
|
||||
#include "Database\SQLite\SQLite.h"
|
||||
#include "Math\Vector2.h"
|
||||
#include "Math\Vector3.h"
|
||||
#include "Math\Matrix3.h"
|
||||
#include "Utility\Display.h"
|
||||
#include "Utility\Indexer.h"
|
||||
#include "Utility\WindowMessageHandler.h"
|
||||
|
||||
bool WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
// Containers
|
||||
BlitzList_OnProcessAttach();
|
||||
|
||||
// Math
|
||||
|
||||
// Database
|
||||
SQLite3_OnProcessAttach();
|
||||
|
||||
// Utility
|
||||
Display_OnProcessAttach();
|
||||
WindowMessageHandler_OnProcessAttach();
|
||||
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
// Containers
|
||||
BlitzList_OnProcessDetach();
|
||||
|
||||
// Math
|
||||
|
||||
// Database
|
||||
SQLite3_OnProcessDetach();
|
||||
|
||||
// Utility
|
||||
Display_OnProcessDetach();
|
||||
WindowMessageHandler_OnProcessDetach();
|
||||
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
Reference in New Issue
Block a user