Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Munchor

Pages: 1 ... 11 12 [13] 14 15 ... 424
181
Web Programming and Design / Re: onmousemove and onmousedown
« on: October 04, 2011, 09:22:49 am »
Code: [Select]
var drawingCanvas = document.getElementById('mycanvas');

if (drawingCanvas.getContext)
{
  var context = drawingCanvas.getContext('2d');
}

function main()
{
 
}

function checkmouse(event)
{
  window.onmousedown = mousedown;
  window.onmousemove = mousemove;

  function mousemove()
  {
    return false;
  }

  function mousedown()
  {
    var x = event.clientX - drawingCanvas.offsetLeft;
    var y = event.clientY - drawingCanvas.offsetTop;

    context.fillRect(x, y, 5, 5);
  }
}

I am now returning false on mouse move, but it still doesn't work smoothly. I will check your link right away.

182
Web Programming and Design / Re: onmousemove and onmousedown
« on: October 03, 2011, 04:43:11 pm »
Code: [Select]
function checkmouse(event)
{
  window.onmousedown = mousedown;

  function mousedown()
  {
    var x = event.clientX - drawingCanvas.offsetLeft;
    var y = event.clientY - drawingCanvas.offsetTop;

    context.fillRect(x, y, 5, 5);
    return false;
  }
}

I tried that, I didn't know I had to return false; in order to cancel events when overriding them. However, this didn't work. Thanks!

183
Web Programming and Design / Re: onmousemove and onmousedown
« on: October 03, 2011, 03:41:25 pm »
Yes, but when do I check if it's up or down?

window.onmousemove

You could try defining both window.onmousedown and and then defining window.onmousemove as well.

Code: [Select]
function checkmouse(event)
{
  window.onmousedown = mousedown;

  function mousedown()
  {
    var x = event.clientX - drawingCanvas.offsetLeft;
    var y = event.clientY - drawingCanvas.offsetTop;

    context.fillRect(x, y, 5, 5);
  }
}

I changed to this, it works, but there's an issue. I'm trying to make a mini drawing application, so I need it to work like MS Paint, when the mouse is down and moving it draws a line.

There's an issue though because it's not smooth this way, I have to keep releasing the mouse and pressing it again.

184
Web Programming and Design / Re: onmousemove and onmousedown
« on: October 03, 2011, 02:59:13 am »
Define some variable to represent the state of the mouse as down or up, then make it "true" when mouseDown is triggered and "false" when mouseUp is triggered.

Yes, but when do I check if it's up or down?

185
Web Programming and Design / Re: onmousemove and onmousedown
« on: October 02, 2011, 04:06:52 pm »
You could try defining both window.onmousedown and and then defining window.onmousemove as well.

Code: [Select]
function checkmouse(event)
{
  window.onmousedown = mousedown;

  function mousedown()
  {
    var x = event.clientX - drawingCanvas.offsetLeft;
    var y = event.clientY - drawingCanvas.offsetTop;

    context.fillRect(x, y, 5, 5);
  }
}

I changed to this, it works, but there's an issue. I'm trying to make a mini drawing application, so I need it to work like MS Paint, when the mouse is down and moving it draws a line.

There's an issue though because it's not smooth this way, I have to keep releasing the mouse and pressing it again.

186
Web Programming and Design / onmousemove and onmousedown
« on: October 02, 2011, 03:15:42 pm »
I have this function, that's called by onmousemove="checkmouse(event)"; in body.

Code: [Select]
function checkmouse(event)
{
  var x = event.clientX - drawingCanvas.offsetLeft;
  var y = event.clientY - drawingCanvas.offsetTop;

  context.fillRect(x, y, 5, 5);
}

I was wondering how I can check if the mouse is both moving and down. I can do them separately (onmousemove or onmousedown), but not together. Do you have any ideas? Thanks.

187
Web Programming and Design / Re: My new web project... it's coming...
« on: October 02, 2011, 03:12:54 pm »
You're using this, right? Looking neat.

188
Computer Programming / Re: C string with numbers for a label
« on: October 02, 2011, 12:33:56 pm »
It worked perfectly, I found a way that converts each number to a char*, but using snprintf(); is much cleaner, thanks!

189
Computer Programming / Re: Java Panel/Frame has different sizes
« on: October 02, 2011, 12:31:08 pm »
Well, the problem is if I don't set the size on the frame, then the panel won't be 800*600, right?

Here's an example, the frame appears very tiny when displayed.

190
TI Z80 / Re: Gravity Guy
« on: October 02, 2011, 10:52:29 am »
The port is looking great. Yesterday, I was at a friend's house and we played the Flash game in multiplayer. He is very good at the game, and he really plays like a pro. When I showed him a screenshot he was super excited and he went like "Woah, when will this be out? I want it on my calculator".

I was wondering if the calculator port will feature multiplayer.

Good job so far and good luck with what's left squidget!

191
TI Z80 / Re: Axe Syntax Highlighting (for Gedit)
« on: October 02, 2011, 09:47:55 am »
Cool Michael, looking neat!

192
Computer Programming / C string with numbers for a label
« on: October 02, 2011, 07:24:12 am »
I am using GTK+ to create a label with numbers on it:

Code: [Select]
time_text = gtk_label_new("Time: %i:%i:%i", hours, minutes, seconds);
The gtk_label_new function takes a const gchar *str as argument. However, when compiling the code, I get:

Quote from: GCC
error: too many arguments to function ‘gtk_label_new’

This is because I am passing four arguments to gtk_label_new.

So I need to pass only one string, but I need the numbers included (hours, minutes, seconds).

Any idea? Thanks!

193
News / Re: Trapped for TI-89 (Finally) Released!
« on: October 01, 2011, 05:46:51 pm »
Awesome job Apcalc, the game is on a lot of platforms now!

194
Site Feedback and Questions / Re: Omnimaga Google+
« on: October 01, 2011, 04:27:18 pm »
I'm pretty sure its 13 now.  I signed up for G+ when it was invite only, but it told me I was too young.  It worked for me later.    And I'm positive I put my real age in.

Well, it's 18+ only. Go to Youtube.com (if your Youtube account is Google's account) and there you can see your age. It says that 13 < my_age < 18 there. This proves it's 18+ only.

195
Site Feedback and Questions / Re: Omnimaga Google+
« on: October 01, 2011, 06:46:14 am »
I think I read somewhere that this age restriction is temporary, but by the time they lift it I'll probably be 18 anyway :/

EDIT (not an edit): http://answers.yahoo.com/question/index?qid=20110712172026AAQWvHi (ha, Yahoo!)

I think the Beta tag has been dropped, and it's still 18 (Google+ is now public, so I guess the beta is over, right?). I also read somewhere else the age restriction is because only 18+ can sign a legal contract with Google Inc. so it will be maintained forever.

Pages: 1 ... 11 12 [13] 14 15 ... 424