Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / using text with objects

Author
Message
octave
21
Years of Service
User Offline
Joined: 6th Apr 2003
Location: U.K
Posted: 30th Apr 2005 23:44
hi everybody

i am writing to ask if someone can help me with a routine so your able to select say

eg: keys from 1-8

which puts the text on the screen but doesnt go off when releasing the key but changes the text when pressing any of the other keys

simple enough but the catch is how do you do it when using an object

example code enclosed to show you wat i'm talking about

any help would be greatly appreciated
Ace Of Spades
19
Years of Service
User Offline
Joined: 6th Mar 2005
Location: Across the ocean
Posted: 1st May 2005 02:34
code NOT enclosed

Digitalmodr
Coder_David
[Apolloed ]
octave
21
Years of Service
User Offline
Joined: 6th Apr 2003
Location: U.K
Posted: 1st May 2005 03:30
hi there apolloed

dont know wat happened with example source code but here goes

make object cube 1,100
do
if inkey$()="1" then text 100,100,"typed text"
if inkey$()="2" then text 100,100,"typed text2"
loop

this is just a quick example of wat i'm trying to explain in the first post
Clueless
20
Years of Service
User Offline
Joined: 16th Feb 2004
Location: Corbin, KY, USA
Posted: 2nd May 2005 06:10
Be aware that mixing text and 3D objects can cause a huge performance hit in terms of frames per second. I've got a space sim with around 15 planets/moons orbiting and rotating in real time... I get 90fps with this happening. If I toggle "display planet name" and output text next to each body, the frame rate drops to about 12fps.
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 2nd May 2005 10:09 Edited at: 2nd May 2005 10:12
this example will show you how to make 3d panels appear to be 2d panels and as a bonus as well as interactive buttons.

when you display text using a 3d panel the speed performance issue of using text and 3d is avoided.

All panels dont have to be interactive if you want to display information.

when you make things in 3d they can be animated around and can possess the 3d features like ghosting, fading, transparency etc..


see source button

If no-one gives your an answer to a question you have asked, consider:- Is your question clear.- Did you ask nicely.- Are you showing any effort to solve the problem yourself
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 2nd May 2005 13:55
octave,

You stated that you simply wish to be able to press a key, 1 through 8, and have the text change to another text at this happenning. Also, you included that once the key is let off of, you do not want the text to clear from the screen, but to stay until another key is pressed.

To do this you need to make use of a variable. When a key is pressed, the variable is given a specific number,according to what key is pressed. As long as that variable includes that number, the text corresponding to the number will be displayed, until a different key is pressed and the variable is given another number. Study the code snippet below.



Remember, to make use of variables, which are the cornerstones of programming. Without variables, a useful program cannot be written. A variable is a slot of memory that holds a value. This value stays the same until you or your program changes its value. So, in this example, the variable number does not change until another key is pressed, and the displaying sentence does not change until the variable changes.


+NanoBrain+

Login to post a reply

Server time is: 2024-09-23 19:36:43
Your offset time is: 2024-09-23 19:36:43