1 registered members (AndrewAMD),
629
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Creating row of panels in runtime
[Re: Gordon]
#273827
06/24/09 16:14
06/24/09 16:14
|
Joined: Jul 2004
Posts: 1,710
MMike
Serious User
|
Serious User
Joined: Jul 2004
Posts: 1,710
|
PNG files are note supported. Well at least not in this area based on the manual (unless it is wrong here)
"The image must be in PCX, BMP, or TGA format."
PGN is supported for sprites and textures but it is not recommended as it is loaded by direct X and can be lost during run-time.
again from the manual
"PNG images behave like TGA images, but are not recommended because they are loaded not by the engine, but by the DirectX library, and are not guaranteed to be automatically restored when the video device gets lost. This means that they can lose their content f.i. when a fullscreen application is minimized."
hope this helps It has nothing to do with PNG, i alway use PNG format for panels., they are smaller, and better quality.
|
|
|
Re: Creating row of panels in runtime
[Re: MMike]
#273851
06/24/09 17:47
06/24/09 17:47
|
Joined: Oct 2008
Posts: 67
Crypton
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2008
Posts: 67
|
mm yes I see... . I thought that "wait" allows to "go out of the loop" and execute other functions for one step and then in the next step the loop repeats. But main() is being executed once and when "while" is met, it's stays there... Another quick question. I'd like to create multidimensional array and access it's value. var arr[2][2]; //Define multidimesnional array, with 2 columns and 2 row.. //Giving values to aadresses arr[0][0] = 5; arr[0][1] = 30; arr[1][0] = 10; arr[1][1] = 50; and accessing certain value ?: add_on = ( arr[g_type][0] - bullets); //g_type is whether 0 or 1.
Last edited by Crypton; 06/24/09 19:26.
New into Gamestudio and eager to learn it.. Stuff and games done in 2D: LINK
|
|
|
Re: Creating row of panels in runtime
[Re: Crypton]
#274007
06/25/09 10:40
06/25/09 10:40
|
Joined: Oct 2008
Posts: 67
Crypton
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2008
Posts: 67
|
any clue ? sry for urgent bump, but I'm getting desperate :P
New into Gamestudio and eager to learn it.. Stuff and games done in 2D: LINK
|
|
|
Re: Creating row of panels in runtime
[Re: Gordon]
#274095
06/25/09 17:07
06/25/09 17:07
|
Joined: Oct 2008
Posts: 67
Crypton
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2008
Posts: 67
|
My problem is I don't get that value I try to access. f.i. I have defined:
var arr[2][2]; //set values: arr[0][0] = 5; arr[0][1] =10;
and I want to get certain array value:
add_on = arr[0][g_type]; //g_type is whether 0 or 1.
I don't get the value... add_on is 0 when it should be 10 when g_type is f.i 1.
Last edited by Crypton; 06/25/09 17:07.
New into Gamestudio and eager to learn it.. Stuff and games done in 2D: LINK
|
|
|
Re: Creating row of panels in runtime
[Re: Gordon]
#274170
06/25/09 22:46
06/25/09 22:46
|
Joined: Oct 2008
Posts: 67
Crypton
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2008
Posts: 67
|
ˇhmm interesting. I tested it this way. It's actually a little modification to my reload() function.
function reload()
{
cartridge = arr[g_type][1]; //assign a value from array to predefined var
if (cartridge > 0) //Test this value
{
add_on = (arr[g_type][0] - bullets); //calculate add on
if (cartridge < add_on)
{
add_on = cartridge;
}
cartridge -= add_on;
[..]
NOW, if I change arr[g_type][1] f.i 56 and arr[g_type][0] to 5, resulting:
[...]
cartridge = 56; //assign a value to predefined var
if (cartridge > 0) //Test this value
{
add_on = (5 - bullets); //calculate add on
if (cartridge < add_on)
{
add_on = cartridge;
}
cartridge -= add_on;
[..]
, everything Works! I assume that array values aren't taken. tested in that way too:
STRING* str_addon = "";
TEXT* dbg_count =
{
pos_x = 0;
pos_y = 100;
string("add_on: ", str_addon);
flags = SHOW;
}
function main()
{
[..]
while(1)
{
[..]
str_for_num(str_addon, arr[0][1]); // directly trying to get value! the result should be 30
}
[..]
}
BUT the showed string is still 0!
New into Gamestudio and eager to learn it.. Stuff and games done in 2D: LINK
|
|
|
Re: Creating row of panels in runtime
[Re: Gordon]
#274204
06/26/09 02:06
06/26/09 02:06
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Try defining your array and filling its content this way, I know this works.
var arr[2][2]; //Define multidimesnional array, with 2 columns and 2 row..
var init_array_startup() //Giving values to addresses
{
arr[0][0] = 5;
arr[0][1] = 30;
arr[1][0] = 10;
arr[1][1] = 50;
}
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Creating row of panels in runtime
[Re: EvilSOB]
#274235
06/26/09 08:07
06/26/09 08:07
|
Joined: Oct 2008
Posts: 67
Crypton
OP
Junior Member
|
OP
Junior Member
Joined: Oct 2008
Posts: 67
|
works!
Tried to search in manual for some explanation:
Functions ending with ..._startup are executed right after the main() function, and LC before the engine and video device is initialized. This way, every script can have its own startup function which initializes its variables or objects.
So If I want to initialize some multidimensional array again, I should use .._startup to make sure it sets its variables. Have to do this then every time I want to set array values or there is some other variables when I should use _startup?
New into Gamestudio and eager to learn it.. Stuff and games done in 2D: LINK
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|