Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: how to use jaws.Text? #111

Open
belen-albeza opened this issue Jan 3, 2014 · 2 comments
Open

Question: how to use jaws.Text? #111

belen-albeza opened this issue Jan 3, 2014 · 2 comments

Comments

@belen-albeza
Copy link
Contributor

I'm trying to use jaws.Text, but I cannot make it work and cannot find any example on how to use it :(

Here's what I've tried so far (here's the jsfiddle)

var text;

function setup() {
    text = new jaws.Text({text: "Hello World", x: 10, y:10});
}

function draw() {
    jaws.clear();
    text.draw();
}

jaws.start();

What am I doing wrong? Thanks! :)

@ippa
Copy link
Owner

ippa commented Jan 3, 2014

Added a jaws.Text to example9, seems to work: http://jawsjs.com/jawsjs/examples/example9.html

@Devanon
Copy link

Devanon commented Feb 14, 2014

I've got some problems trying to center a Text element in the canvas.

This next line doesn't seem to work, and I think it is valid code:
scoreboard = new jaws.Text({text: 'example', x: jaws.width/2, y: jaws.height/2, anchor: 'center'});

The solution was to avoid the use of the anchor tag (Text defaults it to 'top_left'), and center it manually hard coding the x value. Setting the value of y to 'jaws.height/2' worked.

I am not sure if there is a problem in jaws.Text or I am not using it correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants