2 registered members (SBGuy, AndrewAMD),
1,410
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
mouse_mode and pointer
#289701
09/14/09 23:34
09/14/09 23:34
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
OP
User
|
OP
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi! The problem : When I'm playing my game in fullscreen with mouse_mode at zero I get : There's a pointer (the standard arrow) appears in the top corner of my fullscreen and when it's position is the top right and I click on the left mouse button to turn the car it reduces my game to the windows toolbar at the bottom. I have these settings for using the mouse Note : this is only a small part of the code
in main :
video_set(800,600,32,1); //fullscreen
mouse_mode = 0; // I don't want a pointer but I want the mouse to be active
mouse_pointer = 0;
...
level_load ....
in action
....
while (1)
{
if (mouse_left) {_move_me = c_move (my, vector(15*time_step, 0, 0), nullvector,
IGNORE_MAPS | ACTIVATE_TRIGGER | IGNORE_CONTENT | USE_BOX | GLIDE | IGNORE_PASSABLE);}
if (mouse_right) {_move_me = c_move (my, vector(-15*time_step, 0, 0), nullvector,
IGNORE_MAPS | ACTIVATE_TRIGGER | IGNORE_CONTENT | USE_BOX | GLIDE | IGNORE_PASSABLE);}
my.pan -= 5 * mouse_force.x * time_step;
vec_diff(vec_tempmi,my.pan,camera.pan); // defined as global vector
c_rotate (my,vec_tempmi , IGNORE_PASSABLE | USE_AXISR );
vec_set (camera.pan, my.pan );// the camera and my have the same pan angle
wait (1);
}
So where should I be looking? edit : Every thing is ok at the beginning. I moved the car for a minute then the arrow appears.
Last edited by Ottawa; 09/15/09 12:46.
Hope this helps! Ottawa Ver 7.86.2 Pro and Lite-C
|
|
|
Re: mouse_mode and pointer
[Re: Ottawa]
#289785
09/15/09 15:08
09/15/09 15:08
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
OP
User
|
OP
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi! While testing I noticed that Window XP and Vista have programs running on a higher level than my game. The web camera (in Vista )is available and it's menu is on top of my game even if I'm in fullscreen mode. It's not visible at the beginning, but if the mouse cursor touches the sides of the screen (which it's not supposed to do) then the cam menu becomes visible. Is there a way to stop this. We can't tell the customer to close all window application before starting the game. I've include below the code that brings up the cam menu (Vista). Just make a level with standard texture and place an entity (car) to test. As for the arrow pointer ...starting the game with video_mode seems to have corrected the problem ...still testing.
//Can you reproduce problem with this code
// In windows ...place cam menu in the middle of screen at the top
// Drive forward and turn as fast as possible and get the cam menu
///////////////////////////////
#include <acknex.h>
#include <default.c>
#define PRAGMA_PATH "..\\Models";
ENTITY* car;
VECTOR* vec_tempmi= {x=0;y=0;z=0;}
short _bouge_o_n = 0; // used for evaluation in another function
action my_car()
{
car = my;
wait (2);
while (1)
{
// move the car using relative_speed
//------------------------------------------------
_bouge_o_n = c_move (my,vector(10 * (key_force.y) * time_step, 10 * (-key_force.x) * time_step, 0),
nullvector, IGNORE_MAPS | ACTIVATE_TRIGGER | IGNORE_CONTENT | USE_BOX | GLIDE | IGNORE_PASSABLE); //
//------------------------------------------------
// move the car with mouse left and right
if (mouse_left) {_bouge_o_n = c_move (my, vector(15*time_step, 0, 0), nullvector, GLIDE);}
if (mouse_right) {_bouge_o_n = c_move (my, vector(-15*time_step, 0, 0), nullvector, GLIDE);}
//----------------------
vec_set(camera.x,vector(my.x,my.y,my.z+30)); //place camera in first person mode
my.z = 8;// hold the car at same position on floor
//----------------------
// rotate the camera and the car around
my.pan -= 15 * mouse_force.x * time_step;
vec_diff(vec_tempmi,my.pan,camera.pan);
c_rotate (my,vec_tempmi , IGNORE_PASSABLE | USE_AXISR );
vec_set (camera.pan, my.pan );// the camera and the car have the same pan angle
wait (1);
}
}
function main()
{
video_mode = 7; // start resolution 800 x 600
video_screen = 1; // start in fullscreen mode
video_depth = 32; // 32 bit mode
// Starting with video_mode is now better
// The pointer was visible more often when starting the game with the following line
// video_set(800,600,32,1);
wait(1);
level_load ("homework18.wmb");
wait (2);
mouse_mode = 0;
mouse_pointer = 0;
}
Thanks for looking into this. Writing the problem is a way of finding the solution Ottawa
|
|
|
Re: mouse_mode and pointer
[Re: Ottawa]
#290429
09/18/09 23:05
09/18/09 23:05
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
OP
User
|
OP
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi! The code below does the same thing. And it's less work for you guys Place your web cam menu at to top and start the code. You should see the menu when the coordinates get very close to the edge.
function display_coords ();
function my_mouse ()
{
enable_mouse = 1;
mouse_mode = 1;
mouse_range= 1500; // only near Entities are clickable
display_coords ();
while (mouse_mode > 0) // move it over the screen
{
mouse_pos.x = mouse_cursor.x;
mouse_pos.y = mouse_cursor.y;
wait(1);
}
}
STRING* temporary_str = "";
STRING* coordinates_str = "";
///////////////////////////////////////////////////////////////////////////////////////////////
TEXT* mcoordinates_txt = // using the default FONT here
{
STRING = coordinates_str;
layer = 20;
flags = SHOW;
}
///////////////////////////////////////////////////////////////////////////////////////////////
function display_coords ()
{
while (1)
{
str_for_num(temporary_str, mouse_pos.x); // convert mouse_pos.x to a string
str_cpy(coordinates_str, "("); // add the first paranthesis
str_cat(coordinates_str, temporary_str); // add mouse_pos.x to the string
str_cat(coordinates_str, ","); // add a comma to separate mouse_pos.x and mouse_pos.y
str_for_num(temporary_str, mouse_pos.y); // convert mouse_pos.y to a string
str_cat(coordinates_str, temporary_str); // add mouse_pos.y to the string
str_cat(coordinates_str, ")"); // add the second paranthesis
mcoordinates_txt.pos_x = mouse_pos.x + 15; // keep the text in the lower right corner
mcoordinates_txt.pos_y = mouse_pos.y + 15; // in relation to the mouse position
wait (1);
}
}
function main()
{
video_mode = 7; // start resolution 800 x 600
video_screen = 1; // start in fullscreen mode
video_depth = 32; // otherwise 32 bit mode
wait(1);
level_load ("");
wait (2);
my_mouse ();
}
Is there a solution other than telling the customer to close the menu before starting the game. All comments are welcome Ottawa
|
|
|
Re: mouse_mode and pointer
[Re: Ottawa]
#294728
10/20/09 20:11
10/20/09 20:11
|
Joined: Apr 2006
Posts: 737 Ottawa, Canada
Ottawa
OP
User
|
OP
User
Joined: Apr 2006
Posts: 737
Ottawa, Canada
|
Hi! It's been a long wait but I believe that I found the solution to my webcam camera being touched by the mouse pointer outside the fullwindow when I'm not using a pointer.(and I started in fullscreen mode ) Thanks to Widi's comment #include <windows.h>
and in a while(1) Loop:
SetCursorPos (screen_size.x / 2,screen_size.y / 2);
That set the Windows System Mouse at the middle of the Screen (behind the Game - Window)
This solution is only fonctional in a game if mouse_mode = 0 and mouse_pointer = 0 The problem is still there for those who are using a mouse pointer in their game. Comments are welcomed Ottawa
|
|
|
|