flat assembler
Message board for the users of flat assembler.
Index
> MenuetOS > Mouse events? |
Author |
|
Mike Hibbett 01 Dec 2003, 17:44
there are several examples - icon.asm would be a good start. this is the program that displays the icons on the desktop, and takes action when the mouse is clicked over the icon. also Iconedit, the source for which is zipped up using mhc.
Several games - connect4, minesweeper, memory also use mouse events. Cheers, Mike |
|||
01 Dec 2003, 17:44 |
|
Den 01 Dec 2003, 18:17
Hi,
I'm reading EXAMPLE2.ASM (and DIALOGS1.INC) right now and it contains some mouse event handling (eg. clicking on menu or dialog box). It's written unclearly in my opinion but it may help. Den |
|||
01 Dec 2003, 18:17 |
|
jason 01 Dec 2003, 18:39
Thank You all.
This is nice by You. But the problem with all this examples is definitively, that You have to check the mouse manually each time the event loop is called -> tends to overhead. As far as I can see, all those examples use this mechanism... This is not performance saving and also generally not very clever. Because the mouse event should be raised merely, if the mouse has in fact changed its state. This is much more efficient for some reasons. Also an application should process only mouse events inside its window (in general). The documentation describes a bit flag for receiving mouse change events in [syscall 40] "WantedEvents" by the application. My question is, whether this is implemented completely by the OS yet. If so, I would see an example of this, because the documentation don't resolve the return codes clearly. Else I have to do that "alternative way". But for some reasons, I would prefer the first more logical way. So we can save unnecessary mouse checking million times while applications are running ... Imagine, You have 10 applications running at same time and all those applications check up the mouse positions all the time for the entire screen, even if the mouse state has not changed.... Somehow stupid, I think. The only way to handle it intelligent, is to be informed by the OS, if a mouse state has changed. Fortunately this is prepared already by the API, but obviously not working yet... ? jason |
|||
01 Dec 2003, 18:39 |
|
Ville 01 Dec 2003, 20:30
Add this to the beginning of the program.
START: mov eax,40 mov ebx,100111b int 0x40 And the code below to event loop. cmp eax,6 je read_mouse So this is executed at every mouse-event. read_mouse: mov eax,37 mov ebx,0 int 0x40 ... jmp still |
|||
01 Dec 2003, 20:30 |
|
jason 02 Dec 2003, 14:37
Thank You Ville.
This is exactly, what I have done already, but it didn't work. So perhaps this is an other error anywhere inside my code. I will check it now... But there is nevertheless a thing missing with that: [sys_call 37] with ebx=2 returnes the mouse buttons, right? What are the exact return codes for pressing mouse buttons (i.e. left button, right button and eventually others) ? I cannot find it in the "documentations". Thank You very much again. |
|||
02 Dec 2003, 14:37 |
|
Ville 02 Dec 2003, 15:15
> [sys_call 37] with ebx=2 returnes the mouse buttons, right?
> What are the exact return codes for pressing mouse buttons (i.e. left > button, right button and eventually others) ? Thats right, the return values are 0=no buttons pressed, 1=left, 2=right, 3=both left and right. |
|||
02 Dec 2003, 15:15 |
|
KiteMaster 02 Dec 2003, 16:56
is there also a suport for middle button and mousewheel?
|
|||
02 Dec 2003, 16:56 |
|
Ville 02 Dec 2003, 17:33
> is there also a suport for middle button and mousewheel ?
Currently no, since I dont have the possibility to try those protocols. Feel free to implement. |
|||
02 Dec 2003, 17:33 |
|
jason 02 Dec 2003, 18:26
Thank You thousand times, Ville.
I got it working now. |
|||
02 Dec 2003, 18:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.