diff options
Diffstat (limited to 'src/client/view.cc')
-rw-r--r-- | src/client/view.cc | 96 |
1 files changed, 47 insertions, 49 deletions
diff --git a/src/client/view.cc b/src/client/view.cc index 42ace02..90a30ef 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -291,8 +291,6 @@ void shutdown() void draw_entity_world_target(core::Entity *entity) { - using namespace render; - model::Model *model = entity->model(); if (!model) return; @@ -380,35 +378,35 @@ void draw_entity_offscreen_target(core::Entity *entity, bool is_active_target) const float r = 16; const float margin = 24; - cx = (0.5f - cx) * ((float) render::Camera::width() - margin*2); + cx = (0.5f - cx) * ((float) render::State::width() - margin*2); cx += margin; - cy = (0.5f - cy) * ((float) render::Camera::height() - margin*2); + cy = (0.5f - cy) * ((float) render::State::height() - margin*2); cy += margin; - render::gl::disable(GL_TEXTURE_2D); - render::gl::color(0, 0, 0, 1); - render::gl::begin(render::gl::LineLoop); + gl::disable(GL_TEXTURE_2D); + gl::color(0, 0, 0, 1); + gl::begin(gl::LineLoop); glVertex3f(cx+r, cy+2, 0); glVertex3f(cx, cy+r+2, 0); glVertex3f(cx-r, cy+2, 0); glVertex3f(cx, cy-r+2, 0); - render::gl::end(); + gl::end(); if (entity == core::localplayer()->mission_target()) { - render::gl::color(1, 0.5f, 1, 1); // FIXME mission color + gl::color(1, 0.5f, 1, 1); // FIXME mission color } else if (entity->type() == core::Entity::Controlable) { - render::gl::color(0, 1, 0, 1); // FIXME allegiance color + gl::color(0, 1, 0, 1); // FIXME allegiance color } else { - render::gl::color(1, 1, 1, 1); // FIXME neutral color + gl::color(1, 1, 1, 1); // FIXME neutral color } - render::gl::begin(render::gl::LineLoop); + gl::begin(gl::LineLoop); glVertex3f(cx+r, cy, 0); glVertex3f(cx, cy+r, 0); glVertex3f(cx-r, cy, 0); glVertex3f(cx, cy-r, 0); - render::gl::end(); - render::gl::enable(GL_TEXTURE_2D); + gl::end(); + gl::enable(GL_TEXTURE_2D); } void draw_entity_target(core::Entity *entity, bool is_active_target) @@ -433,10 +431,10 @@ void draw_entity_target(core::Entity *entity, bool is_active_target) float t = (render::Camera::frustum_front() + 0.001f) / target.x; Vector3f center(target *t); - float cx = render::Camera::width() * (0.5 - center.y); - float cy = render::Camera::height() * (0.5 - center.z * render::Camera::aspect()); + float cx = render::State::width() * (0.5 - center.y); + float cy = render::State::height() * (0.5 - center.z * render::State::aspect()); - if ((cx < 0 ) || (cy < 0) || (cx > render::Camera::width()) || (cy > render::Camera::height())) { + if ((cx < 0 ) || (cy < 0) || (cx > render::State::width()) || (cy > render::State::height())) { draw_entity_offscreen_target(entity, is_active_target); return; } @@ -445,51 +443,51 @@ void draw_entity_target(core::Entity *entity, bool is_active_target) if (!is_active_target) r *= 0.5; - render::gl::disable(GL_TEXTURE_2D); + gl::disable(GL_TEXTURE_2D); // outer square shadow - render::gl::color(0, 0, 0, 1); - render::gl::begin(render::gl::LineLoop); + gl::color(0, 0, 0, 1); + gl::begin(gl::LineLoop); glVertex3f(cx+r, cy+2, 0); glVertex3f(cx, cy+r+2, 0); glVertex3f(cx-r, cy+2, 0); glVertex3f(cx, cy-r+2, 0); - render::gl::end(); + gl::end(); if ((entity->flags() & core::Entity::Dockable) == core::Entity::Dockable) { - render::gl::begin(render::gl::LineLoop); + gl::begin(gl::LineLoop); glVertex3f(cx+ (r*0.25f), cy+2, 0); glVertex3f(cx, cy+(r*0.25f)+2, 0); glVertex3f(cx-(r*0.25f), cy+2, 0); glVertex3f(cx, cy-(r*0.25f)+2, 0); - render::gl::end(); + gl::end(); } if (entity == core::localplayer()->mission_target()) { - render::gl::color(1, 0.5f, 1, 1); // FIXME mission color + gl::color(1, 0.5f, 1, 1); // FIXME mission color } else if (entity->type() == core::Entity::Controlable) { - render::gl::color(0, 1, 0, 1); // FIXME allegiance color + gl::color(0, 1, 0, 1); // FIXME allegiance color } else { - render::gl::color(1, 1, 1, 1); // FIXME neutral color + gl::color(1, 1, 1, 1); // FIXME neutral color } // outer square0 - render::gl::begin(render::gl::LineLoop); + gl::begin(gl::LineLoop); glVertex3f(cx+r, cy, 0); glVertex3f(cx, cy+r, 0); glVertex3f(cx-r, cy, 0); glVertex3f(cx, cy-r, 0); - render::gl::end(); + gl::end(); if ((entity->flags() & core::Entity::Dockable) == core::Entity::Dockable) { - render::gl::begin(render::gl::LineLoop); + gl::begin(gl::LineLoop); glVertex3f(cx+(r*0.25f), cy, 0); glVertex3f(cx, cy+(r*0.25f), 0); glVertex3f(cx-(r*0.25f), cy, 0); glVertex3f(cx, cy-(r*0.25f), 0); - render::gl::end(); + gl::end(); } - render::gl::enable(GL_TEXTURE_2D); + gl::enable(GL_TEXTURE_2D); if (is_active_target) { // entity name and distance @@ -525,10 +523,10 @@ void draw_hud() // draw a basic HUD if(core::localplayer()->view()) { Text::setcolor('N'); //set normal color - Text::draw(render::Camera::width()-4-Text::fontwidth()*32, render::Camera::height()-Text::fontheight()*3-4, core::localcontrol()->zone()->name()); + Text::draw(render::State::width()-4-Text::fontwidth()*32, render::State::height()-Text::fontheight()*3-4, core::localcontrol()->zone()->name()); Text::setcolor('B'); //set bold color - Text::draw(render::Camera::width() - 4-Text::fontwidth()*32, render::Camera::height() - Text::fontheight()*2 -4, core::localplayer()->view()->name()); + Text::draw(render::State::width() - 4-Text::fontwidth()*32, render::State::height() - Text::fontheight()*2 -4, core::localplayer()->view()->name()); } else if (core::localcontrol() && core::localcontrol()->zone()) { core::Zone *zone = core::localcontrol()->zone(); @@ -562,7 +560,7 @@ void draw_hud() statestr << "^FJumping..."; } - Text::draw(4, render::Camera::height() - Text::fontheight()*3-4, statestr); + Text::draw(4, render::State::height() - Text::fontheight()*3-4, statestr); } core::Entity *target = targets::current(); @@ -588,28 +586,28 @@ void draw_hud() strtarget << " --"; } strtarget << '\n'; - Text::draw(render::Camera::width() - 4-Text::fontwidth()*32, render::Camera::height() - Text::fontheight()*2 -4, strtarget); + Text::draw(render::State::width() - 4-Text::fontwidth()*32, render::State::height() - Text::fontheight()*2 -4, strtarget); y = 3.0f; } Text::setcolor('N'); //set normal color - Text::draw(render::Camera::width()-4-Text::fontwidth()*32, render::Camera::height()-Text::fontheight()*y-4, core::localcontrol()->zone()->name()); + Text::draw(render::State::width()-4-Text::fontwidth()*32, render::State::height()-Text::fontheight()*y-4, core::localcontrol()->zone()->name()); Textures::bind("bitmaps/hud/thruster_base"); // 316 x 32 bitmap gl::color(1, 1, 1, 1); - gl::begin(render::gl::Quads); + gl::begin(gl::Quads); glTexCoord2f(0, 0); - gl::vertex(4, render::Camera::height() - 4 - 32, 0); + gl::vertex(4, render::State::height() - 4 - 32, 0); glTexCoord2f(1, 0); - gl::vertex(4 + 316, render::Camera::height() - 4 - 32, 0); + gl::vertex(4 + 316, render::State::height() - 4 - 32, 0); glTexCoord2f(1, 1); - gl::vertex(4 + 316, render::Camera::height() - 4 , 0); + gl::vertex(4 + 316, render::State::height() - 4 , 0); glTexCoord2f(0, 1); - gl::vertex(4, render::Camera::height() - 4 , 0); + gl::vertex(4, render::State::height() - 4 , 0); gl::end(); @@ -630,18 +628,18 @@ void draw_hud() gl::color(1, 1, .5f + d * 5.0f); } Textures::bind("bitmaps/hud/thruster_indicator"); // 316 x 32 bitmap - gl::begin(render::gl::Quads); + gl::begin(gl::Quads); glTexCoord2f(0, 0); - gl::vertex(4, render::Camera::height() - 4 - 32, 0); + gl::vertex(4, render::State::height() - 4 - 32, 0); glTexCoord2f(u, 0); - gl::vertex(4.0f + u * 316.0f, render::Camera::height() - 4 - 32, 0); + gl::vertex(4.0f + u * 316.0f, render::State::height() - 4 - 32, 0); glTexCoord2f(u, 1); - gl::vertex(4.0f + u * 316.0f, render::Camera::height() - 4 , 0); + gl::vertex(4.0f + u * 316.0f, render::State::height() - 4 , 0); glTexCoord2f(0, 1); - gl::vertex(4, render::Camera::height() - 4 , 0); + gl::vertex(4, render::State::height() - 4 , 0); gl::end(); } @@ -651,7 +649,7 @@ void draw_hud() std::stringstream speedstr; speedstr << "^B" << roundf(core::localcontrol()->speed() * 100.0f); - Text::draw( 316+4+10, render::Camera::height() - 6 -16 - render::Text::fontwidth() /2, speedstr); + Text::draw( 316+4+10, render::State::height() - 6 -16 - render::Text::fontwidth() /2, speedstr); Text::setfont("gui", 12, 18); Text::setcolor('N'); //set normal color @@ -680,7 +678,7 @@ void draw_cursor() ui::root()->set_pointer("target", ui::Palette::Active, true); if (input::joystick_lastmoved_time() > input::mouse_lastmoved_time()) { - ui::root()->input_mouse(render::Camera::width()/2, render::Camera::height() /2); + ui::root()->input_mouse(render::State::width()/2, render::State::height() /2); } } else if (input::mouse_control) { @@ -688,7 +686,7 @@ void draw_cursor() ui::root()->set_pointer("control", ui::Palette::Pointer); if (input::mouse_deadzone) { - ui::root()->input_mouse(render::Camera::width()/2, render::Camera::height() /2); + ui::root()->input_mouse(render::State::width()/2, render::State::height() /2); } } else if ((input::joystick_lastmoved_time() > input::mouse_lastmoved_time()) && |