Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 31 Jan 2009
Offline Last Active Private

Topics I've Started

When you realize how dumb a bug is...

17 October 2014 - 01:00 AM

Since some months ago we have been trying to hunt down some bug in my game. Basically, the invincibility theme got cut off early in gameplay, which hinted at a timing issue. The game was obviously taking up 1200 frames (20 seconds) as usual, so I wondered if the framerate system was failing on his (the musician's) system. First I reworked the framerate system so it literally stayed in sync with the timer instead of trying to count on its own, but that didn't work. I went as far as looking up hardware bugs (which I had assumed would be dead by now but I wanted to make sure) and trying to set the thread's affinity to avoid them. Nope.


...then I look at the OGG file again, just in case. It's 0.4 seconds longer than it should. Nobody noticed for months. *headdesk*

Catching Backspace and Esc on Chrome

04 October 2014 - 09:32 AM

OK so, I'm writing something like a DOS simulator in javascript out of boredom. This is what I have so far:



The problem I have is with keyboard input. It works just fine on Firefox, but Chrome eats up backspace and esc. I guess that's because they're shortcuts (back and stop loading) but huh, you can see how this can be an issue here (and I'm not even filtering the default actions). Any idea how to get them working?


In case you wonder, keyboard input is handled by having a huge inputbox that covers the entire screen and then has opacity 0 (making it transparent), then the script just hooks on its keypress event to retrieve the keyboard input. I haven't tried with keydown yet but as you can imagine ideally I'd want to keep the repeat behavior (especially with backspace). Any suggestions?


PS: it may not work on Explorer since I didn't hook up old-style events yet. I suppose modern Explorer does support standard events, but I'm not sure so warning goes here...


PS2: yes I know you may argue that catching keys that happen to be shortcuts could be a security hazard, but for that matter being able to detect any keyboard input is a security hazard in the first place =P And I'm not even blocking the default browser actions.


EDIT: welp, turns out I had the concept of keydown and keypress wrong along all this time. Keydown is for any key, keypress is for characters only, and both have repeat behavior (I thought only keypress did). Whoops. Well, that fixes it, now character input is handled through keypress and Enter, Backspace and Esc are handled through keydown. That solves the problem.


Also if somebody else is having problems with keyboard events, I found this site which is pretty useful (in particular the form at the beginning which lets you test what events trigger):


Good fonts that happen to include CJK?

19 September 2014 - 04:56 PM

Normally programs will resort to using a different font when the current one doesn't include the required characters (e.g. trying to use Japanese characters with a font made for Western languages), but for some reason I can't get XeTeX to do that (at least not easily), so I need to use a single font that includes all characters I need.


Currently using Ume Mincho (serif) and Ume Gothic (sans-serif), which does the job for now. The problem is that while it looks good for CJK, it... isn't so good for Latin characters =P So, are there any suggestions of fonts that look fine in both cases? (bonus points if there's a monospace font too, but I likely won't use it for anything besides pieces of code, so...)

Why does divison by 0 always result in negative NaN?

16 September 2014 - 03:38 AM

0.0 / 0.0 = -NaN

-0.0 / 0.0 = -NaN

0.0 / -0.0 = -NaN

-0.0 / -0.0 = -NaN


Huh? Why division by zero always gives negative NaN (as opposed to positive NaN)? Does anybody know? I imagine it may have something to do with the NaN exception (negative NaN is quiet NaN), but I want to know if somebody else knows for sure.

And this is why you don't change names to lowercase

11 September 2014 - 07:14 AM

    lea     (BuildingsLUT), a0
Z:\HOME\SIK\MD\GAME\CORRIDOR\MAIN.68K(127) : Error : Symbol 'buildingslut' not defined