@Santman:
Right. And I have an update on this issue. Here, a brand new totally enhanced version of the mouse input tester.
It outputs a bunch of readings, which include all of the GetRawMouse outputs... as well as the PointerPressed, PointerState and PointerReleased states - and it displayes the results over time in table format (1 line = 1 frame).
This is what the different columns mean:
MX = Raw Mouse X
MY = Raw Mouse Y
PX = Pointer X
PY = Pointer Y
LP = Raw Left Button Pressed
LS = Raw Left Button State
LR = Raw Left Button Released
MP = Raw Mid Button Pressed
MS = Raw Mid Button State
MR = Raw Mid Button Released
RP = Raw Right Button Pressed
RS = Raw Right Button State
RR = Raw Right Button Released
PP = Pointer Pressed
PS = Pointer State
PR = Pointer Released
WA = Raw Wheel (Absolute)
WR = Raw Wheel (Relative)
And what do you know - there actually IS a problem in the outputs.
THE PROBLEM:
Apparently GetPointerPressed, GetPointerState and GetPointerReleased are reporting the state changes ONE FRAME AFTER THE FACT - well, at least one frame behind of the GetRawMouse-commands. (But, GetRawMouseX() and GetPointerX() are properly synched; the change is always within the same frame.) Perhaps Paul should take a look at this, while someone else could also confirm it.
But, Santman, if you mix GetPointerPressed() and GetRawMouseLeftPressed(), you might run into problems. (However, I don't think the problem you described is related to my recent findings.)
Well, here's the latest tester code for mouse (and pointer) input:
//=============================================================================
//### FILEHEADER
//-----------------------------------------------------------------------------
//
// Filename: main.agc
// Title: AGK TEST - Reading mouse input
//
// Version: 1.00, Build 0004
// Created: 2013-06-05 by AgentSam
// Last modified: 2013-06-06 by AgentSam
//
// Project state: Published on the AGK forums
// Release type: Public Domain
//
// Compatibility: Compiles with AGK 108.12
//
// Programmer's notes
// ==================
//
// o This is a simple test project for checking mouse input values.
//
// o The project was created in response to a message on the AGK forums:
// http://forum.thegamecreators.com/?m=forum_view&t=205663&b=41&msg=2460908#m2460908
//
// Revision History
// ================
//
// o 2013-06-05, AgentSam
// - NEW BUILD: 1.00, Build 0001
// - NOTES: Project started
//
// o 2013-06-06, AgentSam
// - NEW BUILD: 1.00, Build 0002
// - NOTES: Enhanced version which shows the entire result
// history over time, which makes it easier to
// analyze and understand the order of state
// changes.
//
// o 2013-06-06, AgentSam
// - NEW BUILD: 1.00, Build 0003
// - CHANGE: Column order changed.
//
// o 2013-06-06, AgentSam
// - NEW BUILD: 1.00, Build 0004
// - CHANGE: Added columns for GetPointerX() and GetPointerY().
// Allows comparison with GetRawMouseX() and GetRawMouseY().
//
// To Do
// =====
//
// o 2013-06-06, AgentSam
// - No pending tasks.
//
//---------------------------------------------------------------------------
//=============================================================================
//### SECTION - DISPLAY SETUP (VIRTUAL RESOLUTION)
//-----------------------------------------------------------------------------
// Landscape orientation using pixel based coordinates @60 FPS
SetVirtualResolution (1024, 768)
SetSyncRate (60, 0)
// Set text output properties
SetPrintSize (16)
SetPrintColor (255, 255, 255)
//=============================================================================
//### SECTION - DECLARE DATA TYPES
//-----------------------------------------------------------------------------
// Used by the buffered output routines
type TPrintOutput
iNumLines as integer
iMaxLines as integer
endtype
//=============================================================================
//### SECTION - DECLARE GLOBAL VARIABLES
//-----------------------------------------------------------------------------
// Used for pausing display
global g_bPaused as integer
// Used by the buffered output routines
global g_PrintOutput as TPrintOutput
//=============================================================================
//### SECTION - INITIALIZE GLOBAL VARIABLES
//-----------------------------------------------------------------------------
// Clear the pause flag
g_bPaused = 0
// Set defaults for buffered output
g_PrintOutput.iNumLines = 0
g_PrintOutput.iMaxLines = 33
// Create the output buffer
global dim g_PrintOutputArray[g_PrintOutput.iMaxLines] as string
//=============================================================================
//### SECTION - MAIN LOOP
//-----------------------------------------------------------------------------
// Our main loop
do
// Update screen
Sync()
// Show mouse input
Print("USAGE")
Print("")
Print(" MOUSE:")
Print(" - Go crazy with the mouse! Move it, press it, flip it, tap it, bump it.")
Print(" - Then OBSERVE THE OUTPUT. (Use pause to make it easier.)")
Print(" KEYBOARD:")
Print(" - Press ESC to quit!")
Print(" - Press SPACE to pause!")
Print("")
Print("MOUSE INPUT OVER TIME (1 LINE = 1 FRAME)")
Print("")
Print(" M M P P | L L L | M M M | R R R | P P P | W W")
Print(" X Y X Y | P S R | P S R | P S R | P S R | A R")
Print("")
// Do we want to update the readings?
if (g_bPaused = 0)
// Yes, we do...
PrintRawMouseValues()
endif
// Show buffer contents
PrintBufferShow()
// ESC = Quit
if (GetRawKeyPressed(0x1B) = 1) then exit
// SPACE = Pause
if (GetRawKeyPressed(0x20) = 1) then g_bPaused = mod(g_bPaused+1, 2)
loop
// Terminate application
end
//=============================================================================
//# FUNCTION - PrintRawMouseValues
//-----------------------------------------------------------------------------
function PrintRawMouseValues()
// Declare local variables
v_strOutput as string
// Build the output string
v_strOutput = " " + Pad(GetRawMouseX(), " ", 7)
v_strOutput = v_strOutput + Pad(GetRawMouseY(), " ", 7)
v_strOutput = v_strOutput + Pad(GetPointerX(), " ", 7)
v_strOutput = v_strOutput + Pad(GetPointerY(), " ", 9)
v_strOutput = v_strOutput + Pad(GetRawMouseLeftPressed(), " ", 2)
v_strOutput = v_strOutput + Pad(GetRawMouseLeftState(), " ", 2)
v_strOutput = v_strOutput + Pad(GetRawMouseLeftReleased(), " ", 4)
v_strOutput = v_strOutput + Pad(GetRawMouseMiddlePressed(), " ", 2)
v_strOutput = v_strOutput + Pad(GetRawMouseMiddleState(), " ", 2)
v_strOutput = v_strOutput + Pad(GetRawMouseMiddleReleased(), " ", 4)
v_strOutput = v_strOutput + Pad(GetRawMouseRightPressed(), " ", 2)
v_strOutput = v_strOutput + Pad(GetRawMouseRightState(), " ", 2)
v_strOutput = v_strOutput + Pad(GetRawMouseRightReleased(), " ", 4)
v_strOutput = v_strOutput + Pad(GetPointerPressed(), " ", 2)
v_strOutput = v_strOutput + Pad(GetPointerState(), " ", 2)
v_strOutput = v_strOutput + Pad(GetPointerReleased(), " ", 4)
v_strOutput = v_strOutput + Pad(GetRawMouseWheel(), " ", 6)
v_strOutput = v_strOutput + Pad(GetRawMouseWheelDelta(), " ", 0)
// Add to output buffer
PrintBufferAdd(v_strOutput)
endfunction
//=============================================================================
//# FUNCTION - Pad
//-----------------------------------------------------------------------------
function Pad(a_iValue as integer, a_strPadChar as string, a_iPadLen as integer )
// Declare local variables
v_strOutput as string
// Initialize local variables
v_strOutput = str(a_iValue)
// While length is less than desired ...
while (Len(v_strOutput) < a_iPadLen)
v_strOutput = v_strOutput + a_strPadChar
endwhile
// Return padded string
endfunction v_strOutput
//=============================================================================
//### SECTION - A BUNCH OF OLD ROUTINES FOR BUFFERED OUTPUT
//-----------------------------------------------------------------------------
//
// Programmer's notes
// ==================
//
// o 2013-06-06, AgentSam
// - Stripped all comments from these just to make the snippet smaller
// for posting on the AGK forums.
//---------------------------------------------------------------------------
function PrintBufferAdd(a_strText as string)
INC g_PrintOutput.iNumLines
if (g_PrintOutput.iNumLines > g_PrintOutput.iMaxLines)
g_PrintOutput.iNumLines = g_PrintOutput.iMaxLines
PrintBufferScroll() // This makes room for one more line
endif
g_PrintOutputArray[g_PrintOutput.iNumLines] = a_strText
endfunction
function PrintBufferShow()
v_iIndex as integer
if (g_PrintOutput.iNumLines > 0)
for v_iIndex = 1 to g_PrintOutput.iNumLines
print (g_PrintOutputArray[v_iIndex])
next
endif
endfunction
function PrintBufferScroll()
v_iIndex as integer
if (g_PrintOutput.iMaxLines > 1)
for v_iIndex=1 to g_PrintOutput.iMaxLines-1
g_PrintOutputArray[v_iIndex] = g_PrintOutputArray[v_iIndex + 1]
next
endif
endfunction
Screenshot of an error in readings:
However...
Santman wrote:
Quote: "I;ve been playing with the getrawmousewheeldelta and getrawmousewheel commands, and seem to be having an issue in that AppGameKit only seems to register them as long as the mouse wheel is pressed."
What you wrote above is most likely a logic error in your own code, because if you try the new tester, you'll see that the mousewheel does register just fine, with the wheel pressed (mid button) or not.
Cheers,
AgentSam