![]() |
|
|
| Subject:
Using graphics GET in Qbasic with a user-defined type
Category: Computers > Programming Asked by: qwiz-ga List Price: $10.00 |
Posted:
14 Mar 2003 19:16 PST
Expires: 13 Apr 2003 20:16 PDT Question ID: 176397 |
I am working in Qbasic 7.1, and I want to be able to use the GET
(graphics) statement with an array that is a field in a record
variable. i.e.:
TYPE MyType
Desc AS STRING * 20
Icon(0 to 701) AS INTEGER
END TYPE
SCREEN 12
DIM MyRecord as MyType
LINE (10, 10) - (20, 20), 13
GET (10, 10) - (20, 20), MyRecord.Icon
Qbasic will not compile this. It expects END-OF-STATEMENT at the dot
following MyRecord. Obviously, QB71 does not support this
construction; it expects the array used in a GET to be a standalone
array.
I am looking for a workaround. I would like to trick QB into using
the same memory locations to store two different arrays, one a
standalone and the other a field in a user-defined type (akin to
assigning one pointer or reference variable to another in C or VB),
but I don't know how to do that in QB. I have also thought about
BSAVing the standalone and BLOADing it into the field array, but this
requires two copies of the data to be in memory, and Windows sometimes
throws a fit when I use BLOAD. |
|
| There is no answer at this time. |
|
| Subject:
Re: Using graphics GET in Qbasic with a user-defined type
From: j_philipp-ga on 14 Mar 2003 22:14 PST |
Could it help to use a temporary array to GET, and then copy it to the
type? Something like;
DIM temp(0 to 701) AS INTEGER
GET (10, 10) - (20, 20), temp
FOR i = 0 TO UBOUND(temp)
MyRecord.Icon(i) = temp(i)
NEXT |
| Subject:
Re: Using graphics GET in Qbasic with a user-defined type
From: qwiz-ga on 15 Mar 2003 09:28 PST |
I'm sure that would work, but would it not tend to bog the program down when processing a large number of icons? I should have clarified my question by saying that it should execute as quickly as possible. Think animation. |
| Subject:
Re: Using graphics GET in Qbasic with a user-defined type
From: j_philipp-ga on 23 Mar 2003 01:44 PST |
Hi Qwiz, Above process was used for sprite animation/ tiles. But I processed the loading before the actual game started. I suppose if you have over 64K of graphics this method might cause some headaches in QB as you have to dynamically reload. I suggest trying out implementing this approach so you can see how it goes, speed-wise! Hope it helps! |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
| Search Google Answers for |
| Google Home - Answers FAQ - Terms of Service - Privacy Policy |