Crystal Space
Welcome, Guest. Please login or register.
October 24, 2014, 02:18:05 pm

Login with username, password and session length
Search:     Advanced search
9011 Posts in 2044 Topics by 8813 Members
Latest Member: Menymol
* Home Help Search Login Register
  Show Posts
Pages: 1 2 [3] 4 5 ... 7
31  Crystal Space Development / Support / Re: converting Key characters int -> char on: September 09, 2005, 10:39:00 am
You can use it for press and release.
This demoprogram uses it in both cases:

Code:
static void
do_KeyRelease (XEvent *eventp)
{
    do_KeyPress (eventp);               /* since it has the same info */
}
32  Crystal Space Development / Support / Re: converting Key characters int -> char on: September 09, 2005, 10:10:41 am
the X program "xev" does the translation in it's function
Code:
static void
do_KeyPress (XEvent *eventp)

http://cvsweb.xfree86.org/cvsweb/xc/programs/xev/xev.c?rev=1.15&content-type=text/vnd.viewcvs-markup

example output:
Code:
KeyRelease event, serial 31, synthetic NO, window 0x2a00001,
    root 0x116, subw 0x0, time 4849869, (-403,320), root:(355,351),
    state 0x0, keycode 48 (keysym 0xe4, adiaeresis), same_screen YES,
    XLookupString gives 2 bytes: (c3 a4) "ä"
33  Crystal Space Development / Support / Re: converting Key characters int -> char on: September 07, 2005, 05:34:22 pm
so I guess the only necessary patch would be a replacement of the hardcoded english table with a unicode table, right?
34  Crystal Space Development / Support / Re: converting Key characters int -> char on: September 07, 2005, 02:20:09 pm
ok, I made some debug messages in the CS code and found something out. I can't write a patch because I don't have enough understanding of all code correlations but with my info I hope it should be easy enough for someone with this understanding to write a patch.

The X eventhandling is ok until that piece of code:
plugins/video/canvas/xwindow/xwindow.cpp, line 690 - 698:
Code:
          default:           
    {
      if (xKey < sizeof(ScanCodeToChar)/sizeof(ScanCodeToChar[0]))
      {
csKeyRaw = ScanCodeToChar [xKey];
  // @@@ Remove scancodes, if possible
csKeyCooked = charcount == 1 ? charcode[0] : 0;
      }
    }
This is the place where regular keys are handled.
"default" is being entered when I push an umlaut, but the "if" isn't.
This is why:
ä xKey: 228
ö xKey: 246
ü xKey: 252
ß xKey: 223
Ä xKey: 196
Ö xKey: 214
Ü xKey: 220

but include/csplugincommon/canvas/scancode.h, line 32:
extern CS_CRYSTALSPACE_EXPORT unsigned short ScanCodeToChar [128];

-> the xKeys for the special chars are bigger than ScanCodeToChar, that's the reason why they are not handled by CS.
ASCII has 128 chars, Latin-1 has 256, but for unicode this should be 65.536  (UCS-2, 16 Bit) or 1.114.112 (UCS-4, 32 Bit)

Further I noticed that charcount is 0 with Metakeys like Shift..., 1 with regular alphanum keys and 2 with äöüßÄÖÜ.
charcount == 2 isn't used in the code, but maybe has to be used.

I tested with ScanCodeToChar [256] and now my OnKeyBoard is invoked when pushing an umlaut (though it is not yet painted on the screen)
35  Crystal Space Development / Support / Re: converting Key characters int -> char on: September 07, 2005, 10:29:36 am
Where in the CS code can that be fixed? I searched a little bit in csutil event and inputstuff but didn't find a right place for that (and where do you include X headers?)
36  Crystal Space Development / Support / Re: converting Key characters int -> char on: September 06, 2005, 04:53:29 pm
The char* cast replaces 1 with the char, so that was a mistake by me.  (-> this works now)
I'm using operator+= to append. (-> works now)
I'm using Linux and the unifont distributed with CS.
CS version: pseudo stable release

I followed the function calls through my code and it ends here:
Main application (csApplicationFramework, csBaseEventHandler), method OnKeyboard (iEvent &e):

Code:
bool wsDemo::OnKeyboard (iEvent &e) {
csPrintf("OnKeyBoard\n");
    return panel->onEvent(e);
}

It doesn't print "OnKeyBoard" when typing an umlaut -> umlaute are not recognized by OnKeyBoard(). Is this a bug in CS?
37  Crystal Space Development / Support / Re: converting Key characters int -> char on: September 06, 2005, 01:11:09 pm
hm, this still does not print the german umlaute: ä,ö,ü (I tried endoding with utf32 too), neither with csPrintf nor with Write. All other ASCII-chars work though.
And it is not usable with csString. I tried to append it to a csString but it appends "1" for every char I type, even the ASCII ones.
How do I do that?
38  Crystal Space Development / Support / converting Key characters int -> char on: September 05, 2005, 08:25:52 pm
I get the keyboards' input with
Code:
utf32_char code = csKeyEventHelper::GetCookedCode(&event);
and want to print the char on the screen.

How do I print the char which is represented by "code" on the screen? In C char can be casted into int and vice versa but with utf8_char -> char some special chars are not printed. How do I do this?
39  Crystal Space Development / Support / Re: Timer/sleep function? on: September 05, 2005, 03:54:54 pm
You can use

Code:
void   csSleep (int)
     This function will freeze your application for given number of 1/1000 seconds.
40  Crystal Space Development / Support / Re: Custom Cursor on: September 01, 2005, 11:43:29 pm
now Setup() crashes... (with true and false, g3d is ok)

btw: do I have to add some other stuff that may be needed to draw the cursor? e.g. preparing a 2d canvas or tell g3d that it has to paint 2d-stuff or something else?
41  Crystal Space Development / Support / Threads - the daemon way with segfaults on: August 31, 2005, 04:22:58 pm
I have written a cs application A that creates a thread which starts another cs application B (my gameserver without graphics etc).
The only purpose of A is to start B and exit then immediately.

This works so far as A starts, creates the thread for B and starts B.
Then A quits with exit(0) but crashes with a segfault there.
B continues running though, which is wanted.
(This is similar to a daemon where you fork, then exit the parent process and let the child run in the background)

The question is, why does it segfault when I call exit(0)?
I changed exit(0) and put in Broadcast(cscmdQuit) as done in the tutorials but in this case the application segfaults and program B does not run, which is not what I want.
Does the Broadcast kill the thread B too?

Another strange thing is that the app works nearly perfect for me (except that little, annoying exit-segfault) but the same code works different on another machine:
It prints out "*** glibc detected *** malloc(): memory corruption (fast): 0x08420308 ***" and quits.

Do you have some ideas that could explain these strange behaviours?
(oh, maybe I should say that I use Linux with a NPTL enabled glibc)
42  Crystal Space Development / Support / Re: Custom Cursor on: August 31, 2005, 02:54:19 pm
I saw that g2dtest has an own cursor (and it works on my system), but there the cursor is loaded from a configfile:

Code:
  System.cursorPlugin = CS_QUERY_REGISTRY(object_reg, iCursor);
  if (System.cursorPlugin)
  {
    csRef<iConfigManager> cfg (CS_QUERY_REGISTRY (object_reg, iConfigManager));
    if (System.cursorPlugin->Setup (System.myG3D))
    {
      System.cursorPlugin->ParseConfigFile ((iConfigManager*)cfg);
    }
    else
      System.cursorPlugin = 0;
  }

with the configuration
Code:
CursorSystem.Cursors.Hand.image = /lib/g2dtest/hand-cursor64.png
CursorSystem.Cursors.Hand.hotspot = 2,2

I can't see a difference except that I want to load the image without a configfile. So why doesn't that work?
43  Crystal Space Projects / WIP Projects / Re: WorldBuilder on: August 31, 2005, 02:23:32 pm
ouch, I have made a mistake with my CRYSTAL variable. The headers are found. But there are still errors with the headerfiles (because I'm using CS 0.99, 2005.08.04?) and I guess you should continue adapting them.
Which CS version do you use? 0.98?
44  Crystal Space Projects / WIP Projects / Re: WorldBuilder on: August 31, 2005, 12:14:08 pm
I wrote a buildfile for scons (www.scons.org) which is a python based build tool. (much better than jam in my opinion)
Save the attached file as "SConstruct" in the worldbuilder directory, install scons + python, set CRYSTAL and run scons within the worldbuilder directory.

This SConstruct doesn't work for me yet because all those crystal-includes are not found (though the compiler searches the include-directory from CS; you can verify with scons -n that the used compile commands are ok).
The reason is that you include every cs-header with #include "csfoo.h", but this is a relative path - so "csfoo.h" should be in the local directory.
You must include the cs headers with #include <csfoo.h>.
My project uses a similar scons file and we only include <crystalspace.h> in our files. It works fine and is a lot easier than the old "include cssysdef in cpp files and include hundreds of header files"-stuff.
45  Crystal Space Development / Support / Re: Hardware requirements for normal maps / bump mapping on: August 31, 2005, 10:31:55 am
Bump Mapping was invented by Matrox as far as I know. It's many years old. Every Card since 2000 or even earlier (98/99?) should be able to handle Bump Mapping
Pages: 1 2 [3] 4 5 ... 7
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 3.63 seconds with 15 queries.