forum.boolean.name

forum.boolean.name (http://forum.boolean.name/index.php)
-   MidletPascal (http://forum.boolean.name/forumdisplay.php?f=46)
-   -   keys/game library (http://forum.boolean.name/showthread.php?t=13774)

NastyKhan 24.11.2010 21:20

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.

ViNT 24.11.2010 21:59

Ответ: 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.

NastyKhan 24.11.2010 22:41

Ответ: keys/game library
 
Didn't work.

Using this lib, the game don't even run.

ViNT 24.11.2010 22:57

Ответ: keys/game library
 
Set MIDlet type: MIDP2.0 Fullscreen to fix this problem.

NastyKhan 25.11.2010 00:19

Ответ: 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?

ViNT 25.11.2010 00:45

Ответ: 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).

NastyKhan 25.11.2010 01:13

Ответ: 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.

ViNT 25.11.2010 01:34

Ответ: 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.

NastyKhan 25.11.2010 01:47

Ответ: 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.

ViNT 25.11.2010 12:26

Ответ: 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.

NastyKhan 25.11.2010 17:53

Ответ: 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.

ViNT 25.11.2010 19:50

Ответ: keys/game library
 
Use 1,91KB version, replacing Repaint by refresh.

NastyKhan 25.11.2010 20:38

Ответ: 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.

ViNT 26.11.2010 08:12

Ответ: keys/game library
 
Цитата:

Сообщение от NastyKhan (Сообщение 169922)
What about GetKeyClicked? I critically need it.

Then you should use another version (310KB). Possible, this error have another source, not this library. You should check your code completely, because this library doesn't give blank screen itself (how I speaking earlier, simple key reading work fine).

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.

cherepets 27.11.2010 12:01

Ответ: 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


Часовой пояс GMT +4, время: 19:34.

vBulletin® Version 3.6.5.
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Перевод: zCarot