Comments (9)
Thanks, that's great. It's possible to merge 2 repositories keeping the commits history, I can do that on a separate branch. You'll appear as a contributor and all of your commits will be there.
Can't promise anything, but I'll try to look into it this week. I'll create a separate issue for that.
from ktx.
After a quick look, I think you're overusing field delegation and Box2D class wrappers.
For example, you can add body
method as an extension of World
:
fun World.body(init: (@Box2dDsl FixtureDef).() -> Unit) {
}
This wouldn't force the users to wrap and unwrap Box2D classes with your DSL objects.
You overuse delegation mechanism:
var type: BodyDef.BodyType by object {
operator fun getValue(bodyDefDsl: BodyDefDsl, property: KProperty<*>): BodyDef.BodyType = bodyDef.type
operator fun setValue(bodyDefDsl: BodyDefDsl, property: KProperty<*>, type: BodyDef.BodyType) {
bodyDef.type = type
}
}
// Equivalent to:
var type: BodyDef.BodyType
get() = bodyDef.type
set(value) {
bodyDef.type = value
}
If you browse through the current ktx-style
module sources, you can see that type-safe builders with @DslMarker
can be successfully used on classes that aren't yours. I think this approach is generally more convenient for the library users.
from ktx.
Tests written in KotlinTest cannot be run individually. You can run individual test suite, not but an individual test. It's not that tedious, since most KTX tests take milliseconds to run, but it's certainly a step backwards from JUnit. I think using JUnit with Kotlin backticks to name test methods, Mockito-Kotlin for mocks and KotlinTest assertions is optimal for now.
from ktx.
Did you consider using Spek? It's more idiomatic to Kotlin than JUnit, and with the spek-idea-plugin you are able to run each test individually.
from ktx.
I've seen this framework a while back and dismissed it for some reason. I think it required a lot of extra setup and JUnit 5 usage. I'll look into it again, thanks.
Anyway, Box2D utilities is something I was planning on eventually adding to KTX - and I really don't like reinventing the wheel. Would you consider merging your gdx-box2d-kotlin
repository with KTX as an additional ktx-box2d
module? I'd have to review the code first and might end up refactoring some stuff, but the README example is promising and looks pretty much like idiomatic Kotlin builder API.
from ktx.
Sure, I'd be more than happy to contribute gdx-box2d-kotlin
- I could prepare a PR and let you review and refactor the code that way? (or if you just want to dive in and grab what you want, I'm ok with that too)
from ktx.
from ktx.
Nice suggestions - I'll probably make those changes if I have time this week.
from ktx.
We've included Mockito 2 with Kotlin utilities and KotlinTest (mostly used for its assertions). I've improved readability of tests in most modules: replaced camelCaseMethodNames
with human-readable Kotlin backticks method names, removed unnecessary assertions, visually separated preparation, invocation and testing phases (given, when, then) and removed some unnecessary comments. I'm satisfied with the current state of KTX tests, so I'm closing this issue.
Anyway, I haven't touched ktx-vis
, but its tests are mostly fine. @kotcrab - you can look into that if you've got some spare time, but it's not a priority. ;)
from ktx.
Related Issues (20)
- Update to Kotlin 1.8.0
- Release KTX 1.11.0-rc4 HOT 1
- AssetStorage fails to load assets on older Android devices due to unsupported ConcurrentHashMap APIs usage HOT 1
- Update to Kotlin 1.8.10
- Release KTX 1.11.0-rc5
- gdxAI module HOT 1
- Update core dependencies
- Release KTX 1.11.0-rc6
- Update to libGDX 1.12.0
- Release KTX 1.12.0-rc1
- Update to Kotlin 1.9.0
- Build error for android in ktx-sample-project HOT 1
- Update libGDX to 1.12.1
- Update Kotlin to 1.9.20
- Update to VisUI 1.5.3
- Utilities for Vector4
- Release KTX 1.12.1-rc1
- KTX pool's discard logic is inconsistent with the original Pool.discard(T) HOT 2
- Update Kotlin to 1.9.22
- Question about new additions HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ktx.