Commit Graph

684 Commits

Author SHA1 Message Date
halx99 ff24bdf192 Optimize macro posix_fsetsize, use ',' is better [ci build] 2021-04-26 17:02:28 +08:00
rh101 0583f9a4e0 Get the raw pointer on creation of the FileStream to avoid any accidental usage of the unique_ptr. 2021-04-26 17:31:34 +10:00
rh101 13115cc789 Let the OGG function overrides handle freeing memory of the FileStream pointer. 2021-04-26 17:30:18 +10:00
rh101 3281c7349a Clear unique_ptr with reset(). 2021-04-26 15:46:59 +10:00
rh101 b923b1a678 Use reset() to clear unique_ptr.
Use value initialization for unique_ptr.
Change AudioDecoderOgg override functions to use FileStream* instead of unique_ptr.
Remove redundant code.
2021-04-26 15:43:33 +10:00
rh101 668e96cadd Use unique_ptr for FileUtils::openFileStream
Fix OGG audio playback due to incorrect tell() method
Fix unzip close() override method not deleting FileStream pointer.
2021-04-26 14:21:56 +10:00
rh101 23301e563e Minor code clean-up 2021-04-26 10:45:55 +10:00
RH ba6f6dfcfa Merge: 85c5705f48 ce6117fa65
Merge branch 'master' into vfs-support
2021-04-26 10:40:16 +10:00
RH 5b168e3bb6 Merge: 03bb24f313 85c5705f48
Merge branch 'vfs-support' into master
2021-04-26 10:39:09 +10:00
RH 0e2247a2d9 Merge: d1027ab263 ce6117fa65
Merge pull request #7 from c4games/master

Sync with primary
2021-04-26 10:32:25 +10:00
rh101 ff60724c9e Return error value in FileUtils::getContents if size result is an unexpected value. 2021-04-26 10:29:29 +10:00
rh101 833f27f499 Ensure code uses FileStream::tell() to get size if required after using FileStream::seek(0, SET_END) 2021-04-26 10:28:33 +10:00
rh101 e6990d0b36 Remove unnecessary method call to close FileStream 2021-04-26 08:55:07 +10:00
halx99 be9bd61131 Fix tool script cocos 2021-04-25 09:22:07 -07:00
rh101 4745016bc2 Use FileStream instead of fopen to check if file can be opened in read mode 2021-04-26 01:44:50 +10:00
rh101 3eb42e00c7 Convert return value to what is expected by FileStream::seek 2021-04-26 01:37:15 +10:00
rh101 fa4ed8a975 Initialise member variable 2021-04-26 01:05:06 +10:00
halx99 87be236932 Merge: 8b8b015b02 b1da56d401
Merge pull request #343 from rh101/curl-fix-filestream

Fix for downloader crash due to uninitialised variables
2021-04-25 18:34:29 +08:00
rh101 5509d0f80d Update usage of createDownloadFileTask 2021-04-25 18:36:20 +10:00
rh101 abb27ce2f3 Fix downloader crash due to uninitialised variables. 2021-04-25 18:20:25 +10:00
RH c8c4c2d703 Merge: 6fbebe9617 8b8b015b02
Merge pull request #6 from c4games/master

Sync with primary
2021-04-25 18:14:50 +10:00
rh101 c26a5e7bd8 Ensure FileStream is used for file access where possible 2021-04-25 17:22:43 +10:00
halx99 964e515f48 Merge: 2a1459b27b 3d8884721f
Merge pull request #341 from rh101/vfs-support

Add support for FileStream in ZipUtils and ZipFile
2021-04-25 14:21:19 +08:00
rh101 0867aa48a9 Add function comments to detail the expected parameters and return values of a FileStream 2021-04-25 15:27:25 +10:00
rh101 5cc21f52ba Removed incorrect delete statement 2021-04-25 14:42:42 +10:00
rh101 3dbdd7b5ee Verify the amount of string space we have to replace the zip extension 2021-04-25 12:15:56 +10:00
rh101 8703cad209 Initialise member variable 2021-04-25 02:47:21 +10:00
rh101 84be1fa014 Minor code cleanup 2021-04-25 02:45:04 +10:00
rh101 a819f310b2 Removed redundant code 2021-04-25 02:43:03 +10:00
rh101 cce67f688e Add support for FileStream in ZipUtils and ZipFile 2021-04-25 02:39:47 +10:00
halx99 da1038b147 Fix crash from pr: #340 2021-04-24 18:15:54 +08:00
halx99 5484825229 Fix indent with clang-format [ci build] 2021-04-24 16:58:41 +08:00
rh101 155fe98406 openFileStream now returns a nullptr if it fails 2021-04-24 09:22:27 +10:00
rh101 e1ce966be2 Remove redundant std::move 2021-04-23 22:00:33 +10:00
rh101 6502627714 Added getNativeWritableAbsolutePath() which will always return the underlying file system raw path.
Re-enabled memory mapped UserDefault usage, since it now has access to the raw file system path.
2021-04-23 01:00:00 +10:00
rh101 95cf5b5c2b Merge: 2aa2d69151 b7506fed0c
Merge branch 'vfs-support' of https://github.com/rh101/engine-x into vfs-support
2021-04-23 00:01:47 +10:00
rh101 54ffa13dff Move PosixFileStream class to its own files
Update UserDefault to work with FileStream
Fix undefined openFileStream on platforms other than Win32
2021-04-23 00:01:32 +10:00
RH dd5f77c3d5 Merge: 15c8f2298d 0886473e1b
Merge pull request #4 from rh101/master

Sync with master
2021-04-22 21:49:43 +10:00
RH 1e15ed4839 Merge: 2cef9f2e76 844119d162
Merge pull request #3 from c4games/master

Sync with master
2021-04-22 21:48:49 +10:00
rh101 7540c06fd3 Use FileStream to write JPG images to disk 2021-04-22 21:36:26 +10:00
halx99 6effb1642f Fix #339 [ci build] 2021-04-22 18:55:56 +08:00
halx99 8ed6d34234 Explicit set cmake minimum version at app/build.gradle [ci build] 2021-04-22 11:40:53 +08:00
rh101 57e2d5dea8 Fixed typo 2021-04-22 03:18:23 +10:00
rh101 2bf12b2226 Add support for virtual file system via custom FileStream and FileUtils implementations. 2021-04-22 03:15:49 +10:00
halx99 473e51cee7 Set cmake min version to 3.10 [ci build] 2021-04-21 14:05:44 +08:00
halx99 4f0f713977 Merge: 6a868299f5 9aebfd4b0d
Merge pull request #331 from c4games/cmake-improve

Improve cmake scripts
2021-03-13 18:46:32 +08:00
halx99 b8892e446b Merge: 91bfb7c8ff a5cf017e0f
Merge pull request #330 from c4games/lua54-compat

Lua 5.4 compatible
2021-03-13 18:46:13 +08:00
halx99 d7610b8c77 Improve cmake scripts
a. rename project 'plainluac' to 'luac'
b. add executable project 'lua'
c. unify cmake runtime directory to bin
2021-03-13 18:18:40 +08:00
halx99 fce0f9caf0 Refine director access [ci build] 2021-02-05 23:09:14 +08:00
halx99 6904b9f3f3 Fix depth stencil state/desc (#321)
* Fix ds state

* fix 3d object not render

* Update DepthStencilStateGL.cpp

* fix ds, not complete

* fix image ref incorrect

* Fix metal captureScreen

* Share ds desc
needs restore properly after non-default render target destroy.

* fix gl compile

* Sync ds desc

* Only set vertex & index buffer once for batch draw

* Add set/get ds desc for renderer

* Refine code style

* Fix RenderTextureTest
a. should restore stencil desc properly

* Sync gl captureNode

* Sync GL
2021-01-31 22:22:52 +08:00
halx99 472266c25c Fix #318 2021-01-27 12:03:42 +08:00
halx99 53bbf7368c Fix warnings 2021-01-26 19:00:04 +08:00
halx99 03e130a19f Revert "Fix #313" 2021-01-21 12:41:01 +08:00
halx99 be79c908c5 Fix ParticleBatchNode texture not bind [ci build] 2021-01-19 23:53:22 +08:00
halx99 734602069e Fix #313
a. error: depthAttachment PixelFormat (MTLPixelFormatInvalid) and stencilAttachment PixelFormat (MTLPixelFormat Depth32Float_Stencil8) must match.
b. Because we only support D24S8(D32FS8) combined format, so needs check
TargetBuffferFlags::DEPTH_AND_STENCIL when setup depth and stencil
format, otherwise newRenderPipelineWithDescriptor will crash.
2021-01-16 00:01:21 +08:00
halx99 984c164c57 Sync yasio to 3.35.0 [ci build] 2020-12-21 18:12:13 +08:00
aismann f38b271650 Update controller.cpp
"Node: Physics" using Chipmunk2D (hardcoded on e.g.: CCPhysicsBody.cpp)

Maybe a Wiki entry is also usefull?
2020-12-20 07:11:13 +01:00
halx99 3ebb1f57c0 Fix next drawable maybe nil crash[ci build] (#310) 2020-12-17 15:31:16 +08:00
halx99 b92c3d30c4 Update lua bindings source [ci build]
cxx17::string_view support
2020-12-16 17:52:17 +08:00
halx99 86e0340b9d Sync yasio [ci build] 2020-12-15 18:58:04 +08:00
halx99 3a49f0e064 Merge: c3ad19df96 c95e0466e1
Merge pull request #308 from c4games/refactor-android-run-on-gl-thread

Refactor android runOnGLThread
2020-12-10 16:56:14 +08:00
halx99 78aaf568c6 fix FUISprite gray to normal doesn't work 2020-12-10 16:54:59 +08:00
halx99 ca4597a1ff Refactor android runOnGLThread
Ensure the callback run engine core mainLoop,
This commit can solve any weird behaviors, such as:
a. text render maybe missing charactors when bring from back to frontend
b. some renderer objects alpha may present black at sdk callback call
c. some other things
All above behavior is caused gl state not ready when go back to game activity from sdk activity
2020-12-09 15:13:57 +08:00
halx99 04db04ad93 Merge: 3f4178cc27 dbf81d7511
Merge pull request #295 from aismann/master

CCPhysicsSprite(Box2D/Chipmunk2D) cleanup, some other small improvements...
2020-12-02 08:39:58 -08:00
halx99 571adc605a fix ci 2020-12-02 03:33:53 -08:00
halx99 8b9d5db029 Unify CC_COMPAT_GL to control renderer backend
win32: google angle
mac: NSGL
ios: GLES
2020-12-02 03:03:05 -08:00
aismann 73b2b175d9 CCPhysicsSprite(Box2D/Chipmunk2D) cleanup, some other small improvements too
CCPhysicsSprite(Box2D/Chipmunk2D) cleanup and small improvements on PhysicsTest
2020-12-01 16:39:28 +01:00
halx99 43f5a305c8 Merge: 079ecdbbec 5e249bf6f8
Merge pull request #293 from aismann/master

Chipmunk2D and Box2D works together now (add two new classes) and FIX  ImGuiEXTTest window size problem
2020-12-01 01:52:47 -08:00
aismann 18cc4a9eb4 Update README.md
change wiki link:  https://github.com/c4games/engine-x-wiki
2020-12-01 10:32:09 +01:00
aismann 91843b3fae Chipmunk2D and Box2D works together now (add two new classes)
add class PhysicsSpriteChipmunk2D
add class PhysicsSpriteBox2D

Improve window size problem with ImGuiEXTTest
2020-12-01 10:15:30 +01:00
halx99 315e42b126 Merge: 4c1ff6bd01 369bef3614
Merge pull request #286 from rh101/add-center-vertical-layout-support

Add support for center vertical layout
2020-11-26 23:43:25 -08:00
halx99 cc7366845e Merge: 74add84559 f113e1f2ed
Merge pull request #285 from rh101/fix-listview-dimensions

Fix ListView dimensions when child elements are scaled
2020-11-26 23:08:30 -08:00
halx99 bcb96e66ee Merge: 289bc4fccc ee996a5cfb
Merge pull request #282 from rh101/fix-editbox-globalz

Ensure global Z is correctly set on all child items of EditBox
2020-11-26 23:00:14 -08:00
rh101 220ef7a6bf Allow user to set custom program type value 2020-11-27 17:26:02 +11:00
rh101 11e78b27c0 Add support for center vertical layout 2020-11-27 17:24:07 +11:00
rh101 25bf822fb8 Fix ListView dimensions when child elements are scaled. 2020-11-27 17:02:31 +11:00
rh101 35e57843c8 Ensure global Z is correctly set on all child items of EditBox 2020-11-27 16:59:34 +11:00
halx99 cf24cf3a36 Sync yasio to 3.33.4 [ci build] 2020-11-25 19:07:21 +08:00
halx99 1353c00758 Sync pr: https://github.com/cocos2d/cocos2d-x/pull/20614 2020-11-24 18:10:28 +08:00
halx99 3f0d17b520 Merge: a10d7701b8 a606572775
Merge pull request #277 from aismann/master

Update cocos.bat
2020-11-23 01:27:53 -08:00
Eismann 381189f726 Update cocos.bat 2020-11-23 09:55:07 +01:00
halx99 a300b75a2f Merge: 0d04e20b50 eee60b9d99
Merge pull request #276 from aismann/master

Same as on 3.17 (with small changes)
2020-11-22 23:43:18 -08:00
Eismann b51545ac54 Same as on 3.17 (with small changes) 2020-11-23 07:46:09 +01:00
halx99 7122b5043a fix metal znear range for viewport
https://developer.apple.com/documentation/metal/mtlrendercommandencoder/1515527-setviewport?language=objc
2020-11-23 09:30:51 +08:00
halx99 a842beee1f Refine jni param types 2020-11-18 18:19:14 +08:00
halx99 349e435937 jni match natvie API param types 2020-11-18 18:17:55 +08:00
halx99 dd5f706dff Refine jni methods decls [ci build] 2020-11-18 13:25:00 +08:00
halx99 09e2615e51 Add missing param JNIEnv* for natvie interfaces [ci build] 2020-11-18 12:15:48 +08:00
halx99 d1fc9712b4 fix UserDefault plain mode stack overflow 2020-11-17 19:50:58 +08:00
halx99 b341aa31da fix ci warnings 2020-11-15 21:34:53 -08:00
halx99 1ec908d4f9 fix #260 [ci build] 2020-11-16 12:21:27 +08:00
halx99 1c1c8520b1 Delete unused buitin shaders 2020-11-16 11:20:12 +08:00
halx99 bcacf9137e Refine UserDefault comment [ci build] 2020-11-15 13:13:24 +08:00
halx99 9e3ad89089 Update CCUserDefault.cpp 2020-11-15 13:11:53 +08:00
halx99 772e57ef67 Update CCUserDefault.cpp 2020-11-15 13:08:21 +08:00
halx99 c3401087d2 Refine UserDefault comment 2020-11-15 12:26:40 +08:00
halx99 ff662dfffc Refine user default comment 2020-11-15 12:16:54 +08:00
halx99 c727d692a8 fix UserDefault doesn't work with encrypt enabled [ci build] 2020-11-15 11:45:14 +08:00
halx99 133f942a6b fix compile and improve Physics3DConstraint management [ci build] 2020-11-15 00:48:53 +08:00
halx99 fa47ae5f5a Update config.json [ci build] 2020-11-14 13:32:51 +08:00
halx99 4a1bebd3e6 plain include xxhash.h 2020-11-14 12:22:51 +08:00
halx99 74133ec753 Add missing JNIEXPORT 2020-11-13 23:03:05 +08:00
Born.Xiao 6a1b561d7e Update CCUserDefault.cpp
write with variable  size,  calculate size use int32_t
2020-11-12 00:32:33 +08:00
halx99 b2d8a4626c Sets box2d as default physics 2d engine 2020-11-08 13:20:36 +08:00
halx99 052558e83d Merge: 5da2894e1b f80a6ef25c
Merge branch 'master' of https://github.com/c4games/engine-x into master
2020-11-08 13:12:06 +08:00
halx99 c98313ac4b Prepre for box2d-2.4.1 2020-11-08 13:11:40 +08:00
halx99 6c09438b38 Add cmake option -DLUA_ENGINE=luajit to switch lua engine to luajit [ci build] 2020-11-07 10:36:22 +08:00
halx99 73380fb4eb Update comment 2020-11-06 09:33:26 +08:00
halx99 17e1ddae83 [Metal] matching depth stencil state 2020-11-06 08:56:25 +08:00
halx99 fcaee3f0f9 fix #255 [ci build] 2020-11-05 22:51:33 +08:00
halx99 fefb5f27fb fix #255 [ci build] 2020-11-05 22:24:30 +08:00
halx99 5134ed69f0 Remove unused shader files [ci build] 2020-11-04 16:35:12 +08:00
halx99 d76e592ca9 fixup [ci build] 2020-11-03 12:41:23 +08:00
halx99 47603f0ac6 Now, the lua binding generator should works [ci build] 2020-11-02 16:47:33 +08:00
halx99 a7e03fa49f For scripting binding happy 2020-11-02 16:35:31 +08:00
halx99 60a6d97d86 Remove Sprite::updateShaders [ci build] 2020-10-31 20:08:32 +08:00
halx99 49b948af28 Improve memory use 2020-10-29 19:13:36 +08:00
halx99 09d1fffac7 fix userdefault getBoolForKey incorrect 2020-10-27 17:27:52 +08:00
halx99 4c05ca5004 fix compile 2020-10-27 17:01:03 +08:00
halx99 a060ef3bcb Use DeviceGL to store defaultFBO 2020-10-27 16:58:37 +08:00
halx99 ab7173e61e GLES ios compile 2020-10-27 01:42:05 -07:00
halx99 2a4beb3ca4 DNT printmat by default 2020-10-27 11:21:03 +08:00
halx99 a2fcdb67a1 Sprite::setTexture, programType >= ProgramType::HSV needs update by user manually. 2020-10-27 11:14:36 +08:00
halx99 8a8d96e8d4 Refine DrawNode, should not use Node::_programState for private use (#251)
The follow classes should not reuse Node::_programState, otherwise needs override Node::setProgramState to update programState of pipelineDescriptor:
- DrawNode
- LayerColor
- LayerRadialGradient
- ParticleBatchNode
- ParticleSystemQuad
2020-10-26 14:49:14 +08:00
halx99 e58041bd46 Don't update sprite shader when it's not default 2020-10-26 13:08:02 +08:00
halx99 f49cb01e1e Finish #244 2020-10-25 16:25:08 +08:00
halx99 534b2acc39 Lock name 2020-10-24 21:57:36 +08:00
halx99 97b283bc94 Optimize includes 2020-10-23 16:40:51 +08:00
halx99 fe76c658b0 fix android build 2020-10-23 16:36:24 +08:00
halx99 22bd64cd27 Support specific manually and more clearly comment 2020-10-23 15:27:03 +08:00
halx99 0830fe9c14 Only needs updateUniformID when set a unstable uniform variable 2020-10-23 15:07:18 +08:00
halx99 ad98ef54b0 Add setUniformID manually for user to avoid calculate uniformID with uniform buffer automatically 2020-10-23 12:39:30 +08:00
halx99 4f36b1bbe9 Remove default constructor of ProgramState 2020-10-23 12:17:36 +08:00
halx99 083b99112b Since we have uniformID, CUSTOM_PROGRAM also can batch 2020-10-23 12:07:37 +08:00
halx99 e4d8e60c0b Since v4, no needs callback uniform, so mark setCallbackUniform deprecated 2020-10-23 11:57:17 +08:00
halx99 119479b060 Refine ProgramState mat id 2020-10-23 11:37:52 +08:00
halx99 4394b94c31 Simply skip batch for custom program, see #245 2020-10-23 10:26:45 +08:00
halx99 b8a0e0a478 Finsih rename 2020-10-22 10:58:10 +08:00
halx99 ac21c27140 Build pugixml from sources for all platforms (#241) 2020-10-21 12:28:34 +08:00
halx99 03527fd45b Fix CCFileStream write bits
make it behavior same with fopen "wb"
2020-10-21 10:58:48 +08:00
halx99 77e48ddca6 Remove unused converter functions 2020-10-21 00:35:39 +08:00
halx99 4048395cdb Refine pixel format
a. make RGB565, RGB5A1 identical between GL and MTL backend
b. make texture internal format compatible on GLES-2.0 ONLY GPU devices
2020-10-20 23:27:20 +08:00
halx99 630a452d01 fix rgba4444 enum for gles-2.0 only GPU 2020-10-20 20:01:18 +08:00
halx99 3d27b9615c GLES compatible 2020-10-20 19:50:34 +08:00
halx99 212148dc56 Remove unused varaibles 2020-10-20 19:38:33 +08:00
halx99 f1be86ee7a fix lua build on android 2020-10-19 19:56:48 +08:00
halx99 3741bbd7e2 Finish cpp and lua template to use env var 'COCOS2DX_ROOT' to avoid copy whole engine source when new project. 2020-10-19 18:33:10 +08:00
halx99 dcf3dbe9e6 mini changes 2020-10-18 21:43:51 +08:00
halx99 b9c58a8420 Refactor modules (#238) 2020-10-17 16:32:16 +08:00
halx99 5401bbf821 Simplfy hsv color 2020-10-16 17:23:29 +08:00