Re: Once again with SCANF, but now I'm about to solve it!!!

Search this archive.

From: Russell Marks (russell.marks@ntlworld.com)
Date: Thu 07 Sep 2000 - 14:47:17 IDT


Martijn van Oosterhout wrote:

> Nicolas Raitman wrote:
[...]
> > /* the following cycle is to get the numbers, store it in a char array and
> > then i will convert it to a float. The problem here is that i want the
> > characters to be printed while the user is typing. I tried to add a
> > gl_printf(...) i the middle of the cycle, but i come up with some problems.
> > The first one is that i have to specify a position, and since this will be a
> > routine it can be called when the cursor is anywhere on the the screen: it
> > can be at x = 200, or x = 400, so what i want to do is to place the cursos
> > 10 position to the right where it was the last time before entering the
> > cycle.
> 
> Ok, just a couple of points:
> 
> - In graphics mode, there is *no* cursor position. Any position that
> you want you have to work out yourself.
> 
> - So, what you do is decide where you want the text to appear on the
> screen. So make an x and y coordinate for that. Then whenever you read
> a key, display it at that x and y and add 10 pixels to the x.
> 
> - You'll have to handle some keys specially, most notably the enter key
> and the backspace key.

It just occurred to me that I have some code to get a line of input,
if you (this directed at Nicolas :-)) don't fancy rolling your own.
It's in zgv - cm_getline() in src/3deffects.c. (You'll probably need
bits from font.c and readnbkey.c too.) If you want to see what it's
like, try shift-g when in the file selector.

-Rus.

PS. An offtopic aside - shouldn't the list server be adding/modifying
the Reply-To header to point to the list?


This archive was generated by hypermail 2.1.4 : Wed 21 Jan 2004 - 22:10:23 IST