GuiFlatButton::GuiFlatButton(std::string string, GLfloat x, GLfloat y) : GuiContext(x,y) { label = new GuiLabel(FontManager::font("small"), string, 0, 0, 1.0, true); background = new GuiColorRect(0, 0, label->get_width()+20, label->get_height()+10); add(background); add(label); GuiContext::set_width(background->get_width()); set_height(background->get_height()); // State active = false; enabled = true; // Customisation Color4fSet((&activeColor), 0.0f, 0.0f, 0.0f, 0.9f); Color4fSet((&inactiveColor), 0.0f, 0.0f, 0.0f, 0.4f); deactivate(); // Highlight on mouseover onMouseEnter = boost::bind(&GuiFlatButton::activate, this); onMouseExit = boost::bind(&GuiFlatButton::deactivate, this); // Poor man's reflection className = "GuiFlatButton"; }
Rectangle::Rectangle(float Width, float Height) { set_left ( 0 ); set_bottom ( 0 ); set_width ( Width ); set_height ( Height ); }
struct node *rot_RL(struct node *old) { struct node *right, *ret; right = old->right; ret = right->left; old->right = ret->left; right->left = ret->right; ret->left = old; ret->right = right; set_height(old); set_height(right); set_height(ret); return ret; }
struct node *rot_LR(struct node *old) { struct node *left, *ret; left = old->left; ret = left->right; old->left = ret->right; left->right = ret->left; ret->right = old; ret->left = left; set_height(old); set_height(left); set_height(ret); return ret; }
void Edit::on_enter() { #ifdef __windows__ if(Keyboard::is_pressed(0x0D)) #endif #ifdef __gnu_linux__ if(Keyboard::is_pressed(0xff0d)) #endif { if(is_multilined()) // a multilined editor { if(get_text().length() >= get_character_limit()) // if text length has reached character_limit { // double the height of the edit set_height(get_height() * 2); // GOOD! // add to the character_limit (new character_limit) set_character_limit(get_character_limit() + get_character_limit()); // ??? // newline??? set_text(get_text() + "\n"); // reset cursor x position set_cursor_x(0); // set cursor y position int char_height = 12; set_cursor_y(get_cursor_y() + char_height); } } } }
struct node *delete_node(struct node *root) { struct node *child, *aux; unsigned int key; if (root->left == NULL) { aux = root->right; free(root); return aux; } else if (root->right == NULL) { aux = root->left; free(root); return aux; } else { if (root->right->left == NULL) { child = root->right; root->value = child->value; root->key = child->key; root->right = child->right; free(child); } else { key = root->key; child = node_min(root->right); root->value = child->value; root->key = child->key; child->key = key; delete_rec(root, key); } set_height(root); return rebalance(root); } }
Rect& Rect::operator=(const RECT& r) { origin_.SetPoint(r.left, r.top); set_width(r.right - r.left); set_height(r.bottom - r.top); return *this; }
YCbCrInput::YCbCrInput(const ImageFormat &image_format, const YCbCrFormat &ycbcr_format, unsigned width, unsigned height, YCbCrInputSplitting ycbcr_input_splitting) : image_format(image_format), ycbcr_format(ycbcr_format), ycbcr_input_splitting(ycbcr_input_splitting), width(width), height(height), resource_pool(NULL) { pbos[0] = pbos[1] = pbos[2] = 0; texture_num[0] = texture_num[1] = texture_num[2] = 0; set_width(width); set_height(height); pixel_data[0] = pixel_data[1] = pixel_data[2] = NULL; owns_texture[0] = owns_texture[1] = owns_texture[2] = false; register_uniform_sampler2d("tex_y", &uniform_tex_y); if (ycbcr_input_splitting == YCBCR_INPUT_SPLIT_Y_AND_CBCR) { num_channels = 2; register_uniform_sampler2d("tex_cbcr", &uniform_tex_cb); } else { assert(ycbcr_input_splitting == YCBCR_INPUT_PLANAR); num_channels = 3; register_uniform_sampler2d("tex_cb", &uniform_tex_cb); register_uniform_sampler2d("tex_cr", &uniform_tex_cr); } }
void CharacterCamera::_set(const String& p_name, const Variant& p_value) { if (p_name=="type") set_camera_type((CameraType)((int)(p_value))); else if (p_name=="orbit") set_orbit(p_value); else if (p_name=="height") set_height(p_value); else if (p_name=="inclination") set_inclination(p_value); else if (p_name=="max_orbit_x") set_max_orbit_x(p_value); else if (p_name=="min_orbit_x") set_min_orbit_x(p_value); else if (p_name=="max_distance") set_max_distance(p_value); else if (p_name=="min_distance") set_min_distance(p_value); else if (p_name=="distance") set_distance(p_value); else if (p_name=="clip") set_clip(p_value); else if (p_name=="autoturn") set_autoturn(p_value); else if (p_name=="autoturn_tolerance") set_autoturn_tolerance(p_value); else if (p_name=="autoturn_speed") set_autoturn_speed(p_value); }
void setup() { set_name( "bear" ); set_desc( "a furry bear" ); set_height( 200 ); set_weight( 8000 ); set_stats( ({ 6, 4, -2, 8, -4 }) );
void setup() { set_name( "guppy" ); set_long( "Fish, yes. A fish. Nice generic standard fish thing.\n" ); set_height( 15 ); set_weight( 40 ); set_desc( "a beautiful looking guppy" ); set_stats( ({ -2, 14, -4, -4, -6 }) );
void setup() { set_name( "weasel" ); set_long( "A small brown furred animal.\n" ); set_height( 15 ); set_weight( 30 ); set_desc( "small brown meateater" ); set_stats( ({ -2, 8, -2, -4, -4 }) );
void setup() { set_name( "skunk" ); set_long( "A small black and white animal.\n" ); set_height( 15 ); set_weight( 30 ); set_desc( "small brown meateater" ); set_stats( ({ -2, 8, -2, -4, -4 }) );
/* COPY CONSTRUCTOR */ DrawingObject::DrawingObject(const DrawingObject& o) { set_type(o.type()); set_left(o.left()); set_bottom(o.bottom()); set_width(o.width()); set_height(o.height()); }
/* DEFAULT CONSTRUCTOR */ DrawingObject::DrawingObject() { set_type("OBJECT"); set_left(0); set_bottom(0); set_width(0); set_height(0); }
ship_selection_button::ship_selection_button(ui_container* parent) : ui_button(parent) { set_width(16.f); set_height(16.f); set_halign(horizontal_alignment::left); set_valign(vertical_alignment::top); set_margin(10.f); selection_state = ship_selection_button_state::unknown; }
void setup() { set_name( "vulture" ); set_long( "A largish, rather scruffy-looking bird with an ugly, " "featherless head and a big crooked beak.\n" ); set_desc( "a somewhat evil-looking old vulture\n" ); set_height( 40 ); set_weight( 200 ); set_stats( ({ 0, 14, -4, 2, -6 }) );
int insert(ROOT *r, int data) { NODE *new_node, *root = *r; int left_h = -1, right_h = -1; int diff,rotation_type; //tree is empty if(root == NULL) { new_node = (NODE *)malloc(sizeof(NODE)); new_node->info = data; new_node->height = 0; new_node->left = new_node->right = NULL; *r = new_node; return 0; } if(root->left) left_h = root->left->height; if(root->right) right_h = root->right->height; if(compare(data, root->info)<0) { left_h = insert(&(root->left), data); rotation_type = find_rotation_type(root->info, root->left->info, data); } else if(compare(data, root->info)>0) { right_h = insert(&(root->right), data); rotation_type = find_rotation_type(root->info, root->right->info, data); } else { printf("Value repeated"); return -1; } diff = left_h-right_h; if(diff>1 || diff<-1) { printf("Tree is Un-Balanced at node data %d ", root->info); if(rotation_type == 1) printf("required LL rotation\n"); if(rotation_type == 2) printf("required RL rotation\n"); if(rotation_type == 3) printf("required LR rotation\n"); if(rotation_type == 4) printf("required RR rotation\n"); //this call is for doing rotation do_rotation(r,rotation_type); printf("rotation done successfully\n"); root = *r; } return set_height(root); }
void rotate_RR(ROOT *r) { NODE *r1=*r,*r2,*t1,*t2,*t3; r2 = r1->right; t1 = r1->left; t2 = r2->left; t3 = r2->right; r1->right = t2; r2->left = r1; set_height(r1); set_height(r2); *r = r2; }
void button::calculate_size() { if (type_ == TYPE_IMAGE){ SDL_Rect loc_image = location(); #ifdef SDL_GPU loc_image.h = image_.height(); loc_image.w = image_.width(); #else loc_image.h = image_->h; loc_image.w = image_->w; #endif set_location(loc_image); return; } SDL_Rect const &loc = location(); bool change_size = loc.h == 0 || loc.w == 0; if (!change_size) { unsigned w = loc.w - (type_ == TYPE_PRESS || type_ == TYPE_TURBO ? horizontal_padding : checkbox_horizontal_padding + base_width_); if (type_ != TYPE_IMAGE) { int fs = font_size; int style = TTF_STYLE_NORMAL; std::string::const_iterator i_beg = label_text_.begin(), i_end = label_text_.end(), i = font::parse_markup(i_beg, i_end, &fs, NULL, &style); if (i != i_end) { std::string tmp(i, i_end); label_text_.erase(i - i_beg, i_end - i_beg); label_text_ += font::make_text_ellipsis(tmp, fs, w, style); } } } if (type_ != TYPE_IMAGE){ textRect_ = font::draw_text(NULL, screen_area(), font_size, font::BUTTON_COLOR, label_text_, 0, 0); } if (!change_size) return; set_height(std::max(textRect_.h+vertical_padding,base_height_)); if(type_ == TYPE_PRESS || type_ == TYPE_TURBO) { if(spacing_ == MINIMUM_SPACE) { set_width(textRect_.w + horizontal_padding); } else { set_width(std::max(textRect_.w+horizontal_padding,base_width_)); } } else { if(label_text_.empty()) { set_width(base_width_); } else { set_width(checkbox_horizontal_padding + textRect_.w + base_width_); } } }
Exit::Exit() { set_type("EXIT"); set_left(EXIT_LEFT); set_bottom(EXIT_BOTTOM); set_width(EXIT_WIDTH); set_height(EXIT_HEIGHT); add_input(CircuitObject()); close(); }
//======================================================================================= // GmoBoxControl //======================================================================================= GmoBoxControl::GmoBoxControl(Control* ctrl, const UPoint& origin, LUnits width, LUnits height, ImoStyle* style) : GmoBox(GmoObj::k_box_control, ctrl->get_owner_imo() ) , m_pStyle(style) , m_pControl(ctrl) { set_origin(origin); set_width(width); set_height(height); }
/** * \brief Set the height in the image resource. * \param height The new value. */ void bf::sprite::set_clip_height( const unsigned int height ) { if ( m_clip_height != height ) { m_clip_height = height; m_spritepos_entry.clear(); if ( get_auto_size() ) set_height(height); } } // sprite::set_clip_height()
FractalProto * Fractal::serialize() { auto fp = new FractalProto(); fp->set_bottom(bottom); fp->set_height(height); fp->set_left(left); fp->set_right(right); fp->set_width(width); fp->set_top(top); fp->set_maxiter(maxiter); return fp; }
/* CONSTRUCTOR */ Bit::Bit(int value) { if(value == 0) set_type("0"); else if(value == 1) set_type("1"); else set_type("BIT"); set_width(BIT_WIDTH); set_height(BIT_HEIGHT); }
CircuitObject::CircuitObject(string type) { set_type(type); set_left(0); set_bottom(0); set_width(0); set_height(0); set_input1(NULL); set_input2(NULL); set_output(NULL); set_output_value(0); }
void create() { ::create(); /* OBJEDIT { */ set_name( "bear skin" ); set_gettable( 1 ); set_droppable( 1 ); set_height( 5 ); set_weight( 2000 ); set_bulk( 1800 ); set_value( 70 ); /* } OBJEDIT */ }
Shelf::Shelf(int x, int y, int width, int height, GuiDimension dimension) : GuiContext(x,y), dimension(dimension), isIn(true) { set_width(width); set_height(height); edgeVisible = 0; background = new GuiColorRect(0,0,width,height); background->set_rgba(0.0,0.0,0.0,0.75); add(background); this->className = "Shelf"; }
void load_energy_core_data() { EntityType type = ENTITY_ENERGY_CORE; entity_data->begin_attaching_to(type); (void)ADD_COMPONENT(Position); auto dims = ADD_COMPONENT(Dimension); dims->set_height(1.0f); auto vox = ADD_COMPONENT(VoxelModel); vox->vox_dat = &VoxDats::energy_core; vox->init_hitscan = true; vox->init_draw = true; vox->frozen = true; auto health = ADD_COMPONENT(HitPoints); health->health = 200; health->health_max = 200; #if DC_SERVER auto healer = ADD_COMPONENT(Healer); healer->radius = 1.0f; auto limiter = ADD_COMPONENT(RateLimit); limiter->limit = MOB_BROADCAST_RATE; auto item_drop = ADD_COMPONENT(ItemDrop); item_drop->drop->set_max_drop_types(2); item_drop->drop->set_max_drop_amounts("energy_tank", 2); item_drop->drop->add_drop("energy_tank", 2, 0.5f); item_drop->drop->add_drop("energy_tank", 3, 0.5f); item_drop->drop->set_max_drop_amounts("small_charge_pack", 3); item_drop->drop->add_drop("small_charge_pack", 4, 0.5f); item_drop->drop->add_drop("small_charge_pack", 5, 0.3f); item_drop->drop->add_drop("small_charge_pack", 6, 0.2f); auto state = ADD_COMPONENT(StateMachine); auto conf = state->configuration; conf->add_state("idle", &stick_to_surface); #endif #if DC_CLIENT auto anim = ADD_COMPONENT(Animation); anim->count = 35; anim->count_max = 50; anim->size = 0.22f; anim->force = 5.0f; anim->color = Color(59, 99, 17); #endif }
bsaheaderdfa& bsaheaderdfa::operator =(const bsaheaderdfa& other) { if (this != &other) { set_width(other.get_width()); set_height(other.get_height()); set_compressed_size(other.compressed_size); set_u2(other.u2); set_u3(other.u3); set_frame_count(other.frame_count); } return *this; }