mirror of
https://codeberg.org/Kenta/KaylibKit.git
synced 2024-09-19 11:50:22 -06:00
Add text manipulation functions, update library paths
This commit is contained in:
parent
c6992fc960
commit
8148c1e86b
2 changed files with 53 additions and 4 deletions
|
@ -153,8 +153,57 @@ inline fun drawText(font: Font, codepoint: IntVar, count: Int, position: Vector2
|
|||
// TEXT FONT INFO FUNCTIONS
|
||||
//=======================================================//
|
||||
|
||||
/**
|
||||
* Get text length, checks for '\0' ending
|
||||
* Recommend using Kotlin means of finding this out
|
||||
* @return [UInt]
|
||||
*/
|
||||
inline fun textLength(text: String) : UInt {
|
||||
return TextLength(text)
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a piece of a text string
|
||||
* Recommend using Kotlin standard lib to do this
|
||||
* @return [String]
|
||||
*/
|
||||
@OptIn(ExperimentalForeignApi::class)
|
||||
inline fun textSubtext(text: String, position: Int, length: Int) : String {
|
||||
return TextSubtext(text, position, length)?.toKString() ?: "Error: Unable to return String"
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace text string
|
||||
* Recommend using Kotlin standard lib to do this
|
||||
* @return [String]
|
||||
*/
|
||||
@OptIn(ExperimentalForeignApi::class)
|
||||
inline fun textReplace(text: String, replace: String, by: String) : String {
|
||||
memScoped { return TextReplace(text.cstr.getPointer(MemScope()), replace, by)?.toKString() ?: "Error: Unable to return String" }
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert text in a position
|
||||
* Recommend using Kotlin standard lib to do this
|
||||
* @return [String]
|
||||
*/
|
||||
@OptIn(ExperimentalForeignApi::class)
|
||||
inline fun textInsert(text: String, insert: String, position: Int) : String {
|
||||
memScoped { return TextInsert(text, insert, position)?.getPointer(this)?.toKString() ?: "Error: Unable to return String" }
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if two text string are equal
|
||||
* Recommend using Kotlin means of finding this out
|
||||
* @return [Boolean]
|
||||
*/
|
||||
inline fun textIsEqual(text1: String, text2: String) : Boolean {
|
||||
return TextIsEqual(text1, text2)
|
||||
}
|
||||
|
||||
/**
|
||||
* Measure string width for default [Font]
|
||||
* Recommend using Kotlin standard lib to do this
|
||||
* @return [Int]
|
||||
*/
|
||||
inline fun measureText(text: String, fontSize: Int) : Int {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
headers = raylib.h raymath.h rcamera.h
|
||||
package = kaylibc
|
||||
staticLibraries = libraylib.a
|
||||
libraryPaths.osx = src/nativeInterop/cinterop/lib/osx
|
||||
libraryPaths.linux = src/nativeInterop/cinterop/lib/linux
|
||||
libraryPaths.mingw = src/nativeInterop/cinterop/lib/mingw
|
||||
libraryPaths.osx = src/nativeInterop/cinterop/lib/osx/
|
||||
libraryPaths.linux = src/nativeInterop/cinterop/lib/linux/
|
||||
libraryPaths.mingw = src/nativeInterop/cinterop/lib/mingw/
|
||||
|
||||
compilerOpts = -Isrc/nativeInterop/cinterop/include
|
||||
compilerOpts = -Isrc/nativeInterop/cinterop/include/
|
||||
linkerOpts.mingw = -lwinmm -lgdi32 -lopengl32 -lkernel32
|
||||
linkerOpts.osx = -framework CoreVideo -framework IOKit -framework Cocoa -framework GLUT -framework OpenGL
|
||||
|
||||
|
|
Loading…
Reference in a new issue