diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | Makefile.git | 5 | ||||
-rw-r--r-- | configure.ac | 33 | ||||
-rw-r--r-- | package/aur/PKGBUILD.osirion | 48 | ||||
-rw-r--r-- | src/client/Makefile.am | 2 | ||||
-rw-r--r-- | src/client/galaxymapwidget.cc | 39 | ||||
-rw-r--r-- | src/client/mainmenu.cc | 3 | ||||
-rw-r--r-- | src/client/mapwidget.cc | 49 | ||||
-rw-r--r-- | src/client/savegamemenu.cc | 28 | ||||
-rw-r--r-- | src/client/serverlistmenu.cc | 173 | ||||
-rw-r--r-- | src/client/serverlistmenu.h | 70 | ||||
-rw-r--r-- | src/client/video.cc | 2 | ||||
-rw-r--r-- | src/model/mapfile.cc | 2 | ||||
-rw-r--r-- | src/model/vertexarray.h | 2 | ||||
-rw-r--r-- | src/render/tgafile.cc | 2 | ||||
-rw-r--r-- | src/ui/ui.cc | 9 | ||||
-rw-r--r-- | src/ui/ui.h | 14 |
18 files changed, 435 insertions, 50 deletions
@@ -1,6 +1,9 @@ # ignore build directory /build/ +# ignore libtool's m4 directory +/m4/ + # ignore autoconf/automake related files /autom4te.cache/ /aclocal.m4 diff --git a/Makefile.am b/Makefile.am index 13a6b8e..80f061e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,7 @@ # not a GNU package. You can remove this line, if # have all needed files, that a GNU package needs AUTOMAKE_OPTIONS = foreign 1.4 +ACLOCAL_AMFLAGS = -I m4 SUBDIRS = src diff --git a/Makefile.git b/Makefile.git index d160702..8092793 100644 --- a/Makefile.git +++ b/Makefile.git @@ -1,8 +1,9 @@ default: all all: - aclocal + libtoolize + aclocal -I m4 autoheader - automake + automake --add-missing autoconf diff --git a/configure.ac b/configure.ac index 3ed21e6..15d994c 100644 --- a/configure.ac +++ b/configure.ac @@ -2,15 +2,16 @@ dnl ---------------------------------------------------------------- dnl append git revision to the version number dnl determine the git revision number +dnl note: the configure scripts needs to be regenerated to update the version number define([gitversion], esyscmd([sh -c "echo -n 'git'; git rev-parse --short HEAD | tr -d '\n'"])) -AC_INIT([osirion], [0.2.8-gitversion]) - +AC_INIT([osirion],[0.2.8-gitversion]) +AC_CONFIG_MACRO_DIRS([m4]) AC_CONFIG_HEADERS(src/config.h) -AC_LANG_CPLUSPLUS +AC_LANG([C++]) AC_PROG_CXX -AC_PROG_LIBTOOL +LT_INIT AM_INIT_AUTOMAKE @@ -104,7 +105,7 @@ dnl *-*-mingw*) HOST_LIBS="-lws2_32" HOST_GL_LIBS="-lopengl32 -lglu32" - HOST_AL_LIBS="-lopenal" + HOST_AL_LIBS="-lopenal32" ICON_CLIENT="osirion-res.o" ICON_SERVER="osiriond-res.o" SDLMAIN="" @@ -147,7 +148,7 @@ dnl AC_MSG_CHECKING(whether to abort on compiler warnings) WARN_CFLAGS="$WARN_CLFAGS -Wall" AC_ARG_ENABLE(error, - AC_HELP_STRING([--disable-error], [do not abort on compiler warnings]), + AS_HELP_STRING([--disable-error],[do not abort on compiler warnings]), AC_MSG_RESULT(no), AC_MSG_RESULT(yes) WARN_CFLAGS="$WARN_CFLAGS -Werror" @@ -160,7 +161,7 @@ dnl AC_MSG_CHECKING(whether to include debug messages) AC_ARG_ENABLE(debug_messages, - AC_HELP_STRING([--disable-debug-messages], [build without extra debug messages]), + AS_HELP_STRING([--disable-debug-messages],[build without extra debug messages]), AC_MSG_RESULT(no), AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(HAVE_DEBUG_MESSAGES, 1, [Define this to enable debug messages]) @@ -171,7 +172,7 @@ dnl static libc dnl AC_ARG_ENABLE(static_stdlib, - AC_HELP_STRING([--enable-static-stdlib], [staticly link with libgcc and libstdc++]), + AS_HELP_STRING([--enable-static-stdlib],[staticly link with libgcc and libstdc++]), AC_MSG_RESULT(yes) STATIC_LDADD="-static-libgcc -static-libstdc++", AC_MSG_RESULT(no) @@ -187,9 +188,7 @@ dnl HAVE_CURSES=no AC_ARG_WITH(curses, - AC_HELP_STRING([--without-curses], - [do not include curses support] - ) + AS_HELP_STRING([--without-curses],[do not include curses support]) ) if test "x${with_curses}" != "xno"; then @@ -245,15 +244,13 @@ dnl HAVE_BULLET=no AC_ARG_ENABLE(static_bullet, - AC_HELP_STRING([--enable-static-bullet], [staticly link with bullet physics libraries]), + AS_HELP_STRING([--enable-static-bullet],[staticly link with bullet physics libraries]), AC_MSG_RESULT(yes), AC_MSG_RESULT(no) ) AC_ARG_WITH(bullet, - AC_HELP_STRING([--with-bullet=PREFIX], - [link with bullet physics library installed in PREFIX] - ) + AS_HELP_STRING([--with-bullet=PREFIX],[link with bullet physics library installed in PREFIX]) ) LDFLAGS_save="$LDFLAGS" @@ -321,7 +318,7 @@ dnl BUILD_CLIENT=no AC_ARG_WITH(client, - AC_HELP_STRING([--without-client], [do not build the client application]) + AS_HELP_STRING([--without-client],[do not build the client application]) ) AC_MSG_CHECKING(whether to build client) @@ -491,9 +488,7 @@ dnl Installation paths AC_MSG_CHECKING(installation type) AC_ARG_ENABLE(single_directory, - AC_HELP_STRING( - [--enable-single-directory], [install everything in a single directory] - ), + AS_HELP_STRING([--enable-single-directory],[install everything in a single directory]), AC_MSG_RESULT(single directory) INSTALLTYPE="single directory", AC_MSG_RESULT(standard) diff --git a/package/aur/PKGBUILD.osirion b/package/aur/PKGBUILD.osirion new file mode 100644 index 0000000..c675e0c --- /dev/null +++ b/package/aur/PKGBUILD.osirion @@ -0,0 +1,48 @@ +# +# Maintainer: Stijn Buys <ingar@telenet.be> +# + +pkgname=osirion +pkgver=0.2.8 +pkgrel=1 +pkgdesc="A free space trading and combat simulation with open gameplay" +url="http://osirion.org/" +arch=('x86_64' 'armv7h') +license=('GPL') +depends=('zlib' 'bullet' 'libjpeg' 'libpng' 'libvorbis' 'libogg' 'flac' 'sdl2' 'libgl' 'glu' 'openal') +makedepends=('automake' 'autoconf') +optdepends=(i'ncurses') +provides=('osirion') +conflicts=('osirion-server' 'osirion-git' 'osirion-server-git') +backup=() +options=() +source=("http://osirion.org/files/${pkgname}-${pkgver}-src.tar.bz2" + "http://osirion.org/files/${pkgname}-${pkgver}-data.zip") +sha256sums=('2b164ad11e2907eafb2200585afd400bdfe6eacd94d4c40a29c5750e4a2ccc6d' + 'dfa2e9ed814c03bcc0f7b4b14f5e981a6762762306ac131adb57c6a190512c74') + +prepare() { + cd "${srcdir}/${pkgname}-${pkgver}-src" + +} + +build() { + cd "${srcdir}/${pkgname}-${pkgver}-src" + + ./configure \ + --prefix=/usr + + ./configure \ + --prefix=/usr \ + --disable-debug + make +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}-src" + make DESTDIR="${pkgdir}" install + + cd "${srcdir}" + install -D --mode=644 --directory "${srcdir}/data" "${pkgdir}/usr/share/osirion/data" +} + diff --git a/src/client/Makefile.am b/src/client/Makefile.am index 21704f4..fbb075f 100644 --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -43,6 +43,7 @@ noinst_HEADERS = \ playersettingsmenu.h \ reputationwindow.h \ savegamemenu.h \ + serverlistmenu.h \ soundext.h \ targeticonbutton.h \ targets.h \ @@ -85,6 +86,7 @@ libclient_la_SOURCES = \ playersettingsmenu.cc \ reputationwindow.cc \ savegamemenu.cc \ + serverlistmenu.cc \ soundext.cc \ targeticonbutton.cc \ targets.cc \ diff --git a/src/client/galaxymapwidget.cc b/src/client/galaxymapwidget.cc index 25460b8..4bcf7c5 100644 --- a/src/client/galaxymapwidget.cc +++ b/src/client/galaxymapwidget.cc @@ -19,6 +19,9 @@ GalaxyMapWidget::GalaxyMapWidget(ui::Widget *parent) : ui::Widget(parent) galaxymapwidget_zone = 0; galaxymapwidget_hover_id = 0; galaxymapwidget_zoom = 1.0f; + + // make sure the map has a tooltip + set_tooltip(); } GalaxyMapWidget::~GalaxyMapWidget() @@ -112,11 +115,13 @@ void GalaxyMapWidget::draw() // global mouse cursor location const math::Vector2f cursor(ui::root()->global_mouse_coords()); galaxymapwidget_hover_id = 0; + set_tooltip(); // map center //math::Vector2f map_center(map_location[0] + map_size / 2.0f, map_location[1] + map_size / 2.0f); math::Vector2f icon_location; - const float r = 12.0f; // radius of map icons + const float r = 12.0f; // radius of map icons + const float rt = 24.0f; // radius of target icons float scale = 1024.0f; // galaxy size (in zone location units) math::Color color(1.0f, 1.0f, 1.0f, 1.0f); const core::Zone *zone = 0; @@ -149,6 +154,7 @@ void GalaxyMapWidget::draw() if (math::distancesquared(cursor, icon_location) < (r*r)) { galaxymapwidget_hover_id = zone->id(); + set_tooltip(zone->name()); } if (zone == galaxymapwidget_zone) @@ -180,6 +186,37 @@ void GalaxyMapWidget::draw() } gl::end(); + + if (galaxymapwidget_zone) + { + icon_location.assign(map_location); + icon_location[0] += map_size / scale * galaxymapwidget_zone->location().x(); + icon_location[1] += map_size - map_size / scale * galaxymapwidget_zone->location().y(); // flip vertically + + // draw target icon + const size_t texture_target = render::Textures::load("bitmaps/icons/map_target"); + render::Textures::bind(texture_target); + + gl::begin(gl::Quads); + + math::Color color(1.0); + gl::color(color); + + glTexCoord2f(0.0f, 0.0f); + gl::vertex(icon_location.x() - rt, icon_location.y() - rt); + + glTexCoord2f(1.0f, 0.0f); + gl::vertex(icon_location.x() + rt, icon_location.y() - rt); + + glTexCoord2f(1.0f, 1.0f); + gl::vertex(icon_location.x() + rt, icon_location.y() + rt); + + glTexCoord2f(0.0f, 1.0f); + gl::vertex(icon_location.x() - rt, icon_location.y() + rt); + + gl::end(); + } + gl::disable(GL_TEXTURE_2D); // if (has_mouse_focus()) { diff --git a/src/client/mainmenu.cc b/src/client/mainmenu.cc index 823ebfb..0e61655 100644 --- a/src/client/mainmenu.cc +++ b/src/client/mainmenu.cc @@ -11,6 +11,7 @@ #include "client/mainmenu.h" #include "client/playersettingsmenu.h" #include "client/savegamemenu.h" +#include "client/serverlistmenu.h" #include "core/core.h" #include "core/gameinterface.h" #include "core/application.h" @@ -218,7 +219,7 @@ void MainMenu::load() mainmenu_optionsmenu = 0; // menu to connect to remote servers - mainmenu_connectmenu = 0; + mainmenu_connectmenu = (ui::Widget *) new ServerListMenu(this, "connect"); // load game menu mainmenu_loadmenu = (ui::Widget *) new SaveGameMenu(this, "load", SaveGameMenu::Load); diff --git a/src/client/mapwidget.cc b/src/client/mapwidget.cc index 20bb979..49100b2 100644 --- a/src/client/mapwidget.cc +++ b/src/client/mapwidget.cc @@ -24,6 +24,9 @@ MapWidget::MapWidget(ui::Widget *parent) : ui::Widget(parent) mapwidget_target = 0; mapwidget_hover_id = 0; mapwidget_zoom = 1.0f; + + // make sure the map has a tooltip + set_tooltip(); } MapWidget::~MapWidget() @@ -43,6 +46,12 @@ void MapWidget::set_target(const core::Entity *entity) void MapWidget::set_zone(core::Zone *zone) { mapwidget_zone = zone; + + // verify current target + if (mapwidget_target && (mapwidget_zone != mapwidget_target->zone())) + { + mapwidget_target = nullptr; + } } bool MapWidget::on_mousepress(const unsigned int button) @@ -124,11 +133,13 @@ void MapWidget::draw() // global mouse cursor location const math::Vector2f cursor(ui::root()->global_mouse_coords()); mapwidget_hover_id = 0; + set_tooltip(); // map center math::Vector2f map_center(map_location[0] + map_size / 2.0f, map_location[1] + map_size / 2.0f); math::Vector2f icon_location; const float r = 12.0f; // radius of map icons + const float rt = 24.0f; // radius of target icons float scale = 4096.0f; // map size in game units math::Color color; @@ -154,6 +165,7 @@ void MapWidget::draw() if (math::distancesquared(cursor, icon_location) < (r*r)) { mapwidget_hover_id = entity->id(); + set_tooltip(entity->name()); } if (entity == mapwidget_target) @@ -264,6 +276,43 @@ void MapWidget::draw() } gl::end(); + + if (mapwidget_target) + { + // draw target icon + size_t texture_target = 0; + if (mapwidget_target->has_flag(core::Entity::Dockable)) + { + texture_target = render::Textures::load("bitmaps/icons/map_dockable"); + } else { + texture_target = render::Textures::load("bitmaps/icons/map_target"); + } + + icon_location.assign(map_center); + icon_location[0] -= map_size / scale * mapwidget_target->location().y(); + icon_location[1] -= map_size / scale * mapwidget_target->location().x(); + + texture_current = render::Textures::bind(texture_target); + + gl::begin(gl::Quads); + + math::Color color(1.0); + gl::color(color); + + glTexCoord2f(0.0f, 0.0f); + gl::vertex(icon_location.x() - rt, icon_location.y() - rt); + + glTexCoord2f(1.0f, 0.0f); + gl::vertex(icon_location.x() + rt, icon_location.y() - rt); + + glTexCoord2f(1.0f, 1.0f); + gl::vertex(icon_location.x() + rt, icon_location.y() + rt); + + glTexCoord2f(0.0f, 1.0f); + gl::vertex(icon_location.x() - rt, icon_location.y() + rt); + + gl::end(); + } // draw localcontrol icon // TODO draw a ship icon diff --git a/src/client/savegamemenu.cc b/src/client/savegamemenu.cc index d7b8293..aa43087 100644 --- a/src/client/savegamemenu.cc +++ b/src/client/savegamemenu.cc @@ -81,14 +81,14 @@ SaveGameMenu::SaveGameMenu(ui::Widget *parent, const char *label, const Mode mod savegamemenu_descrlabel->set_background(true); savegamemenu_descrlabel->set_border(true); + // delete button is a child of description label + savegamemenu_deletebutton = new ui::IconButton(savegamemenu_descrlabel, "bitmaps/icons/button_delete", "Delete"); + savegamemenu_deletebutton->set_label("delete"); + // save button savegamemenu_savebutton = new ui::Button(this, "Save"); savegamemenu_savebutton->set_label("save"); - // delete button - savegamemenu_deletebutton = new ui::IconButton(this, "bitmaps/icons/button_delete", "Delete"); - savegamemenu_deletebutton->set_label("delete"); - // cancel save/load/overwrite button savegamemenu_cancelbutton = new ui::Button(this, "Cancel"); savegamemenu_cancelbutton->set_label("cancel"); @@ -114,7 +114,7 @@ SaveGameMenu::~SaveGameMenu() void SaveGameMenu::resize() { const float padding = ui::UI::padding; - const float icon_size = 24.0f; // small icons + const float icon_size = ui::UI::icon_small; // resize title label savegamemenu_titlelabel->set_size(width() - padding * 2.0f, savegamemenu_titlelabel->font()->height()); @@ -127,20 +127,13 @@ void SaveGameMenu::resize() // resize files listview savegamemenu_filelistview->set_size( ui::UI::elementsize.width(), - height() - icon_size - padding * 3.0f - savegamemenu_titlelabel->bottom() + height() - 2.0f * padding - savegamemenu_titlelabel->bottom() ); savegamemenu_filelistview->set_location( padding, savegamemenu_titlelabel->bottom() + padding ); - // resize delete button - savegamemenu_deletebutton->set_size(icon_size, icon_size); - savegamemenu_deletebutton->set_location( - savegamemenu_filelistview->left(), - savegamemenu_filelistview->bottom() + padding - ); - // resize description title savegamemenu_descrtitle->set_size( width() - savegamemenu_filelistview->right() - 2.0f * padding, @@ -154,13 +147,20 @@ void SaveGameMenu::resize() // resize description label savegamemenu_descrlabel->set_size( savegamemenu_descrtitle->width(), - savegamemenu_filelistview->bottom() - savegamemenu_descrtitle->bottom() - padding + savegamemenu_filelistview->bottom() - savegamemenu_descrtitle->bottom() - 2.0f * padding - ui::UI::elementsize.height() ); savegamemenu_descrlabel->set_location( savegamemenu_filelistview->right() + padding, savegamemenu_descrtitle->bottom() + padding ); + // resize delete button + savegamemenu_deletebutton->set_size(icon_size, icon_size); + savegamemenu_deletebutton->set_location( + savegamemenu_descrtitle->width() - savegamemenu_deletebutton->width() - padding, + padding + ); + // resize screenshot const model::Material *screenshotmaterial = model::Material::find("ui/screenshot"); if (screenshotmaterial) { diff --git a/src/client/serverlistmenu.cc b/src/client/serverlistmenu.cc new file mode 100644 index 0000000..44bd302 --- /dev/null +++ b/src/client/serverlistmenu.cc @@ -0,0 +1,173 @@ +/* + client/serverlistmenu.cc + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#include "client/serverlistmenu.h" +#include "client/closeiconbutton.h" + +#include "ui/ui.h" + +#include "core/commandbuffer.h" + +#include "sys/sys.h" + + +namespace client +{ + +ServerListMenu::ServerListMenu(ui::Widget *parent, const char *label) : + ui::Window(parent) +{ + set_label(label); + set_border(true); + set_background(true); + set_font(ui::root()->font_small()); + + // window title + serverlistmenu_titlelabel = new ui::Label(this); + serverlistmenu_titlelabel->set_label("connect"); + serverlistmenu_titlelabel->set_text("CONNECT"); + serverlistmenu_titlelabel->set_background(false); + serverlistmenu_titlelabel->set_border(false); + serverlistmenu_titlelabel->set_font(ui::root()->font_large()); + serverlistmenu_titlelabel->set_alignment(ui::AlignCenter); + + // close button + serverlistmenu_closebutton = new CloseIconButton(serverlistmenu_titlelabel); + + // server listview + serverlistmenu_serverlistview = new ui::ListView(this); + serverlistmenu_serverlistview->set_label("files"); + + // save button + serverlistmenu_connectbutton = new ui::Button(this, "Connect"); + serverlistmenu_connectbutton->set_label("connect"); +} + +ServerListMenu::~ServerListMenu() +{ +} + +void ServerListMenu::resize() +{ + const float padding = ui::UI::padding; + + // resize title label + serverlistmenu_titlelabel->set_size(width() - padding * 2.0f, serverlistmenu_titlelabel->font()->height()); + serverlistmenu_titlelabel->set_location(padding, padding); + + // resize close button + serverlistmenu_closebutton->set_size(serverlistmenu_titlelabel->font()->height(), serverlistmenu_titlelabel->font()->height()); + serverlistmenu_closebutton->set_location(serverlistmenu_titlelabel->width() - serverlistmenu_closebutton->width(), 0); + + // resize files listview + serverlistmenu_serverlistview->set_size( + width() - padding * 2.0f, + height() - ui::UI::elementsize.height() - padding * 3.0f - serverlistmenu_titlelabel->bottom() + ); + serverlistmenu_serverlistview->set_location( + padding, + serverlistmenu_titlelabel->bottom() + padding + ); + + // resize connect button + serverlistmenu_connectbutton->set_size(ui::UI::elementsize); + serverlistmenu_connectbutton->set_location( + (width() - padding * 2.0f - serverlistmenu_connectbutton->width()) * 0.5f, + height() - padding - serverlistmenu_connectbutton->height() + ); +} + +void ServerListMenu::refresh() +{ + const float padding = ui::UI::padding; + + serverlistmenu_serverlistview->clear(); + serverlistmenu_connectbutton->show(); + serverlistmenu_connectbutton->disable(); + + // FIXME support custom port numbers + ui::ListItem *listitem = new ui::ListItem(serverlistmenu_serverlistview, "osirion.org development server"); + listitem->set_value("osirion.org"); + listitem->set_sortkey(""); + + listitem->set_font(ui::root()->font_tiny()); + listitem->set_height(listitem->font()->height() + padding); + + serverlistmenu_serverlistview->sort(false); + serverlistmenu_serverlistview->event_resize(); + +} + +void ServerListMenu::hide() +{ + Window::hide(); +} + +void ServerListMenu::show() +{ + Window::show(); + refresh(); +} + +void ServerListMenu::show_connect_info() +{ + if (!serverlistmenu_serverlistview->selected()) { + serverlistmenu_connectbutton->disable(); + } else { + serverlistmenu_connectbutton->enable(); + } +} + +void ServerListMenu::connect() +{ + if (serverlistmenu_serverlistview->selected()) { + std::stringstream str; + str << "connect " << serverlistmenu_serverlistview->selected()->value(); + core::CommandBuffer::exec(str.str()); + } +} + +bool ServerListMenu::on_keypress(const int key, const unsigned int modifier) +{ + if (key == SDLK_ESCAPE) { + if (visible()) { + // hide the parent mainwindow + parent()->hide(); + return true; + } + } + return false; +} + +bool ServerListMenu::on_emit(ui::Widget *sender, const ui::Widget::Event event, void *data) +{ + if (sender == serverlistmenu_closebutton) { + if (event == ui::Widget::EventButtonClicked) { + // hide the parent mainwindow + parent()->hide(); + return true; + } + } else if (sender == serverlistmenu_connectbutton) { + if (event == ui::Widget::EventButtonClicked) { + // do the actual connect and close the window + parent()->hide(); + connect(); + return true; + } + } else if (sender == serverlistmenu_serverlistview) { + if (event == ui::Widget::EventListViewChanged) { + show_connect_info(); + return true; + } + } + + return Window::on_emit(sender, event, data); +} + + +} // namespace client + + diff --git a/src/client/serverlistmenu.h b/src/client/serverlistmenu.h new file mode 100644 index 0000000..6638bd4 --- /dev/null +++ b/src/client/serverlistmenu.h @@ -0,0 +1,70 @@ +/* + client/serverlistmenu.h + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_CLIENT_SERVERLISTMENU_H__ +#define __INCLUDED_CLIENT_SERVERLISTMENU_H__ + +#include "ui/button.h" +#include "ui/iconbutton.h" +#include "ui/inputbox.h" +#include "ui/label.h" +#include "ui/listview.h" +#include "ui/window.h" + +namespace client +{ + +class ServerListMenu : public ui::Window +{ +public: + enum Mode { Save = 0, Load = 1 }; + + ServerListMenu(ui::Widget *parent = 0, const char *label = 0); + virtual ~ServerListMenu(); + +protected: + + /// called when the widget receives a key press + virtual bool on_keypress(const int key, const unsigned int modifier); + + /// called if the widget receives an emit evet + virtual bool on_emit(ui::Widget *sender, const ui::Widget::Event event, void *data); + + virtual void resize(); + + virtual void show(); + + virtual void hide(); + + void refresh(); + + /** + * @brief connect to the currently selected server + * */ + void connect(); + + /** + * @brief show information for the currently selected server + * */ + void show_connect_info(); + +private: + + ui::Label *serverlistmenu_titlelabel; + ui::IconButton *serverlistmenu_closebutton; + ui::ListView *serverlistmenu_serverlistview; + ui::Button *serverlistmenu_connectbutton; + + +}; // class ServerListMenu + + +} // namespace client + + +#endif // __INCLUDED_CLIENT_SERVERLISTMENU_H__ + + diff --git a/src/client/video.cc b/src/client/video.cc index 5f8c14d..15f1c04 100644 --- a/src/client/video.cc +++ b/src/client/video.cc @@ -260,7 +260,7 @@ void restart() shutdown(); // clear models and materials - /* resetting the rednder subsystem will force a reload of all materials + /* resetting the render subsystem will force a reload of all materials */ model::Model::clear(); diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc index 3adcbb0..99601a6 100644 --- a/src/model/mapfile.cc +++ b/src/model/mapfile.cc @@ -459,7 +459,7 @@ bool MapFile::read_patchdef() // binomial coefficient const float binom[3] = {1.0f, 2.0f, 1.0f}; - const size_t subdivide_max = 4; + const size_t subdivide_max = 8; size_t subdivide_u = 0; size_t subdivide_v = 0; diff --git a/src/model/vertexarray.h b/src/model/vertexarray.h index 1474c67..5f542a8 100644 --- a/src/model/vertexarray.h +++ b/src/model/vertexarray.h @@ -13,7 +13,7 @@ namespace model { // number of segments in a sphere circle, must be uneven -const int SPHERESEGMENTS = 65; +const int SPHERESEGMENTS = 127; /// global geometry vertex array /** a VertexArray acts like a stack of model vertices, it has no knowledge of what it is holding diff --git a/src/render/tgafile.cc b/src/render/tgafile.cc index 15447df..ee12f8a 100644 --- a/src/render/tgafile.cc +++ b/src/render/tgafile.cc @@ -353,7 +353,7 @@ void TGA::save(const char *filename, Image & image) // write footer (optional, but the specification recommends it) char footer[26]; memset(footer, 0, sizeof(footer)); - strncpy(&footer[8] , "TRUEVISION-XFILE", 16); + memcpy(footer + 8 , "TRUEVISION-XFILE", 16); footer[24] = '.'; footer[25] = 0; ofs.write(footer, sizeof(footer)); diff --git a/src/ui/ui.cc b/src/ui/ui.cc index 976ddab..95b18e2 100644 --- a/src/ui/ui.cc +++ b/src/ui/ui.cc @@ -4,9 +4,6 @@ the terms of the GNU General Public License version 2 */ -#include <string> -#include <sstream> - #include "audio/audio.h" #include "auxiliary/functions.h" #include "core/core.h" @@ -21,6 +18,10 @@ #include "ui/ui.h" #include "ui/widget.h" +#include <string> +#include <sstream> +#include <cassert> + namespace ui { @@ -33,6 +34,8 @@ math::Vector2f UI::elementsize(256, 32); float UI::padding = 24.0f; float UI::margin = 16.0f; +float UI::icon_small = 24.0f; + float UI::pointer_size = 48.0f; core::Cvar *ui_tooltiptimeout = nullptr; diff --git a/src/ui/ui.h b/src/ui/ui.h index c3b2f18..009bed6 100644 --- a/src/ui/ui.h +++ b/src/ui/ui.h @@ -65,7 +65,7 @@ public: /// load settings from ui.ini void load_settings(); - /* -- fonts ------------------------------------------------ */ + /* -- font & icon sizes------------------------------------- */ /// default tiny font inline const Font *font_tiny() const { @@ -77,17 +77,18 @@ public: return ui_font_small; } - /// default medium font + /// default large font inline const Font *font_large() const { return ui_font_large; } - + + /* -- mouse pointer ---------------------------------------- */ + + /// current position of the mouse cursor in global window coordinates inline const math::Vector2f & global_mouse_coords() { return mouse_cursor; } - - /* -- mouse pointer ---------------------------------------- */ /// set mouse pointer bitmap void set_pointer(const char *pointerbitmap = 0, const Palette::Color color = Palette::Highlight, const bool animated = false); @@ -110,7 +111,8 @@ public: static float pointer_size; - + static float icon_small; + protected: /* -- event handlers --------------------------------------- */ |