Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, 1 invisible), 863 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
PAID : Load images from folder and let user scroll through them #263638
04/30/09 23:18
04/30/09 23:18
Joined: Feb 2002
Posts: 288
California, USA
J
jaknine Offline OP
Member
jaknine  Offline OP
Member
J

Joined: Feb 2002
Posts: 288
California, USA
I need a few functions made in C-Script (no Lite C) for A7 that will do the following:
  • A function that looks inside a folder and makes a list of all images in it based on a wildcard, and puts all entries into an array.
  • Change the BMAP image on a panel based on this array of images.
On my main menu screen I have a panel that has two buttons underneath it, one left arrow and one right arrow.

I want a function for the left arrow that will cycle backwards through the list of images in the folder and show each image in turn on the panel. I also want a function for the right arrow that cycles forwards through the list and shows the image on the panel. There should also be a string variable that's updated with the current image shown, so that I can access that variable in the rest of my program.

I already have the buttons set up to call on functions and the main image panel is already present on my menu screen, I just need the functions written as noted.

If you can do it pretty quickly please send me a private message with your price and time frame. Again, this project is using C-Script so I need it done in that and not Lite-C.

Thanks!

Re: PAID : Load images from folder and let user scroll through them [Re: jaknine] #263659
05/01/09 08:20
05/01/09 08:20
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Hopefully no one has taken on this job.
I was interested in it and wrote a script in a few minutes which does the job.
However you did not specify if the folder where the images are is static or not and if the image format (wildcard) is static or not.
So here is a code which uses a specific folder and a specific image format:
Code:
// ============================================================================
// VARIABLES

var nro_images = 0;
var cur_image = 0;


// ============================================================================
// STRINGS & TEXT

string current_image = "#100";

text image_file
{
	strings = 100;
}


// ============================================================================
// PANEL

panel image_pan
{
	pos_x = 100;
	pos_y = 100;
}


// ============================================================================
// FUNCTIONS

// sets the current_image string and updates the panel
function update_image()
{
	str_cpy(current_image,"images\\");
	str_cat(current_image,image_file.string[cur_image]);
 	
	image_pan.bmap = bmap_create(current_image);
	image_pan.size_x = bmap_width(image_pan.bmap);
	image_pan.size_y = bmap_height(image_pan.bmap);
}

// shows the next image
function cycle_imagesUp()
{
	cur_image = cycle(cur_image+1,0,nro_images);
	
	update_image();
}

// shows the previous image
function cycle_imagesDown()
{
	cur_image = cycle(cur_image-1,0,nro_images);
	
	update_image();
}


// loads the images with a specific format from a specific folder
function load_images()
{
	nro_images = txt_for_dir(image_file,"images\\*.jpg");
	
	update_image();
}


// ============================================================================
// END OF FILE
// ============================================================================



Re: PAID : Load images from folder and let user scroll through them [Re: Xarthor] #263748
05/02/09 00:16
05/02/09 00:16
Joined: Feb 2002
Posts: 288
California, USA
J
jaknine Offline OP
Member
jaknine  Offline OP
Member
J

Joined: Feb 2002
Posts: 288
California, USA
Awesome, thanks very much Xarthor. That looks like exactly what I needed. I really appreciate it!

Re: PAID : Load images from folder and let user scroll through them [Re: Xarthor] #263826
05/02/09 15:49
05/02/09 15:49
Joined: Jun 2001
Posts: 1,004
Dossenbach
N
nfs42 Offline
Serious User
nfs42  Offline
Serious User
N

Joined: Jun 2001
Posts: 1,004
Dossenbach
nice contribution, added to 3DGS codebase


Andreas
GSTools - Home of
GSTScript 0.9.8: lua scripting for A6/7/8
GSTNet 0.7.9.20: network plugin for A6/7/8
GSTsqlite 1.3.7: sql database plugin for A6/7/8
3DGS Codebase: 57 snippets || 3DGS Downloads: 248 files
Re: PAID : Load images from folder and let user scroll through them [Re: nfs42] #263843
05/02/09 16:57
05/02/09 16:57
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Thanks you two, hope everything works ok. Otherwise PM me.

@nfs42:
Cool, thanks for adding it. But: The version is A7 C-Script, not lite-C.
As requested is the snippet written in C-Script, but it can easily be converted to lite-C

Re: PAID : Load images from folder and let user scroll through them [Re: Xarthor] #263850
05/02/09 17:44
05/02/09 17:44
Joined: Jun 2001
Posts: 1,004
Dossenbach
N
nfs42 Offline
Serious User
nfs42  Offline
Serious User
N

Joined: Jun 2001
Posts: 1,004
Dossenbach
changed to A7 c-script


Andreas
GSTools - Home of
GSTScript 0.9.8: lua scripting for A6/7/8
GSTNet 0.7.9.20: network plugin for A6/7/8
GSTsqlite 1.3.7: sql database plugin for A6/7/8
3DGS Codebase: 57 snippets || 3DGS Downloads: 248 files

Moderated by  checkbutton, Inestical, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1