本文整理汇总了C++中GuiWindow::get_height方法的典型用法代码示例。如果您正苦于以下问题:C++ GuiWindow::get_height方法的具体用法?C++ GuiWindow::get_height怎么用?C++ GuiWindow::get_height使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuiWindow
的用法示例。
在下文中一共展示了GuiWindow::get_height方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_key
void Client::set_key(MappedKey::Device dev, int param) {
set_key(dev, param, binding.left, PlayerKeyStateLeft);
set_key(dev, param, binding.right, PlayerKeyStateRight);
set_key(dev, param, binding.up, PlayerKeyStateUp);
set_key(dev, param, binding.down, PlayerKeyStateDown);
set_key(dev, param, binding.jump, PlayerKeyStateJump);
set_key(dev, param, binding.fire, PlayerKeyStateFire);
set_key(dev, param, binding.drop1, PlayerKeyStateDrop1);
set_key(dev, param, binding.drop2, PlayerKeyStateDrop2);
set_key(dev, param, binding.drop3, PlayerKeyStateDrop3);
if (binding.chat.device == dev && binding.chat.param == param) {
if (!get_stack_count()) {
subsystem.clear_input_buffer();
int vw = subsystem.get_view_width();
int vh = subsystem.get_view_height();
int ww = 350;
int wh = 30;
GuiWindow *window = push_window(1, 1, ww, wh, "Enter Message");
window->set_on_keydown(static_window_keydown, this);
window->set_on_joybuttondown(static_window_joybutton_down, this);
ww = window->get_client_width();
chat_textbox = create_textbox(window, Spc, Spc, ww - 2 * Spc, "");
window->set_height(window->get_height() - window->get_client_height() + 2 * Spc + chat_textbox->get_height());
window->set_x(vw / 2 - window->get_client_width() / 2);
window->set_y(vh / 2 - window->get_client_height() / 2);
chat_textbox->set_focus();
if (me) {
me->state.client_server_state.key_states = 0;
}
}
}
if (binding.stats.device == dev && binding.stats.param == param) {
if (!get_stack_count()) {
if (tournament) {
tournament->show_stats(true);
}
}
}
if (binding.escape.device == dev && binding.escape.param == param) {
show_options_menu();
}
}
示例2: sevt_data
void Client::sevt_data(ServerEvent& evt) {
GTransport *t = reinterpret_cast<GTransport *>(evt.data);
while (true) {
t->from_net();
switch (t->cmd) {
case GPCServerMessage:
{
size_t sz = 0;
std::string msg(reinterpret_cast<char *>(t->data), t->len);
std::vector<std::string> lines;
while (true) {
sz++;
size_t pos = msg.find("|");
if (pos == std::string::npos) {
lines.push_back(msg);
break;
}
lines.push_back(msg.substr(0, pos));
msg = msg.substr(pos + 1);
}
int vw = subsystem.get_view_width();
int vh = subsystem.get_view_height();
int ww = 200;
int wh = 130;
int x = 10;
int y = 10;
GuiWindow *window = push_window(x, y, ww, wh, "Server Message");
Font *f = get_font();
int text_height = 0;
int ly = Spc;
int maxw = 0;
for (size_t i = 0; i < sz; i++) {
create_label(window, Spc, ly, lines[i]);
ly += f->get_font_height();
text_height += f->get_font_height();
int tw = f->get_text_width(lines[i]) + 2 * Spc;
maxw = (tw > maxw ? tw : maxw);
}
int maxh = text_height + 2 * Spc;
int bw = 46;
int bh = 18;
create_button(window, maxw / 2 - bw / 2, maxh, bw, bh, "Okay", static_window_close_click, this);
maxh += bh + Spc;
window->set_width(window->get_width() - window->get_client_width() + maxw);
window->set_height(window->get_height() - window->get_client_height() + maxh);
window->set_x(vw / 2 - window->get_width() / 2);
window->set_y(vh / 2 - window->get_height() / 2);
break;
}
case GPCMapState:
{
GTournament *tour = reinterpret_cast<GTournament *>(t->data);
tour->from_net();
if (tournament) {
delete tournament;
}
/* reload resources? */
if (reload_resources) {
resources.reload_resources();
load_resources();
reload_resources = false;
}
/* setup tournament */
bool warmup = ((tour->flags & TournamentFlagWarmup) != 0);
GamePlayType type = static_cast<GamePlayType>(tour->gametype);
MapConfiguration config(type, tour->map_name, tour->duration, tour->warmup);
tournament = factory.create_tournament(config, false, warmup, players, 0);
factory.set_tournament_id(tour->tournament_id);
tournament->set_following_id(my_id);
tournament->set_player_configuration(&player_config);
tournament->set_team_names(team_red_name, team_blue_name);
/* reopen, if join request window is already open */
if (me && me->joining) {
tournament->reopen_join_window(me);
}
break;
}
case GPCIdentifyPlayer:
{
player_id_t *nid = reinterpret_cast<player_id_t *>(t->data);
my_id = ntohs(*nid);
if (tournament) {
tournament->set_following_id(my_id);
}
break;
}
case GPCReady:
{
if (tournament) {
tournament->set_ready();
}
//.........这里部分代码省略.........