so I am trying to create Qt's qml, but from scratch. for learning purposes but also I think it would be cool if it was an option to use qml without Qt
This is the qml, that produces this output:
Item {
    Rectangle {
        x: red.x - 5
        y: red.y - 5
        width: 150
        height: 100
        color: "#333"
    }
    Rectangle {
        id: red
        x: 55
        y: 55
        width: 150
        height: 100
        color: "#a22"
        MouseArea {
            id: red_mouse_area
            x: red.x
            y: red.y
            width: red.width
            height: red.height
        }
    }
    Text {
        text: "Hello World!"
        x: red.x
        y: red.y - height - 5
        height: 15
    }
}
the c code only sets the red rectangle's location, the others follow automatically because the qml tells them to do so 😄
void an_event_happened(void* user_data, struct event_t e) { struct app_state_t* app_state = (struct app_state_t*)user_data; size_t red = engine_get_object_by_id(lol_engine(app_state->lol), "red"); int64_t red_w = engine_object_width(lol_engine(app_state->lol), red); int64_t red_h = engine_object_height(lol_engine(app_state->lol), red); engine_object_set_x(lol_engine(app_state->lol), red, e.mouse_x - red_w/2); engine_object_set_y(lol_engine(app_state->lol), red, e.mouse_y - red_h/2); }
