|
Input box using Allegro |
makeshift_theory
Member #7,809
September 2006
|
Hello again, I am trying to find a solution to this. I am need of using input style boxes in my game however I cannot seem to locate how to accomplish this. I have used my books and research and I can't do the following: So what do I need to do? The only way I can think of is to somehow set the coordinates of where the boxes are and if they are clicked then have a loop function that displays | flashing and constantly displays keys that are pressed until the mouse leaves the coordinates or until tab is hit. Is this close to being right? |
Rampage
Member #3,035
December 2002
|
Have you tried using the Allegro GUI functions? -R |
Eradicor
Member #2,992
December 2002
|
I have working solution for this at home. If i remember i'll post it for you later today. | Visit The site | |
makeshift_theory
Member #7,809
September 2006
|
Hi all well I found some source code online and did some editing so I could get the caret to flash. The only thing I need to figure out now is how to draw all of it on screen with a background. Double buffering will not work because it has to clear the buffer between flashes so I'm thinking of converting the caret to a bitmap image and just clear the bitmap image instead of the whole buffer. If possible can you make a buffer background transparent? I know a buffer is just a blank bitmap so I have the option of drawing the input box in the buffer image and updating that I suppose. |
miran
Member #2,407
June 2002
|
Your way of thinking about double buffering is severely flawed. In double buffering you have an off screen buffer, in every frame you fill this buffer completely with what you want to be displayed on the screen, and then blit the buffer to screen. If what you want to be displayed on the screen is an input box with a flashing |, then you need to draw the box to the buffer, keep a variable that tracks the status of the caret (on/off) and if it's "on", draw the caret. Every now and then (like twice a second) you toggle the status of the caret flag between on and off. -- |
Eradicor
Member #2,992
December 2002
|
Cant find the files.. Sorry. | Visit The site | |
makeshift_theory
Member #7,809
September 2006
|
Here let me show you my code to give you an idea of what I was trying:
EDITED, Thanks for the heads up Thomas |
Thomas Fjellstrom
Member #476
June 2000
|
Please use [code] tags, take a look at the "HTML Mockup Code" link thats just above the textarea. -- |
James Stanley
Member #7,275
May 2006
|
I have one that draws a box with text inside it. There is a blinking cursor and backspace support, no left and right support and no scrolling. I might post it when I get home. The allegro routines are better, but not so user friendly. |
Tobias Dammers
Member #2,604
August 2002
|
Here are your options: --- |
James Stanley
Member #7,275
May 2006
|
It's probably no use, but here goes:
Call it like: Obviously, you put #define TEXT_BOX_1 1 in a header. The id is so that it knows where to put the text, otherwise if you had two on the screen at the same time, it wouldn't know which was in focus. EDIT:
EDIT2: EDIT3: |
|