1

I wanna create a html mini-game by using LimeJs.

For the moment i want to create an ui tests. I'm creating a chat box. I have some problems with input (DomElement) and box (CanvaElement).

I put one input and one box in a layer at the position 0;0. one of the problems i have is that the input is not at the same position as the box.

I want to drag my layer with the input and the box. If i use goog.events.listen, i can't use the textbox. How can i do this ?

Do you know any other libraries for create UI, comatible with LimeJs ?

Code:

//set main namespace
goog.provide('test_ui');

//get requirements
goog.require('lime.Director');
goog.require('lime.Scene');
goog.require('lime.Layer');


// entrypoint
test_ui.start = function() {

    var director = new lime.Director(document.body, 1024, 768);
    var scene = new lime.Scene();
    var target = new lime.Layer().setPosition(512, 384);

    scene.appendChild(target);
    director.replaceScene(scene);

    target.appendChild(test_ui.makeTest());
}

test_ui.makeTest = function() {
    var layer = new lime.Layer();
    var input = document.createElement('input'); //Text input
    input.setAttribute('style', 'position:absolute;'); //Set absolute position
    var box = new lime.Sprite().setFill('#AACCDD').setPosition(0, 0).setSize(400, 300);     //Box


    layer.appendChild(box);
    layer.appendChild(input);

    goog.events.listen(layer, ['mousedown'], function(e) {
            e.startDrag(false);
    });
    return layer;
}

goog.exportSymbol('test_ui.start', test_ui.start);

Sancho
  • 1,288
  • 2
  • 25
  • 50

0 Answers0