( -`д´- ) Devil Child by Rikku Yheng | http://rikkuritz.tumblr.com Via Flickr: Picture for friend Noeky.

seen from United States

seen from Malaysia
seen from United States

seen from Malaysia
seen from United States
seen from United States
seen from United States
seen from United States
seen from United States
seen from United States

seen from Malaysia

seen from United States

seen from Canada

seen from Canada
seen from United States
seen from United States

seen from Australia
seen from United States
seen from United States
seen from United States
( -`д´- ) Devil Child by Rikku Yheng | http://rikkuritz.tumblr.com Via Flickr: Picture for friend Noeky.
System Shock: Enhanced Edition adds mouselook, higher resolutions
System Shock: Enhanced Edition adds mouselook, higher resolutions At gizmorati.com, the privacy of our visitors is of extreme importance to us (See this article to learn more about Privacy Policies.). This privacy policy document outlines the types of personal information is received and collected by gizmorati.com and how it is used. Log FilesLike many other... http://gizmorati.com/2015/09/22/system-shock-enhanced-edition-adds-mouselook-higher-resolutions/
It's now possible to look around by pressing and holding the left mouse button, also known as "mouse look". And the music boxes are 2x2 dm big - a little more manageable.
Mouselook and SDL - Code
Okay, here is some code for mouselook with SDL...
___________________________________________________________________
struct { int x, y; //In this case: the position where the mouse is held at bool trap; //flag for holding mouse at one place } mouse; void MouseMotion(){ /* Set x and y to the current mouse position */ int x, y; SDL_GetMouseState(&x, &y); int xdiff = x - mouse.x; //Calculate difference in x int ydiff = y - mouse.y; //Calculate difference in y /* rotate camera relative to what it was before */ Cam->relRot( (float) ydiff, (float) xdiff, 0.0f); //Alternative: use gluLookAt(...); // ( xdiff and ydiff are in the right place... comment, if you need explaination) if (mouse.trap){ //Reset Mouse Position to middle of screen SDL_WarpMouse(mouse.x, mouse.y); //Set Cursor } } int main (){ //Initialization...blabla bool done = false; while(!done) { SDL_Event event; while(SDL_PollEvent(&event)) { switch(event.type) case SDL_MOUSEMOTION: MouseMotion(); break; //... ther Events ... } //... do other things } //End }
___________________________________________________________________
This code is only a bunch of fragments to keep it simple. "Cam" is a camera class I created to handle every camera-related stuff (Position/Rotation...). "RelRot" adds the given vector values to the rotation-vector of the camera. When rendering the sceen, I rotate the Projection Matrix by the rotation-vector of the camera.
btw: this is not exacly the code I use in Mineshooter. I use more classes there ;)
Anyway, I hope this helps somebody out there :)
Fixed the SDL and Mouselook Problem
After spending hours trying to figure out why my mouselook function didn't work with SDL, I finally got a solution.
The problem was that I didn't use SDL_PumpEvents() before calling SDL_GetMouseState(). But if I do that I get the next problem: my Keyboard Events get delayed because the event-queue got enormous.
In the end I decided to put the mouse motion handling in where I handled the SDL-events. That worked. I'll post some code very soon, so if somebody has a similar problem, he/she doesn't need to spend hours on it, as I did.
Greetings, Squareys