![]() |
keys/game library
Hi,
I'm using "keys" lib. As far as i know, it is the same as 'game' lib, or at least very similar. Now i have a fallowing problem: some old commands like repaint; or GetKeyClicked; doesn't work any longer. How to fix that? And what exactly does [lib].init and [lib].show commands? Thanks. |
Ответ: keys/game library
Use Lib_keys, which is placed here
http://forum.boolean.name/showpost.p...93&postcount=2 It use standard MP canvas, so standard graphic functions must work. Note that this library work only in MIDP 2.0 FullScreen mode. |
Ответ: keys/game library
Didn't work.
Using this lib, the game don't even run. |
Ответ: keys/game library
Set MIDlet type: MIDP2.0 Fullscreen to fix this problem.
|
Ответ: keys/game library
Already got it :/ Nothing. Should I add lib_keys.java file to project resources as well?
What about that "GetKeyClicked" things? Any idea how to fix that? |
Ответ: keys/game library
Adding lib_keys.java to project is not necessary, this is just library source file.
Possible, there is another errors in your code, because this library work (I successfully built and run simple test project using this library). |
Ответ: keys/game library
I don't know. What version of MIDletPascal you use? I'm working with 3.1.
I'll try to be more precise: When using "my" lib_keys (1,91KB ) - game complies, and run. Some commands like GetKeyKlicked or Repaint does nothing however. In some cases they can be replaced. For example, Repaint can be easily replaced with keys.refresh, but the original function just do nothing. When using "your" lib_keys (310B )- game complies, and run. However i have blank white screen only. |
Ответ: keys/game library
MP 3.1 is very unstable yet, so that use MP 2.0.2 version.
Please attach your lib_keys.class file. |
Ответ: keys/game library
Here you go:
http://www.sendspace.com/file/k7ihyn As i said before. All i need is to make those "standard" commands like GetKeyClicked; or Repaint; working. On all other sides, the lib works fine. |
Ответ: keys/game library
This version uses its own canvas, so standard canvas functions are not available. You should use Lib_keys.refresh() method to update display buffer instead of standard repaint function. Functions GetKeyClicked and GetKeyPressed are not available for the same reason. But standard drawing functions (i.e. DrawText) must work.
|
Ответ: keys/game library
I understand. What are you proposing me to do then? I can switch lib for that 310B instead of my 1,91KB, but as i said - i have blank screen then, for unknown reason. It looks like once executed the program freeze when reaching keys.init; keys.show; lines. Are instructions before that lines works fine.
|
Ответ: keys/game library
Use 1,91KB version, replacing Repaint by refresh.
|
Ответ: keys/game library
What about GetKeyClicked? I critically need it.
lib_keys allow me only to do this: key:integer; if (keys.get_bit(key, FIRE_PRESSED) <> 0) then pause; but that function is checking if the button is PRESSED, not CLICKED. For example: I set the game to "pause" by clicking FIRE, and when paused - second click to "unpause". The effect is, that when i press FIRE (for 0.5s) the game begin to RAPIDLY pause,unpause,pause,unpause :/ Other example: I made a slide-show intro, when slides are changed by clicking fire (1 click - 1 slide). But when i press it just for a half of second, i rapidly skip all of them. One more thing: As far as I know (might me wrong however) lib_keys doesn't support softkeys, and 1,3,7,9 corner keys. And: I cannot make any 'press any key' event, cause lib seems to support only one button per function. Because of that i just.. NEED something that would check 'clicking' instead of 'being pressed', as well as detecting ALL buttons. GetKeyClicked is good, but it doesn't work.. Help me fix that and i will die happy. |
Ответ: keys/game library
Цитата:
P.S. Note, that MP is very limited language, so that some algorithms can not be implemented (i.e. using GetKeyClicked/GetKeyPressed functions on external canvas) without writing special libraries, or can't be implemented anyway. |
Ответ: keys/game library
Вложений: 1
Try this version of lib_keys.
If has 2 functions: get_key_states and get_bit. Also it doesn't block repaint and getkeypressed or getkeyclicked |
Ответ: keys/game library
Thx cherepets. I got blank screen again however. I really don't know, what's goin on. I think i'm doing something wrong with installing it.
Be default i have my 1,91kb in \MIDletPascal 3.1\Libs\ AND in \res\ folder of my project AND i added it to resources menu in program. This is the only way to make it work. When i replace the lib_keys in /res/ folder by any other - i got got blank screen. When i replace the file in \MIDletPascal 3.1\Libs\, then the program doesn't even compile. I have no damn idea, what to do. |
Ответ: keys/game library
Цитата:
|
Ответ: keys/game library
And put it only in Libs folder, not in Res
|
Ответ: keys/game library
Success! :super:
I've installed 2.0.2. And as I see it has some good and bad things. One of the features that 2.0.2 has, and 3.1 don't is to show (and name) bugs. I mean in 3.1 you only get information 'error found' but it don't say what kind of. You have to guess by your own. Thanks to this i was informed by 2.0.2, what was the reason of blank screens. It's simple: in both libraries you gave me, there are NO 'refresh', 'init' and 'show' commands. So i removed these line from the code and.. voila! It works. Final solution: 1. Put cherepets's lib_keys.class file (474B ) inside "Libs" folder 2. Do NOT use .init, .show or .refresh commands. 3. Compile using 2.0.2 or 3.1 version of compilator. Thanks both of you for help. You did a good thing. Thank you. |
Часовой пояс GMT +4, время: 06:17. |
vBulletin® Version 3.6.5.
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Перевод: zCarot