• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

omegasyphon

mouse input question

20 posts in this topic

how do i get get the mouse coords to move an object on the screen? is there a function in glut that i can use?
0

Share this post


Link to post
Share on other sites
alright why doesnt this work? if i move the mouse shouldnt it move what i have displayed or am i doing this wrong?

  

void processmousecords(int x,int y)
{
xrot=x;
yrot=y;
}

void renderscene()
{
GLfloat x;

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glRotatef(x,1.0f,0.0f,0.0f);
glRotatef(30.0f,0.0f,0.0f,1.0f);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3,GL_FLOAT,0,cords);
glDrawElements(GL_TRIANGLE_STRIP,1600,GL_UNSIGNED_INT,corners);
glPopMatrix();
glutSwapBuffers();
}


void main()
{
GLfloat x=0.0;
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
glutCreateWindow("game engine console");
glutReshapeFunc(ChangeSize);
glutDisplayFunc(renderscene);
setuprc();
glutMotionFunc(processmousecords);
glutMainLoop();
}


0

Share this post


Link to post
Share on other sites
omegasyphon, try adding

glutPostRedisplay();

in your processmouse inputs function. this tells the renderer that the function has made an update.

paulP,

yes there is a way without glut. you use regular Win32 code. the topic goes into the WinProc, which i don''t wanna discuss, but that is where you would put your mouse processing commands.

a2k

0

Share this post


Link to post
Share on other sites
... and remove the local x variables. The one in main is never used and you should use yrot or xrot in renderscene.
0

Share this post


Link to post
Share on other sites
To answer some of your questions: Yes you can get mouse input without using the GLUT... Its called DirectInput, and it kicks ass (writing a tutorial on mouse movement with DI, and DirectAudio as we speak actually).

------------------------------
Trent (ShiningKnight)
E-mail me
OpenGL Game Programming Tutorials
0

Share this post


Link to post
Share on other sites
ShiningKnight, looking forward to it. Are there any tutes out there right now that cover some of that stuff? (maybe i''ll check nehe.) either way, when will your tute come out?

a2k
0

Share this post


Link to post
Share on other sites
Hmmm... Whenever I feel like writing the tut (I just wrote a 17 page one on .md2 loading and .ms3d loading that should be up on NeHe''s site pretty soon... So I''m a little burned out on writing). But the code *IS* done, so whenever I feel like writing, I''ll write it.

------------------------------
Trent (ShiningKnight)
E-mail me
OpenGL Game Programming Tutorials
0

Share this post


Link to post
Share on other sites
ok what is the difference between the two?

glutMotionFunc(processMouseActiveMotion);
glutPassiveMotionFunc(processMousePassiveMotion);
0

Share this post


Link to post
Share on other sites
I thought abut DirectInput, but i already know how to use that, i wanted to know if there was any other pratical ways to trap the mouse!!

As for the tut's, looking forward to them, i already know how to use DirectInput, but i always benefit from looking at tutorials, i get to see all the little tricks i missed first time round!!

Will they be based on C or C++??



Edited by - PaulP on July 7, 2001 7:40:58 PM
0

Share this post


Link to post
Share on other sites
i found after searching that their are very little tutorials on directinput about devices. but theres a ton on graphics
0

Share this post


Link to post
Share on other sites
That''s because the SDK documents are fairly complete. There isn''t too much to mouse input in DI - or keyboard either. Joystick is just a little bit more involved. So, check your SDK docs - the answer lies within.



Or some fantasy-sounding junk like that...
0

Share this post


Link to post
Share on other sites
http://www.gamedev.net/reference/articles/article539.asp
0

Share this post


Link to post
Share on other sites
Don''t bother with DirectInput to grab the mouse, unless you need automatic buffering (which you could set up using less code than it takes to initialize DirectInput properly). Use GetCursorPos (and SetCursorPos to set the position) instead.
0

Share this post


Link to post
Share on other sites
It does?! I've never heard of that happening, even when DirectInput happens to be initialized in the same app, because it's one of those functions that's always safe to call. Are you positive that it's GetCursorPos that's causing the crash?

This is the code I've used to get the mouse position relative to the origin of my game window's client area:

  
// this bit just gets the mouse position in screen coordinates

POINT curr_pos;
GetCursorPos(&curr_pos);

// hwnd is the handle to my game's main window

// this function will transform the screen coordinates of the mouse to window coordinates

ScreenToClient(hwnd, &curr_pos);


That should do it right there, and it should always be safe to do, assuming that your window has been created prior to the call and you give ScreenToClient a valid window handle.

If you're still having problems, perhaps you could post some code?


Edited by - merlin9x9 on July 12, 2001 3:53:13 PM
0

Share this post


Link to post
Share on other sites