Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
9eecab1
пусто
kornerr Jun 20, 2026
2d6726d
add hello list stub
kornerr Jun 21, 2026
42f5bd7
create stub hello list
kornerr Jun 21, 2026
798b48e
append
kornerr Jun 22, 2026
483b999
kd 3.2
kornerr Jun 22, 2026
7ea99dd
display items
kornerr Jun 22, 2026
a8012c8
stub mac
kornerr Jun 23, 2026
3a62c8d
rootE
kornerr Jun 23, 2026
1208e51
Item cpp stub
kornerr Jun 23, 2026
1a20387
make stub arr
kornerr Jun 24, 2026
3d9cd61
conv
kornerr Jun 24, 2026
4d51ea8
get sizw
kornerr Jun 24, 2026
c383dab
print items
kornerr Jun 24, 2026
65d13d2
displauy items
kornerr Jun 24, 2026
1432dac
populate ui with item titles
kornerr Jun 24, 2026
0f5b87d
somewhere
kornerr Jun 26, 2026
8bfe0e7
closer
kornerr Jun 26, 2026
cb25c49
switch to kd cpparr branch
kornerr Jun 27, 2026
521a48f
rm dup
kornerr Jun 27, 2026
7c733d8
correct up
kornerr Jun 27, 2026
e2ece54
gen items field
kornerr Jun 27, 2026
5e3efb9
move Items ctor to h
kornerr Jun 28, 2026
dd9c942
gen Items
kornerr Jun 29, 2026
425dae6
clarify
kornerr Jun 29, 2026
d2f66c1
gen Item hdr
kornerr Jul 4, 2026
b405e33
clarfiy
kornerr Jul 5, 2026
ab3dbe7
gen elem src
kornerr Jul 5, 2026
b161a83
clarify
kornerr Jul 6, 2026
a4dfc64
better list ui
kornerr Jul 6, 2026
54ef5e7
root view item
kornerr Jul 6, 2026
71a57f7
some
kornerr Jul 10, 2026
9a6f987
gemini helped
kornerr Jul 10, 2026
ef6028d
no crash
kornerr Jul 10, 2026
08e7f0f
fix any
kornerr Jul 10, 2026
827574e
more space
kornerr Jul 10, 2026
5b67a22
better bottom spacing
kornerr Jul 10, 2026
d646623
add test tags to helloworld
kornerr Jul 13, 2026
95665d7
Qt ids
kornerr Jul 15, 2026
83a39b2
create ios
kornerr Jul 15, 2026
747cf05
ios stub more
kornerr Jul 15, 2026
7989351
symlink xcf
kornerr Jul 15, 2026
5b220fa
build
kornerr Jul 15, 2026
bf9a7a7
add ids to ios
kornerr Jul 15, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ do-test*
.DS_Store
emb64.kt
.gradle
*.hprof
.idea
ignore.*
kd.kt
Expand All @@ -14,3 +15,4 @@ local.properties
ver-windows-x64/src/*.h
ver-windows-x64/src/*.cpp
ver-windows-x64/src/*.qml
*.xcodeproj
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ application looks like

* [Hello world](#hw)
* [Android](#hw_android)
* [iOS](#hw_ios)
* [Linux](#hw_linux)
* [macOS](#hw_macos)
* [Windows](#hw_windows)
* [Hello list](#hl)
* [Android](#hl_android)

<a name="hw"/>

Expand Down Expand Up @@ -72,6 +75,15 @@ Instructions:
| 5 | Open `helloworld/ver-android` project | |
| 6 | Press Run | |

<a name="hw_ios"/>

### iOS

Fill local.properties with sdk path (it's gitignored)

TODO


<a name="hw_linux"/>

### Linux
Expand Down Expand Up @@ -136,3 +148,19 @@ Instructions:
| 2 | Go to `helloworld` directory | `cd helloworld` |
| 3 | Build the application | `./util/build-windows-x64` |
| 4 | Launch the application | `./util/launch-windows-x64`|

<a name="hl"/>

## Hello list

`helloworld` example depicts how to alter text on button click

TODO Structure

<a name="hl_android"/>

### Android

TODO Video

TODO Instructions
32 changes: 32 additions & 0 deletions hellolist/components/other/android/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.opengamestudio

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.*
import androidx.compose.material3.*
import androidx.compose.ui.*
import org.opengamestudio.ui.theme.MyApplicationTheme

class MainActivity: ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
enableEdgeToEdge()

VM.androidContext = this
// Launch components once VM has Android Context
RootComponent.setup()

setContent {
MyApplicationTheme {
Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
RootView(
modifier = Modifier.padding(innerPadding),
VM
)
}
}
}
}
}
11 changes: 11 additions & 0 deletions hellolist/components/other/android/VM.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.opengamestudio

import android.content.Context
import androidx.compose.runtime.*

object VM {
var androidContext: Context? = null

var rootIsVisible = mutableStateOf(false)
var rootItems = mutableStateListOf<Item>()
}
36 changes: 36 additions & 0 deletions hellolist/components/other/desktop/App.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QQmlContext>
#include <QQuickStyle>

#include "ignore.kd.h"
#include "root.h"
#include "VM.h"

int main(int argc, char *argv[]) {
// Create Qt application
QQuickStyle::setStyle("Fusion");
QApplication app(argc, argv);
QQmlApplicationEngine engine;
QObject::connect(
&engine,
&QQmlApplicationEngine::objectCreationFailed,
&app,
[]() { QCoreApplication::exit(-1); },
Qt::QueuedConnection
);

API api;
FObj fobj;
// Create and launch components
RootComponent r;
r.setup();

// Configure and load QML
engine.rootContext()->setContextProperty("api", &api);
engine.rootContext()->setContextProperty("F", &fobj);
engine.rootContext()->setContextProperty("vm", &VM::singleton());
engine.loadFromModule("hellolist", "AppView");

return app.exec();
}
10 changes: 10 additions & 0 deletions hellolist/components/other/desktop/KT.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#ifndef HL_KT_H
#define HL_KT_H

#include "libhl_api.h"
#define KT libhl_symbols()->kotlin.root.org.opengamestudio
#define KTLibRef(NAME) libhl_kref_kotlin_##NAME
#define KTRef(NAME) libhl_kref_org_opengamestudio_##NAME
#define KTSym libhl_symbols()

#endif // HL_KT_H
49 changes: 49 additions & 0 deletions hellolist/components/other/desktop/VM.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include "KT.h"
#include "VM.h"

VM::VM() : QObject() {
_rootIsVisible = false;
}

VM::~VM() {
qDeleteAll(_rootItems);
}

bool VM::rootIsVisible() const {
return _rootIsVisible;
}

QQmlListProperty<Item> VM::rootItems() const {
return QQmlListProperty<Item>(
const_cast<VM*>(this),
nullptr,
&VM::rootItemsCount,
&VM::rootItemsAt
);
}

Item *VM::rootItemsAt(
QQmlListProperty<Item> *list,
qsizetype index
) {
auto *vm = qobject_cast<VM*>(list->object);
return vm ? vm->_rootItems.at(index) : nullptr;
}

qsizetype VM::rootItemsCount(QQmlListProperty<Item> *list) {
auto *vm = qobject_cast<VM*>(list->object);
return vm ? vm->_rootItems.size() : 0;
}

void VM::rootSetIsVisible(bool value) {
_rootIsVisible = value;
emit rootDidChangeIsVisible(value);
}

void VM::rootSetItems(QList<Item*> items) {
for (auto *item : _rootItems) {
item->deleteLater();
}
_rootItems = items;
emit rootDidChangeItems();
}
59 changes: 59 additions & 0 deletions hellolist/components/other/desktop/VM.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#ifndef HL_VM_H
#define HL_VM_H

#include <QList>
#include <QObject>
#include <QQmlListProperty>

#include "ignore.kd.h"
#include "KT.h"

class VM: public QObject {
Q_OBJECT

Q_PROPERTY(
bool rootIsVisible
READ rootIsVisible
WRITE rootSetIsVisible
NOTIFY rootDidChangeIsVisible
)

Q_PROPERTY(
QQmlListProperty<Item> rootItems
READ rootItems
NOTIFY rootDidChangeItems
)

private:
VM();

public:
VM(VM const &) = delete;
void operator=(VM const &) = delete;
virtual ~VM();
static VM &singleton() {
static VM instance;
return instance;
}

public:
bool rootIsVisible() const;

QQmlListProperty<Item> rootItems() const;
static Item *rootItemsAt(QQmlListProperty<Item> *list, qsizetype index);
static qsizetype rootItemsCount(QQmlListProperty<Item> *list);

public slots:
void rootSetIsVisible(bool value);
void rootSetItems(QList<Item*> items);

signals:
void rootDidChangeIsVisible(bool value);
void rootDidChangeItems();

private:
bool _rootIsVisible;
QList<Item*> _rootItems;
};

#endif // HL_VM_H
15 changes: 15 additions & 0 deletions hellolist/components/other/desktop/view/AppView.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import QtQuick
import QtQuick.Controls
import hellolist

Window {
height: 480
id: wnd
title: qsTr("Hello List")
visible: true
width: 640

RootView {
anchors.fill: parent
}
}
51 changes: 51 additions & 0 deletions hellolist/components/other/sdk/other.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package org.opengamestudio

// TODO Generate for Item
fun anyAsItem(item: Any?) = item as Item

// Debug representation of a value
fun debugString(v: Any): String {
// Prepend a string with its length
if (v is String) {
return "S(${v.length})$v"
}

// Prepend an array with its size
if (v is Array<*>) {
var out = ""
for (item in v) {
if (!out.isEmpty()) {
out += ","
}
out += debugString(item!!)
}
return "A(${v.size})$out"
}

// Prepend a dictionary with its size
if (v is Map<*, *>) {
var out = ""
for ((key, value) in v) {
if (!out.isEmpty()) {
out += ","
}
out += debugString(key!!) + ":" + debugString(value!!)
}
return "D(${v.size})$out"
}

// Otherwise just print by default
return "$v"
}

// Print each key/value processed by a component into console
fun setupComponentDebugging(
ctrl: KDController,
prefix: String
) {
ctrl.registerCallback { c ->
val anyval = c.fieldAny(c.recentField)
val strval = debugString(anyval)
println("ИГР $prefix k/v: '${c.recentField}'/'$strval'")
}
}
18 changes: 18 additions & 0 deletions hellolist/components/root/android/root.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.opengamestudio

typealias RC = RootContext

object RootComponent {
init {
val vm = VM
val oneliners = arrayOf(
F.isVisible, { c: RC -> vm.rootIsVisible.value = c.isVisible },
F.items, { c: RC -> rootResetItems(vm, c.items) },
)
registerOneliners(rootCtrl(), oneliners)
}

fun setup() {
rootSet(F.didSetup, true)
}
}
9 changes: 9 additions & 0 deletions hellolist/components/root/android/rootEffect.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.opengamestudio

fun rootResetItems(
vm: VM,
items: Array<Item>
) {
vm.rootItems.clear()
vm.rootItems.addAll(items)
}
Loading