This site is no longer active and is available for archival purposes only. Registration and login is disabled.

keyboard / string problem


keyboard / string problem

Postby Nic-Gun » May 9, 2006 @ 12:06pm

can edge accept keystroke from keyboard without colliding with the keyup, keydown, or keybuttonA etc? like using getch() or kbhit()?

and one more thing, my code below :

char name[2][3];

int i=0;
ClassEStd::StrCpy(name[i], "MAX");

i++;
ClassEStd::StrCpy(name[i], "KIN");

for (i=0; i<2; i++)
display->buffer.DrawFont(150, 70+(i*20), &display->internal, name[i], EFX_COLORKEY | EFO_VCENTER);

resulted in :

name[0] = "MAXKIN"
name[1] = "KIN"

while :

char name[2][3];

int i=0;
ClassEStd::StrCpy(name[i], "MAX");
display->buffer.DrawFont(150, 70+(i*20), &display->internal, name[i], EFX_COLORKEY | EFO_VCENTER);

i++;
ClassEStd::StrCpy(name[i], "KIN");
display->buffer.DrawFont(150, 70+(i*20), &display->internal, name[i], EFX_COLORKEY | EFO_VCENTER);

resulted in :

name[0] = "MAX"
name[1] = "KIN"

is there any problem with StrCpy()?
Last edited by Nic-Gun on May 9, 2006 @ 12:48pm, edited 1 time in total.
User avatar
Nic-Gun
pm Member
 
Posts: 61
Joined: Apr 7, 2005 @ 6:50am
Location: Jakarta, Indonesia


Postby edge » May 9, 2006 @ 12:47pm

You can catch al keyboard input, but incoming keys (from OnButtonDown()) can overlap with keymappings defined in EBUTTONLIST. This is something that can't be prevented.

I suggest saving a control type state, and change it to a keyboard type when a player needs to enter his name, or unlock code. When in keyboard input state, treat all keyboard characters (such as 'A' to 'Z', spacebar, backspace, etc.) as a keyboard key, and use the directional pad to browse through selections and default button (usually inside the d-pad) as a "confirm" key.

You can solve the string problem easily by reserving an extra character. Your strings take 4 characters (including the terminating zero character).
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron