Ultimate Amiga

Network Boards => AMOS Language Discussion => AMOS Factory => AMOS The Creator Forum => Topic started by: BooBoo on March 29, 2010, 08:52:04 AM

Title: Mouse Problems
Post by: BooBoo on March 29, 2010, 08:52:04 AM
Hi - Basicly the movement of the mouse is restricted -especially on the Left and Botton of the Screen I want to be able to move the Mouse Pointer to Very edge of the screen.

The demo I uploaded shows this -that the mouse is restricted.

Any help appreciated :)

Title: Re: Mouse Problems
Post by: BooBoo on March 29, 2010, 09:54:54 AM
Doh! found it "Limit Mouse"

Ok with Big! Thanks! to Hungery Horace I finaly made my first Map editor
I never thought Amos would be suitable for makeing a Map Editor but after seeing Horace's NZS editor beta it realy proved it could.

Now to do some scrolling tests with game Maps instead of just letters I wonder How amos will cope.
Title: Re: Mouse Problems
Post by: skateblind on March 29, 2010, 03:58:44 PM
Do you want smooth pixel scrolling or tile scrolling? If you manage to get pixel scrolling working smoothly, then please let me know how.  ;D
Title: Re: Mouse Problems
Post by: Hungry Horace on March 29, 2010, 05:19:33 PM
what game you reading maps for BooBoo?

and did i give you the NZS Editor source? If not, do you want it?
Title: Re: Mouse Problems
Post by: BooBoo on March 29, 2010, 07:00:39 PM
Hi - Yeah what options do we have when it comes to scrolling?
I can get quite smooth scrolling using offset but thats very limited? -1024 I think

Thanks Horace I dont think I have the source -Ive pretty much copied the style of yours cos I liked it, I hope this is cool?
I wont mind having a PEEK at your source, did you use Offset to scroll the sceen?

The MAP editor was just a general one - not for any paricular game, just a test realy.

But Thanks for the ideas and the Amos help with Hex Reading/Writing :)

Ok heres a little Tile scroll - Bit choppy - no denying that any ideas to improve? Maybe just a better Loop would help
On my real Amiga A1200/030 it does look OK Honest ;) But on WinUae its quite abit worse
Or it might run to fast ;D

Anyways let me have your ideas
http://rapidshare.com/files/369645948/Scroll.zip.html


:Press Up/Arrow key for small speed increase - Press Space Bar to seen the hole screen.
Still couldnt get attachments working.
Title: Re: Mouse Problems
Post by: BooBoo on March 29, 2010, 07:52:32 PM
Ive just been doing some testing and I seem to get MUCH!! smoother scrolling if I run FBlit first???
Title: Re: Mouse Problems
Post by: SamuraiCrow on March 29, 2010, 08:17:33 PM
Amos doesn't have the most efficient blitting routines.  That's one of the reasons why Sidewinder and I started making a clone of Amos.  (It's still months away but the tools to customize it are coming along nicely.)

FBlit uses the CPU to do the blitting but it ties up the Fast RAM bus so other stuff running at the same time will get blocked out.  You don't want your game code to adversely influence the speed of blitting, after all.  I'd recommend not using FBlit with your scrolling code.  It might do better for displaying BOBs though.
Title: Re: Mouse Problems
Post by: BooBoo on March 29, 2010, 10:25:55 PM
I guess there is something in it - Fblit doesnt change the scrolling but the Bobs shimer when scolling, FBlit gets rid of this
Well the Tiles are going to be BoBs or Icons both drawn with the blitter - Dont know what other choice there is.

A better compiler would probably help - but Of course im using Amos Creater maybe if I compiled with Pro -This issue might be addressed better.
Title: Re: Mouse Problems
Post by: SamuraiCrow on March 30, 2010, 02:58:16 PM
Icons are faster than BOBs even though they are both blitter based.  The way that BOBs are drawn is not very efficient though, which would lead me to suggest using computed sprites under AmosPro is the quickest solution.  Other than that, you don't have many options.
Title: Re: Mouse Problems
Post by: Hungry Horace on March 30, 2010, 06:47:33 PM
I can get quite smooth scrolling using offset but thats very limited? -1024 I think

there are ways to code using offset but not to dray all of the screen (so effectively you only draw screen-size + invisible buffer

I'm not great at that kind of code though.

Quote
Thanks Horace I dont think I have the source -Ive pretty much copied the style of yours cos I liked it, I hope this is cool?
I wont mind having a PEEK at your source, did you use Offset to scroll the sceen?

The MAP editor was just a general one - not for any paricular game, just a test realy.

i did use offset myself, but it was within the 1024 limit. have a look at the upload for you on UA.

Quote
But Thanks for the ideas and the Amos help with Hex Reading/Writing :)

no probs.

Title: Re: Mouse Problems
Post by: BooBoo on March 30, 2010, 08:51:17 PM
Icons are faster than BOBs even though they are both blitter based.  The way that BOBs are drawn is not very efficient though, which would lead me to suggest using computed sprites under AmosPro is the quickest solution.  Other than that, you don't have many options.

Ok ill give icons a try

Heres a slightly different one I Think is a bit soomther.
http://rapidshare.com/files/370074571/SCROLL2.zip.html

Maybe using less vibrant colours might help aLittle.


there are ways to code using offset but not to dray all of the screen (so effectively you only draw screen-size + invisible buffer

I'm not great at that kind of code though.

def scroll might be better in a game? - although you could use offset Maybe switching between screens to get around the 1024 limit and like you say limit the screen size.
Quote from: Hungry Horace
i did use offset myself, but it was within the 1024 limit. have a look at the upload for you on UA.

Cheers for that, Same here in the above demo I just cut and pasted a few 1024 maps together - I hope the tiles I used dont offend you to much  ;)

So much for my mouse problem ;D
Title: Re: Mouse Problems
Post by: SamuraiCrow on March 31, 2010, 02:59:34 AM
The basic idea of scrolling with offset in 8-directions is to allocate a screen that is 2 screen widths + 3 tile widths across and 2 screen heights and 3 tile heights tall.  When you scroll to the right, draw the tiles to the left of the screen offset as well as to the right offset.  The idea is to have an identical screen on the left side of the screen buffer by the time you've scrolled all of the way to the right so you can shift to the left image and continue indefinitely.  The same process applies to the vertical scrolling.
Title: Re: Mouse Problems
Post by: BooBoo on April 02, 2010, 12:34:09 PM
Right ive used 2 screens swithing - scrolling using offset to the right swithcing screens when reaching the 1024 limit - The scrolling is much better -Once compiled it even even runs way to fast, so ill have to sort out some timing issues.
Title: Re: Mouse Problems
Post by: Lonewolf10 on April 13, 2010, 12:02:18 AM

Hi all,

Does anyone know how you can work out the exact position of the workbench mouse pointer? I need the X and Y coordinates for something I am working on. I have looked at the Amiga RKRM: Hardware Edition and know how the mouse data works, but that doesn't mean I can find out the exact position of the workbench mouse pointer - it just means I can create my own pointer, which wouldn't be in the exact same place as the workbench one!

The mouse data is stored in 4 registers, 2 for each mouse. The movement data is stored in 2 bytes - 1 for horizontal movement and one for vertical. When say the X value reaches 255 is then "rolls" to 0 (you subtract one from the other to find the direction of movement) and then continues to 255 before rolling to 0 again. So you can see the problem I have :(

Can anyone help?


Regards,
Lonewolf10

Title: Re: Mouse Problems
Post by: SamuraiCrow on April 13, 2010, 04:43:41 PM
Normally, if you need the position of the pointer within a window there is some sort of IDCMP-related structure that will indicate the mouse position but only when it's over your window.  As for Workbench, I don't know if you can access Workbench's data from inside Amos that easily.
Title: Re: Mouse Problems
Post by: Lonewolf10 on April 14, 2010, 04:08:16 PM

I'll look into the workbench side of things. I'm sure it must be possible, just not easy :(
Thanks for your input anyway, SamuraiCrow.


Regards,
Lonewolf10

Title: Re: Mouse Problems
Post by: skateblind on April 16, 2010, 12:43:19 AM
On a similar note, has anybody ever got Mouse Click to work? I cannot get any values from it other than %00000000. Horace said he has never got it working either. I have tried testing it with BTST and printing out its values with bin$ and I still get nothing. Mouse Key works fine, but I would have to write a bunch of code to get it to operate like Mouse Click.
Title: Re: Mouse Problems
Post by: BooBoo on April 16, 2010, 08:03:53 PM
Is mouse Click just for a single press?

Anyways probably not much help to you Skate

Do
M=Mouse Click
If M<>0 then Print M
Loop

Is there anyway of reading Second Fire button port 1?
Title: Re: Mouse Problems
Post by: Lonewolf10 on April 16, 2010, 11:29:09 PM
I'm not sure whether I have ever used Mouse Click or not, but here are some alternatives that I have found by a quick search of the Extension Commands file I created (it should be linked to, or mentioned on the forum somewhere):


Delta v1.4 mouse commands

 Delta Wait Double Mouse X         | Wait for double-click of left mouse button
 Delta Wait Fire                         | Wait for fire button (J0?) to be pressed
 Delta Wait Left Mouse               | Wait for left mouse button to be pressed


 GUI V2.1  has multiple mouse commands for workbench based mouse work.

Craft v1.00

=Hw Mouse Key | Returns the status of the mouse key, even when AMOS is put 'to back' (eg. Amos To Back).

JD Extension v5.9

=Jd Moff Click                   | Returns a value depending on which mouse buttons are
                                     | pressed (works even after Jd Multi Off has been used).
                                     |   0=No mouse buttons
                                     |   1=Left mouse button
                                     |   2=Right mouse button
                                     |   3=Both mouse buttons

Intuition v1.0

=Wb Mouse Key                | Returns the state of the left mouse key.
                                     |   -1  Left mouse key unpressed
                                     |    1  Left mouse key pressed


Anyway, the file is currently here:
http://www.geocities.com/aliensrcooluk/public/AMOS_ExtCommands.txt (http://www.geocities.com/aliensrcooluk/public/AMOS_ExtCommands.txt)


@ SamuraiCrow: The intuition extension has mouse commands that return the exact position of the workbench mouse. I'm not sure I can use the extension with my setup, but it must be possible to retrieve the coords of the WB mouse in AMOS :)



Regards,
Lonewolf10

Title: Re: Mouse Problems
Post by: skateblind on April 17, 2010, 01:55:52 AM
Is mouse Click just for a single press?

Anyways probably not much help to you Skate

Do
M=Mouse Click
If M<>0 then Print M
Loop

Is there anyway of reading Second Fire button port 1?

BooBoo, did you actually try run that bit of code you posted? I tried all the bits of code in the manual and none of it worked.
You need an extension to read the second fire button. AMCAF will do the job, http://amos.condor.serverpro3.com/AMCAFguide/manual/gameadapter.html#xfire.
Joystick talk is for a different thread though.


@lonewolf10, thanks for the help, I would prefer to use MOUSE CLICK rather than installing more extensions, but it looks like I will have to do that if I want a proper single click check. Mouse Key does the job, but if you hold the mouse button down and move over the area that is checking for mouse data, then it activates it. For the purpose I intend to use it for, I would prefer a single click so that the user does not accidentally press a button.
Title: Re: Mouse Problems
Post by: Hungry Horace on April 17, 2010, 02:07:23 AM
i'm sure you can get around the problem by using mouse click to check for both 'on' and 'off' status, checking that both are done whilst still over the zone you require.

perhaps, only checking the click once you are on the zone you want is the way forward?
Title: Re: Mouse Problems
Post by: BooBoo on April 17, 2010, 01:08:41 PM
Yes the code worked but im using Amos Creator ???

I had a similar problem with the Joystick
http://amos.condor.serverpro3.com/index.php/topic,158.0.html
Overclocked deleted his post but im sure it worked and maybe it would work on Port 0, Im not sure I have the code he gave me anymore :(

Is there no way to read second button without an extension - Like reading the mouse in Port 1?

Ive made another scrolling Demo using offset if anyone gets a chance please could they test and maybe give me feedback on speed etc - It runs very fast on my A1200/030

Arrow keys change speed.

http://rapidshare.com/files/376923558/Scroll.zip.html
Title: Re: Mouse Problems
Post by: Lonewolf10 on April 17, 2010, 02:05:13 PM


@lonewolf10, thanks for the help, I would prefer to use MOUSE CLICK rather than installing more extensions, but it looks like I will have to do that if I want a proper single click check. Mouse Key does the job, but if you hold the mouse button down and move over the area that is checking for mouse data, then it activates it. For the purpose I intend to use it for, I would prefer a single click so that the user does not accidentally press a button.


Can't you detect and save the mouse position when the mouse button is first used? That way you don't get buttons pressed accidentally.


Quote from: BooBoo

Is there no way to read second button without an extension - Like reading the mouse in Port 1?


I have tried to look it up in the Amiga Hardware Reference Manual, but found no useful info (unless someone knows where pin 9 (button 2), or pin 5 (button 3) data is stored). The button 1 (left mouse button) data is stored in the CIAAPRA ($BFE001) - bit #6 for port 1 and bit #7 for port 2.


Regards,
Lonewolf10

Title: Re: Mouse Problems
Post by: Hungry Horace on April 17, 2010, 02:19:32 PM
i fixed skate's problem with the following code:

Code: [Select]
GUI:
   ' much shorter code for checking button (zone) clicks :)  (HH)

        If Mouse Key=1 and MOUSEHELD=-1 : Rem -  LMB only

            JUMPTO$="LMBZONE"+Right$(Str$(Mouse Zone+100),2)
            Gosub JUMPTO$

   Else If Mouse Key=2 and MOUSEHELD=-1 : Rem - RMB only

   Else If Mouse Key=3 and MOUSEHELD=-1 : Rem - RMB + LMB together

   End If

   ' check if we just did something, and are still holding the mouse
        If Mouse Key<>0
          MOUSEHELD=Mouse Zone
        Else
           MOUSEHELD=-1
        End If
Return

' GOSUBs for different zones (you will need empty ones for any zones)

LMBZONE00:
Return
Title: Re: Mouse Problems
Post by: Lonewolf10 on April 17, 2010, 02:23:58 PM

Ive made another scrolling Demo using offset if anyone gets a chance please could they test and maybe give me feedback on speed etc - It runs very fast on my A1200/030

Arrow keys change speed.

http://rapidshare.com/files/376923558/Scroll.zip.html

That's a neat scroll there. It going on going and going, until it ran out of data(?) and then it kept on going!! Perhaps you have it running on Energiser batteries?!!

BTW, I was running it on WinUAE 2.0.1, set for the A600.


Regards,
Lonewolf10

Title: Re: Mouse Problems
Post by: BooBoo on April 18, 2010, 06:35:20 PM
Thanks :) -Yeah I wanted to check if it just crawls on 68000, Im not sure WinUae will give me a true idea -ill have to drag out my A600.

Glad that everyone got there Mouse problems sorted :)