void OnShowCommand(const CString& sCommand) { CString sMsgs = t_p("1 CTCP message", "{1} CTCP messages", m_iThresholdMsgs)(m_iThresholdMsgs); CString sSecs = t_p("every second", "every {1} seconds", m_iThresholdSecs)(m_iThresholdSecs); PutModule(t_f("Current limit is {1} {2}")(sMsgs, sSecs)); }
void OnSetTimerCommand(const CString& sLine) { SetAwayWait(sLine.Token(1).ToUInt()); if (m_iAwayWait == 0) PutModule(t_s("Timer disabled")); else PutModule(t_p("Timer set to 1 second", "Timer set to: {1} seconds", m_iAwayWait)(m_iAwayWait)); }
void ViewPort::draw() { // // // ================ // === A quick overview of the variables used below === // for displaying a part of a TileMap. // ================ // // The idea is only to display // n_tiles_x_ * n_tiles_y_ number of tiles from the TileMap // starting from tile pos_in_tilemap. The number of tiles displayed // can be changed dynamically by modifying the mag_ property, which // sets the 'magnification' of the ViewPort. // // TileMap // (0,0) // F G L Q // J K M R // N O P S // T U V W // // e.g. pos_in_tilemap == (0,0) == F // n_tiles_x_ == 2 and n_tiles_y_ == 2 by default, so // by default four tiles are drawn: F, G, J, K. // // ViewPort // pos_ (p_start = pos_ + start_) // start_ // [------------] // // tile_sz_[0] // < > ^ // tile_sz[1] ^ F G ' // v // V_height // J K // ' // [------------] v // end_ // // <- V_width -> // // n_tiles_x_ = [F, G, ...].size() // n_tiles_y_ = [F, J, ...].size() // const float& V_width = end_[0] - start_[0]; const float& V_height = end_[1] - start_[1]; unsigned int n_x_flr = std::floor(n_tiles_xy_[0]), n_y_flr = std::floor(n_tiles_xy_[1]); vector2 tile_sz(V_width / n_x_flr, V_height / n_y_flr); // x, y will be small Tile* cmt = 0; vector2 t_p(0.0, 0.0); tm_.setScale(tile_sz); for (unsigned int y = 0; y < n_y_flr; ++y) { for (unsigned int x = 0; x < n_x_flr; ++x) { // TODO: move this loop into a separate fn, that can // have a function pointer passed in, so that it's // easy to iterate over the ViewPort t_p[0] = x + pos_in_tm_[0] ; t_p[1] = y + pos_in_tm_[1] ; cmt = tm_.tile(t_p[0], t_p[1]); if (cmt != 0) { cmt->setSize(tile_sz); cmt->setPosition(vector2(x, y)); cmt->setDisplayOffset(start_); cmt->draw(); } } } }
void OnTimerCommand(const CString& sLine) { PutModule(t_p("Current timer setting: 1 second", "Current timer setting: {1} seconds", m_iAwayWait)(m_iAwayWait)); }