360º Panorama

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

360º Panorama

Post by endernafi » Sat Nov 24, 2012 12:19 am

Hello Dear LiveCoders,

I've been struggling with this problem for a couple of weeks now, but couldn't get it done.
Is it possible to achieve an effect like this one?
Scrolling a group to either side, when reached at the group's border it should continue to be scrolled from other side.
Could anyone direct me to the right way about this?
I've attached a simple example stack.
360panorama.zip
(167.81 KiB) Downloaded 506 times
Btw, I know that I can use that javascript code within a browser control, but it's not suitable for me.
I actually bought the linked package, it's a good code. But I know about javascript and/or html5 next to nothing.
So expanding the functionality of it to a level which I need is nearly impossible.
My app should contain hotspots opening some pop-up windows which would have database functionality.
I can't do that via javascript & php & html5.
I need a LiveCode solution for this.

Thanks for any ideas.


Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm
Location: Switzerland

Re: 360º Panorama

Post by gpb01 » Sat Nov 24, 2012 1:18 am

Hi,
normally the trick is to have a part of the "beginning" which is repeated at the "end" and, when you reach this point, you reset the location of the image ;)

Guglielmo

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Location: Thailand
Contact:

Re: 360º Panorama

Post by dave_probertGA6e24 » Sat Nov 24, 2012 10:14 am

Hi Ender,

It's probably best to have two (or three) copies of the full image side-by-side in a group and you scroll that. At a certain point (not when the edge of an image is visible) you simply move the whole group 1 image width in the opposite direction to the user scroll so that the user cannot see that it happened and so they can continue in the same direction. Apply this to both directions and the user thinks it's infinite.

If your buttons/hotspots are actually in the scrolled group (and there are two copies of each) then they will stick to the 'building' they are over.

Code: Select all

       v------------v             <-- card width
|------------|------------|
|       X    |       X    |       <-- hotspots
|            |            |
|------------|------------|       <-- images
If the images are referenced as icons on transparent buttons then you are only using 1 x the memory for the image, so it's still efficient.

The Game Academy (and many, many side-scrolling games of the past!) used this technique for continuous backgrounds.

Cheers,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: 360º Panorama

Post by endernafi » Sat Nov 24, 2012 11:43 pm

Hello Dear LiveCoders,

It took me couple of sleepless nights but finally I did it 8)
@ Guglielmo, thanks for idea;
@ Dave, thanks for the solution.

I'm attaching my stack.
It runs on desktop {development}, simulator and device.

* If you want to use it in any of your projects, feel free to.
But, please share any optimizations and add-ons you make.
Sharing is good, mates :wink:
* If you find a couple of minutes to test it,
please tell me any glitches you come across to and/or optimization ideas.


Thanks again,

Best,

~ Ender Nafi

360panorama.zip
(168.34 KiB) Downloaded 498 times
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: 360º Panorama

Post by sturgis » Sun Nov 25, 2012 1:21 am

Noticed that if a building button is selected, after closing the dialog the scrolling is stuck in active mode and requires a click to stop scrolling. (meaning moving the mouse around, even with the mouse up, causes the screen to scroll)

Changed the mousedown handler to fix this.

Code: Select all

on mouseDown
   if the short name of the target is not "button" then -- since all your buttons are named button this works. 
      put (the mouseH - item 1 of the loc of group "panorama") into kPanoramaX
      put the mouseH into kMouseX
      put true into kScrolling
   end if
end mouseDown

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: 360º Panorama

Post by endernafi » Sun Nov 25, 2012 1:38 am

Hi Sturgis,

I've noticed that it -the faulty code of mine- also prevents the button's native script -in my original app-.
So, thank you twice 8)


Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: 360º Panorama

Post by jmburnod » Sun Nov 25, 2012 11:44 am

Hi Ender,
Nice job. Thank you for share it
I don't know how i did that, but it is possible (desktop)
Image
I have to search every step but the first is a mouseup on a btn (2,3,4,5).
I'm coming back once i have news.
All the best
Jean-Marc
https://alternatic.ch

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: 360º Panorama

Post by jmburnod » Sun Nov 25, 2012 12:02 pm

Hi Ender
I'm not sur the first step is a mouseup on a 2,3,4,5 btns

I found a recipe to produce the mistake.
• repeat 2 times
• Click at the left +4 of the card
Drag to the right of the card + 500
click outside the card

I think you can add a limit in the mousemove handler
Something like that:

Code: Select all

on mouseMove pX, pY
   if kScrolling then
      if pX > the right of this cd or pX < the left of this cd then exit mousemove ## jmb 251112
      put (pX - kPanoramaX) into theLeftValue
      set the loc of group "panorama" to (theLeftValue & comma & (item 2 of the loc of me))
   end if
   put pX,pY
end mouseMove
Best
Jean-Marc
https://alternatic.ch

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3990
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: 360º Panorama

Post by bn » Sun Nov 25, 2012 2:30 pm

Hi Ender,

I changed your stack and simplified it a bit.
It avoids the problem Jean-Marc noticed (hi Jean-Marc).
I tried to solve sturgis solution a little differently.


Furthermore I saved the stack in legacy (2.7) format since not all the users of the forum use Livecode 5.5 and higher.
360panorama_0.1bn.livecode.zip
(168.66 KiB) Downloaded 533 times
Have a look.

Kind regards

Bernd

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: 360º Panorama

Post by jmburnod » Sun Nov 25, 2012 2:44 pm

Hi Bernd,
Thank for cleaning my dirty way :oops:
Your script work fine
Kind regards
Jean-Marc
https://alternatic.ch

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: 360º Panorama

Post by sturgis » Sun Nov 25, 2012 3:09 pm

Your way is better bernd, thx for the lesson. It solves another related problem I noticed also.
bn wrote:Hi Ender,
I tried to solve sturgis solution a little differently.

Bernd

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: 360º Panorama

Post by endernafi » Sun Nov 25, 2012 7:57 pm

Dave, Jean-Marc, Sturgis; thank you very, very much for all your help.
Bernd, I envy you 8)
Just 30+ lines of code and no faulty or erratic behavior?
I really envy you - in a total respectful way of course 8) -

Thank you very much, all of you.


Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3990
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: 360º Panorama

Post by bn » Sun Nov 25, 2012 9:06 pm

Jean-Marc, Sturgis and Ender,

thank you for your kind words.

Of course I have to pass on the compliments to all the LiveCoders whose code helped me to learn the language.

A technical comment:
If you use groups when calculating offsets or animations don't forget to set the margins and the borderwidth of the group to 0. Otherwise it will add to the width and height of the group and makes calculating difficult.
If you set the margins and borderwidth of groups to 0 the dimension of the group are the dimension of the enclosed object/s. (something I learned from Scott Rossi's code)

Kind regards
Bernd

archer2009BUSknbj
Posts: 72
Joined: Sat Apr 06, 2013 8:09 am
Location: London

Re: 360º Panorama

Post by archer2009BUSknbj » Fri May 03, 2013 10:33 pm

Can this be made to work on Android as well?

When I tried to compile an APK File for Android I got the reply not supported on this platform

endernafi
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 296
Joined: Wed May 02, 2012 12:23 pm
Location: New York
Contact:

Re: 360º Panorama

Post by endernafi » Sat May 04, 2013 12:00 am

There isn't much code specific for mobile.
So, it should work on android, too.

Could you try to remove the stack script and see if it works?
All that compositor settings were unnecessary, already.
And they may cause the issue.
Just setting the acceleratedRendering would be enough.
I can't test it 'cause I don't have android sdk.


Best,

~ Ender Nafi
~... together, we're smarter ...~
__________________________________________

macOS Sierra • LiveCode 7 & xCode 8

Post Reply

Return to “iOS Deployment”