Initial commit.

This commit is contained in:
bʰedoh₂ swé 2024-02-17 16:19:53 +05:00
parent d6adec504a
commit d76e0b6327
6 changed files with 73 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
env.mk
build/
result.jar
a.jar

9
META-INF/MANIFEST.MF Normal file
View File

@ -0,0 +1,9 @@
Manifest-Version: 1.0
MIDlet-Vendor: bedohswe
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.0
MIDlet-Name: Hello
MIDlet-Description: Test MIDlet
MicroEdition-Profile: MIDP-2.0
MIDlet-1: Hello,/icon.png,com.Hello

39
Makefile Normal file
View File

@ -0,0 +1,39 @@
include env.mk
SRC = src
SRC_DIR := src
OUT_DIR := build
SRCS := $(wildcard $(SRC_DIR)/*/*.kt)
CLS := $(SRCS:$(SRC_DIR)/%.kt=$(OUT_DIR)/%.class)
KOTLINC = kotlinc
KOTLINOPT = -cp $(HEADERS) -d $(OUT_DIR) -jvm-target 1.8
.SUFFIXES: .kt
.PHONY: all clean
all: $(CLS)
$(CLS): $(OUT_DIR)/%.class: $(SRC_DIR)/%.kt
mkdir -p build
$(KOTLINC) $(KOTLINOPT) $<
rm -rf build/META-INF/
clean:
rm -rf build/
rm -f result.jar
rm -f a.jar
pack:
jar -cmf META-INF/MANIFEST.MF a.jar -C build . -C res .
translate:
$(RETROTRANSLATOR) -srcjar a.jar -destjar result.jar
run:
$(EMULATOR) result.jar

4
default.mk Normal file
View File

@ -0,0 +1,4 @@
HEADERS =
EMULATOR = java -jar
RETROTRANSLATOR = java -jar

BIN
res/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

17
src/com/Hello.kt Normal file
View File

@ -0,0 +1,17 @@
@file:JvmName("Hello")
package com
import javax.microedition.midlet.MIDlet
import javax.microedition.lcdui.TextBox
import javax.microedition.lcdui.Display
class Hello : MIDlet {
constructor() {
val display = Display.getDisplay(this)
val hello = TextBox("Hello!", "Hello Kotlin!", 256, 0)
display.setCurrent(hello)
}
override public fun startApp() {}
override public fun destroyApp(x: Boolean) {}
override public fun pauseApp() {}
}