Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 20:05
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, kzhao, alibaba), 627 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Scrollbar for a bitmap [SOLVED] #319605
04/16/10 02:56
04/16/10 02:56
Joined: Sep 2009
Posts: 84
Theil Offline OP
Junior Member
Theil  Offline OP
Junior Member

Joined: Sep 2009
Posts: 84
Hi I want to know if it is possible to scroll an image up and down inside a window with a vertical slider? and if it is possible, how?.

vslider(5,20,314,dot_png,0,1000,my_var);


I know that with the panel I'm using I have to add the vscroll element, but what should I do with the variable name "my_var"?
thanks for reading this, I hope someone can help me.

Last edited by Theil; 04/21/10 12:46.
Re: Scrollbar for a bitmap [Re: Theil] #319625
04/16/10 09:21
04/16/10 09:21
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline

User
TSG_Torsten  Offline

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
The my_var is a global var which will be set to the position of the slider.

You can use it and "scroll" the image using "window" (you've to manually clip out a part of your image according to the slider position).

This works:
Code:
#include<default.c>
#include<acknex.h>

var slider_x,slider_y,move_x,move_y; // Variables for the panel elements
BMAP* pic="Picture.jpg";
PANEL* slider =
{
slider(0,500,"Slider_1.png","Move.png",0,1,slider_x); // Slider bottom
slider(500,0,"Slider_2.png","Move.png",0,1,slider_y); // Slider right
window(0,0,500,500,pic,move_x,move_y); // The actual picture, clipped
flags=VISIBLE;
}
void main()
{
mouse_mode=1;
while(1)
{
vec_set(mouse_pos,mouse_cursor);
move_x=slider_x*(bmap_width(pic)-500); // Multiply slider position by the bmap-size and subtract the window size (500)
move_y=slider_y*(bmap_height(pic)-500);
wait(1);
}
}



And it looks like this:


Regards
TSGames

Last edited by TSG_Torsten; 04/16/10 09:28.
Re: Scrollbar for a bitmap [Re: TSG_Torsten] #319686
04/16/10 19:25
04/16/10 19:25
Joined: Sep 2009
Posts: 84
Theil Offline OP
Junior Member
Theil  Offline OP
Junior Member

Joined: Sep 2009
Posts: 84
I'm doing it exactly as you said and it tells me that slider is a unknown keyword, what's going on?

thank you very much laugh.

Re: Scrollbar for a bitmap [Re: Theil] #319689
04/16/10 19:45
04/16/10 19:45
Joined: Sep 2009
Posts: 496
P
Progger Offline
Senior Member
Progger  Offline
Senior Member
P

Joined: Sep 2009
Posts: 496
change slider to hslider or vslider
WFG Progger laugh


asking is the best Way to get help laugh laugh laugh
Re: Scrollbar for a bitmap [Re: Progger] #319693
04/16/10 20:27
04/16/10 20:27
Joined: Sep 2009
Posts: 84
Theil Offline OP
Junior Member
Theil  Offline OP
Junior Member

Joined: Sep 2009
Posts: 84
if I put vslider instead of slider, the parameters of the function are not the same, any examplo on the code above with vslider? thanks laugh

Re: Scrollbar for a bitmap [Re: Theil] #319712
04/16/10 23:29
04/16/10 23:29
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
in the manual ???

Re: Scrollbar for a bitmap [Re: Widi] #320384
04/21/10 12:45
04/21/10 12:45
Joined: Sep 2009
Posts: 84
Theil Offline OP
Junior Member
Theil  Offline OP
Junior Member

Joined: Sep 2009
Posts: 84
Thanks, I get it to work =D


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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