| @@ -44,9 +44,9 @@ Gradient::Gradient(vec3 aa, vec3 bb) | |||
| : data(new GradientData()) | |||
| { | |||
| /* FIXME: this should not be hardcoded */ | |||
| position = aa; | |||
| bbox[0] = aa; | |||
| bbox[1] = bb; | |||
| m_position = aa; | |||
| m_bbox[0] = aa; | |||
| m_bbox[1] = bb; | |||
| data->shader = NULL; | |||
| } | |||
| @@ -120,13 +120,13 @@ void Input::SetMousePos(ivec2 coord) | |||
| for (int n = 0; n < data->nentities; n++) | |||
| { | |||
| if (coord.x < data->entities[n]->bbox[0].x | |||
| || coord.x >= data->entities[n]->bbox[1].x | |||
| || coord.y < data->entities[n]->bbox[0].y | |||
| || coord.y >= data->entities[n]->bbox[1].y) | |||
| if (coord.x < data->entities[n]->m_bbox[0].x | |||
| || coord.x >= data->entities[n]->m_bbox[1].x | |||
| || coord.y < data->entities[n]->m_bbox[0].y | |||
| || coord.y >= data->entities[n]->m_bbox[1].y) | |||
| continue; | |||
| if (!top || top->bbox[1].z < data->entities[n]->bbox[1].z) | |||
| if (!top || top->m_bbox[1].z < data->entities[n]->m_bbox[1].z) | |||
| top = data->entities[n]; | |||
| } | |||
| @@ -134,19 +134,19 @@ void Input::SetMousePos(ivec2 coord) | |||
| { | |||
| if (data->entities[n] == top) | |||
| { | |||
| data->entities[n]->mousepos = coord - (ivec2)top->bbox[0].xy; | |||
| data->entities[n]->m_mousepos = coord - (ivec2)top->m_bbox[0].xy; | |||
| if (top != data->lastfocus) | |||
| data->entities[n]->pressed = data->buttons; | |||
| data->entities[n]->m_pressed = data->buttons; | |||
| else | |||
| data->entities[n]->clicked = ivec3(0); | |||
| data->entities[n]->m_clicked = ivec3(0); | |||
| } | |||
| else | |||
| { | |||
| data->entities[n]->mousepos = ivec2(-1); | |||
| data->entities[n]->m_mousepos = ivec2(-1); | |||
| /* FIXME */ | |||
| data->entities[n]->released = ivec3(0); | |||
| data->entities[n]->pressed = ivec3(0); | |||
| data->entities[n]->clicked = ivec3(0); | |||
| data->entities[n]->m_released = ivec3(0); | |||
| data->entities[n]->m_pressed = ivec3(0); | |||
| data->entities[n]->m_clicked = ivec3(0); | |||
| } | |||
| } | |||
| @@ -159,10 +159,10 @@ void Input::SetMouseButton(int index) | |||
| if (data->lastfocus) | |||
| { | |||
| if (!data->lastfocus->pressed[index]) | |||
| data->lastfocus->clicked[index] = 1; | |||
| data->lastfocus->pressed[index] = 1; | |||
| data->lastfocus->released[index] = 0; | |||
| if (!data->lastfocus->m_pressed[index]) | |||
| data->lastfocus->m_clicked[index] = 1; | |||
| data->lastfocus->m_pressed[index] = 1; | |||
| data->lastfocus->m_released[index] = 0; | |||
| } | |||
| } | |||
| @@ -172,10 +172,10 @@ void Input::UnsetMouseButton(int index) | |||
| if (data->lastfocus) | |||
| { | |||
| if (data->lastfocus->pressed[index]) | |||
| data->lastfocus->released[index] = 1; | |||
| data->lastfocus->pressed[index] = 0; | |||
| data->lastfocus->clicked[index] = 0; | |||
| if (data->lastfocus->m_pressed[index]) | |||
| data->lastfocus->m_released[index] = 1; | |||
| data->lastfocus->m_pressed[index] = 0; | |||
| data->lastfocus->m_clicked[index] = 0; | |||
| } | |||
| } | |||
| @@ -50,7 +50,7 @@ void Sprite::TickDraw(float deltams) | |||
| { | |||
| Entity::TickDraw(deltams); | |||
| Scene::GetDefault()->AddTile(data->tileset, data->id, position, | |||
| Scene::GetDefault()->AddTile(data->tileset, data->id, m_position, | |||
| 0, vec2(1.0f)); | |||
| } | |||
| @@ -25,16 +25,16 @@ namespace lol | |||
| WorldEntity::WorldEntity() | |||
| { | |||
| position = vec3(0); | |||
| rotation = vec3(0); | |||
| velocity = vec3(0); | |||
| bbox[0] = bbox[1] = vec3(0); | |||
| mousepos = ivec2(0); | |||
| mousebuttons = ivec3(0); | |||
| pressed = ivec3(0); | |||
| clicked = ivec3(0); | |||
| released = ivec3(0); | |||
| m_position = vec3(0); | |||
| m_rotation = vec3(0); | |||
| m_velocity = vec3(0); | |||
| m_bbox[0] = m_bbox[1] = vec3(0); | |||
| m_mousepos = ivec2(0); | |||
| m_mousebuttons = ivec3(0); | |||
| m_pressed = ivec3(0); | |||
| m_clicked = ivec3(0); | |||
| m_released = ivec3(0); | |||
| } | |||
| WorldEntity::~WorldEntity() | |||
| @@ -24,14 +24,14 @@ namespace lol | |||
| class WorldEntity : public Entity | |||
| { | |||
| public: | |||
| vec3 position; | |||
| vec3 rotation; | |||
| vec3 velocity; | |||
| vec3 bbox[2]; | |||
| ivec2 mousepos; | |||
| ivec3 mousebuttons; | |||
| ivec3 pressed, clicked, released; | |||
| vec3 m_position; | |||
| vec3 m_rotation; | |||
| vec3 m_velocity; | |||
| vec3 m_bbox[2]; | |||
| ivec2 m_mousepos; | |||
| ivec3 m_mousebuttons; | |||
| ivec3 m_pressed, m_clicked, m_released; | |||
| protected: | |||
| WorldEntity(); | |||
| @@ -153,9 +153,9 @@ public: | |||
| Ticker::Ref(m_zoomtext); | |||
| #endif | |||
| position = ivec3(0, 0, 0); | |||
| bbox[0] = position; | |||
| bbox[1] = ivec3(m_window_size, 0); | |||
| m_position = ivec3(0, 0, 0); | |||
| m_bbox[0] = m_position; | |||
| m_bbox[1] = ivec3(m_window_size, 0); | |||
| Input::TrackMouse(this); | |||
| /* Spawn worker threads and wait for their readiness. */ | |||
| @@ -208,7 +208,7 @@ public: | |||
| int prev_frame = m_frame; | |||
| m_frame = (m_frame + 1) % 4; | |||
| f64cmplx worldmouse = m_center + ScreenToWorldOffset(mousepos); | |||
| f64cmplx worldmouse = m_center + ScreenToWorldOffset(m_mousepos); | |||
| ivec3 buttons = Input::GetMouseButtons(); | |||
| #if !defined __CELLOS_LV2__ && !defined _XBOX | |||
| @@ -216,18 +216,18 @@ public: | |||
| { | |||
| if (!m_drag) | |||
| { | |||
| m_oldmouse = mousepos; | |||
| m_oldmouse = m_mousepos; | |||
| m_drag = true; | |||
| } | |||
| m_translate = ScreenToWorldOffset(m_oldmouse) | |||
| - ScreenToWorldOffset(mousepos); | |||
| - ScreenToWorldOffset(m_mousepos); | |||
| /* XXX: the purpose of this hack is to avoid translating by | |||
| * an exact number of pixels. If this were to happen, the step() | |||
| * optimisation for i915 cards in our shader would behave | |||
| * incorrectly because a quarter of the pixels in the image | |||
| * would have tie rankings in the distance calculation. */ | |||
| m_translate *= 1023.0 / 1024.0; | |||
| m_oldmouse = mousepos; | |||
| m_oldmouse = m_mousepos; | |||
| } | |||
| else | |||
| { | |||
| @@ -240,7 +240,7 @@ public: | |||
| } | |||
| } | |||
| if ((buttons[0] || buttons[2]) && mousepos.x != -1) | |||
| if ((buttons[0] || buttons[2]) && m_mousepos.x != -1) | |||
| { | |||
| double zoom = buttons[0] ? -0.0005 : 0.0005; | |||
| m_zoom_speed += deltams * zoom; | |||
| @@ -274,7 +274,7 @@ public: | |||
| #if !defined __CELLOS_LV2__ && !defined _XBOX | |||
| m_center += m_translate; | |||
| m_center = (m_center - worldmouse) * zoom + worldmouse; | |||
| worldmouse = m_center + ScreenToWorldOffset(mousepos); | |||
| worldmouse = m_center + ScreenToWorldOffset(m_mousepos); | |||
| #endif | |||
| /* Store the transformation properties to go from m_frame - 1 | |||