Esempio n. 1
0
BBEntityModel* BBComponentFactory::getComponents(const FlameThrower* flameThrower, int level)
{
    
	BBEntityModel* pRet = initComponents(flameThrower, level);
	
	return pRet;
};
Esempio n. 2
0
AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
{
  initComponents();
  m_icon = QIcon("qcurve");

  m_icon = windowIcon();
}
Esempio n. 3
0
BBEntityModel* BBComponentFactory::getComponents(const MagicCannon* magicCannon, int level)
{
    
	BBEntityModel* pRet = initComponents(magicCannon, level);
	
	return pRet;
};
Esempio n. 4
0
BBEntityModel* BBComponentFactory::getComponents(const BoneGunNest* boneGunNest, int level)
{
    
	BBEntityModel* pRet = initComponents(boneGunNest, level);
	
	return pRet;
};
Esempio n. 5
0
BBEntityModel* BBComponentFactory::getComponents(const StoneLauncher* stoneLauncher, int level)
{
    
	BBEntityModel* pRet = initComponents(stoneLauncher, level);
	
	return pRet;
};
Esempio n. 6
0
BBEntityModel* BBComponentFactory::getComponents(const Catapult* catapult, int level)
{
    
	BBEntityModel* pRet = initComponents(catapult, level);
	
	//TODO: 配置建筑配置BBEntityModel的参数值
	const CatapultLevel* catapultLevel = BuildingConfigs::getInstance()->getCatapultLevel(catapult, level);
    
    pRet->m_strModel = catapultLevel->model();
	
	//硬代码测试: 假设所有建筑物都可以提供(3000/10000)的金币存储
	pRet->setResourceStorageType(BB_RESOURCE_TYPE_GOLD);
	pRet->setMaxResourceStorage(10000);
	pRet->setCurrentResourceStorage(3000);
	
	//硬代码测试: 假设所有建筑物都可以提供(300/秒)的金币产量
	pRet->setResourceFactoryType(BB_RESOURCE_TYPE_GOLD);
	pRet->setPrevResourceFactoryTime(BBCommUtils::secondNow());
	pRet->setResourceFactoryTime(1);			//1秒
	pRet->setResourceFactoryAmount(300);	//产量
	pRet->setResourceFactoryMax(10000);		//最大存量
	pRet->setResourceFactoryCurrent(1000);	//当前存量
	
	return pRet;
};
Esempio n. 7
0
MainWindow::MainWindow(QWidget *parent)
    : QWidget(parent),

      m_updatePanelVisible(true),

      m_mainPanel(new MainPanel(this)),
      m_positionUpdateTimer(new QTimer(this)),
      m_expandDelayTimer(new QTimer(this)),
      m_sizeChangeAni(new QPropertyAnimation(this, "size")),
      m_posChangeAni(new QPropertyAnimation(this, "pos")),
      m_panelShowAni(new QPropertyAnimation(m_mainPanel, "pos")),
      m_panelHideAni(new QPropertyAnimation(m_mainPanel, "pos")),
      m_xcbMisc(XcbMisc::instance())

{
    setAccessibleName("dock-mainwindow");
    setWindowFlags(Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
    setAttribute(Qt::WA_TranslucentBackground);

    m_settings = new DockSettings(this);
    m_xcbMisc->set_window_type(winId(), XcbMisc::Dock);

    initComponents();
    initConnections();

    m_mainPanel->setFixedSize(m_settings->windowSize());

    updatePanelVisible();
    //    setStyleSheet("background-color:red;");
    connect(m_mainPanel, &MainPanel::geometryChanged, this, &MainWindow::panelGeometryChanged);
}
Esempio n. 8
0
// on "init" you need to initialize your instance
bool GameFatherLayer::init()
{
	//////////////////////////////
	// 1. super init first
	if ( !Layer::init() )
	{
		return false;
	}


	Size visibleSize = Director::getInstance()->getVisibleSize();
	Vec2 origin = Director::getInstance()->getVisibleOrigin();

	initMap();


	
	initUI();
	
	initRole();

	initComponents();
	
	return true;
}
Esempio n. 9
0
void setup () {
  Serial.begin (9600);
  initComponents();

  lcd.begin(16, 2);
  lcd.print("Hello, World!");
}
Esempio n. 10
0
void LimbsWeightDialog::on_copyToNextPushButton_clicked()
{
  int value = _weights[currentFrame];
  currentFrame++;
  emit nextFrame();
  _weights[currentFrame] = value;
  initComponents();
}
Esempio n. 11
0
void LimbsWeightDialog::on_copyToPrevPushButton_clicked()
{
  int value = _weights[currentFrame];
  currentFrame--;
  emit previousFrame();
  _weights[currentFrame] = value;
  initComponents();
}
Esempio n. 12
0
int main(int argc, char** argv) {
    int running = GL_TRUE;
    // Initialize GLFW
    if (!glfwInit()) {
        exit(EXIT_FAILURE);
    }

    glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
    //    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
    //    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 1);
    //        glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //We don't want the old OpenGL

    // Open an OpenGL window
    if (!glfwOpenWindow(1280, 720, 0, 0, 0, 0, 32, 0, GLFW_WINDOW)) {
        glfwTerminate();
        return EXIT_FAILURE;
    }

    glfwSetWindowTitle("Capivara-GL Test");

    //    glEnable(GL_LINE_SMOOTH);
    //    glEnable(GL_BLEND);
    //    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    //    glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
    //    glLineWidth(1.5f);

    glfwEnable(GLFW_KEY_REPEAT);
    glfwEnable(GLFW_STICKY_KEYS);

    glEnable(GL_MULTISAMPLE);
    glDisable(GL_DEPTH_TEST);

    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

    initComponents();
    glfwSetKeyCallback(keyCallback);
    glfwSetCharCallback(charCallback);
    glfwSetWindowRefreshCallback(display);
    glfwSetWindowSizeCallback(reshape);
    glfwSetMousePosCallback(mousePosition);
    glfwSetMouseButtonCallback(mouseButton);
    //-------------------------------------------------------------------------
    // Main loop
    while (running) {
        display();
        glfwSwapBuffers();

        running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED);
    }
    deleteComponents();

    // Close window and terminate GLFW
    glfwTerminate();
    return EXIT_SUCCESS;
}
Esempio n. 13
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    co = new Communication(this);
    timer = new QTimer();
    timer->setInterval(200);
    connect(timer, SIGNAL(timeout()), this, SLOT(update()));
    timer->start();

    initComponents();
}
Esempio n. 14
0
LimbsWeightDialog::LimbsWeightDialog(QString animationName, QList<BVHNode*>* limbs, int frame,
                                     int totalFrames, QWidget *parent)
  : QDialog(parent), ui(new Ui::LimbsWeightDialog)
{
  currentFrame = frame;
  this->totalFrames = totalFrames;
  this->limbs = limbs;

  ui->setupUi(this);
  foreach(BVHNode* limb, *limbs)
    ui->limbNamesListWidget->addItem(limb->name());

  initComponents();
  ui->animNameLabel->setText(animationName);
}
Esempio n. 15
0
 StageNode(int argc, char** argv)
 : wall_rate_(10.0)
 {
   // Read settings from the parameter server.
   ros::NodeHandle pn("~");
   std::string world_file;
   int window_width, window_height;
   
   pn.param<std::string>("world_file", world_file, "/opt/stage/share/stage/worlds/simple.world");
   pn.param<int>("window_width", window_width, 400);
   pn.param<int>("window_height", window_height, 300);
   pn.param<bool>("headless", headless, false);
   if (!fileExists(world_file))
   {
     throw std::runtime_error("world file does not exist");
   }
   // Initialize stage and load the world.
   ROS_INFO("Initializing simulator.");
   ROS_INFO("Libstage version: %s.", Stg::Version());
   ROS_INFO("World description file: %s.", world_file.c_str());
   Stg::Init(&argc, &argv);
   if (headless)
   {
     ROS_INFO("Mode: headless.");
     world_ = std::unique_ptr<Stg::World>(new Stg::World("Stage (ROS)"));
   }
   else
   {
     world_ = std::unique_ptr<Stg::World>(new Stg::WorldGui(window_width, window_height, "Stage (ROS)"));
   }
   world_->Load(world_file);
   world_->AddUpdateCallback((Stg::world_callback_t)invokeUpdate, this);
   // Create wrappers around robot components and establish transform tree.
   initComponents();
   createTransformsPublisher();
   readWorldSize(world_file);
   // Prepare a topic to publish simulation clock.
   ros::NodeHandle nh;
   nh.setParam("/use_sim_time", true);
   nh.setParam("/world_width", world_width_);
   nh.setParam("/world_height", world_height_);
   clock_publisher_ = nh.advertise<rosgraph_msgs::Clock>("/clock", 10);
   // Create services and subscriber.
   switch_ranger_service_ = nh.advertiseService("switch_ranger", &StageNode::switchRangerCallback, this);
   get_rangers_service_ = nh.advertiseService("get_rangers", &StageNode::getRangersCallback, this);
   cmdvel_subscriber_ = nh.subscribe<geometry_msgs::Twist>("cmd_vel", 10, &StageNode::cmdvelCallback, this);
   reconfigure_server_.setCallback(boost::bind(&StageNode::reconfigureCallback, this, _1, _2));
 };
Esempio n. 16
0
VLCMainwindow::VLCMainwindow() {
    vlcPlayer = NULL;
    this->setWindowTitle("RTSP player");
    /* Init libVLC */
    if((vlcObject = libvlc_new(0,NULL)) == NULL) {
        printf("Could not init libVLC");
        exit(1);
    }

    /* Display libVLC version */
    printf("libVLC version: %s\n",libvlc_get_version());

    /* Interface initialisation */
    initMenus();
    initComponents();
}
Esempio n. 17
0
/**
 * Reloads all script components
 */
void ScriptingService::reloadScriptComponents() {

    QHashIterator<int, ScriptComponent> i(_scriptComponents);

    // delete all objects and components
    while (i.hasNext()) {
        i.next();
        ScriptComponent scriptComponent = i.value();
        delete(scriptComponent.object);
        delete(scriptComponent.component);
    }

    // clear the component cache
    _engine->clearComponentCache();

    // init the components again
    initComponents();
}
Esempio n. 18
0
D3DApp::D3DApp(HINSTANCE hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD requestedVP)
{
	mMainWndCaption = winCaption;
	mDevType        = devType;
	mRequestedVP    = requestedVP;

	mhAppInst   = hInstance;
	mhMainWnd   = 0;
	md3dObject  = 0;
	mAppPaused  = false;
	ZeroMemory(&md3dPP, sizeof(md3dPP));

	mNetClient = 0;

	initMainWindow();
	initDirect3D();
	initComponents();
}
Esempio n. 19
0
void dockingServerCallback(const move_base_msgs::MoveBaseGoalConstPtr& goal, DockingServer* as)
{
    initComponents();
    timer.reset();
    timer.start();
    timeOut = 120000;
    move_base_msgs::MoveBaseResult result;
    if (calibrated==false) {
        sprintf(response,"Cannot approach the charging station because the docking is not calibrated.\nRead the readme file on how to perform calibration procedure.");
        state = STATE_REJECTED;
    } else {
        state = STATE_INIT;
        robot->progress = 10;
        robot->lightsOn();
    }
    if (state == STATE_REJECTED) {
        dockingServer->setAborted(result);
        robot->lightsOff();
        return;
    }
    while (state != STATE_IDLE && state != STATE_ABORTED && state != STATE_TIMEOUT && state != STATE_PREEMPTED) {
        usleep(200000);
    }
    if (state == STATE_PREEMPTED) {
        dockingServer->setPreempted(result);
        state = STATE_IDLE;
        robot->lightsOff();
        return;
    } else if (state == STATE_ABORTED) {
        dockingServer->setAborted(result);
        robot->lightsOff();
        return;
    } else if (success)
    {
        robot->progress = 100;
        dockingServer->setSucceeded(result);
        success = false;
    } else {
        dockingServer->setAborted(result);
    }
    robot->lightsOff();
}
Esempio n. 20
0
ImageViewer::ImageViewer(Image img2, QImage image, QString title, QWidget *parent):QMainWindow(parent)
{
    this->img = new Image();
    img->setBlue(img2.getBlue());
    img->setGraysScale(img2.getGraysScale());
    img->setGreen(img2.getGreen());

    img->setHeight(img2.getHeight());
    img->setLevel(img2.getLevel());
    img->setRed(img2.getRed());
    img->setType(img2.getType());
    img->setWidth(img2.getWidth());

    this->imgModificada=new Image();
    updtaeImageModificada(img2);

    initComponents(image,title);
    createActions();
    createMenus();
}
Esempio n. 21
0
void undockingServerCallback(const move_base_msgs::MoveBaseGoalConstPtr& goal, DockingServer* as)
{
    initComponents();
    timer.reset();
    timer.start();
    timeOut = 120000;
    move_base_msgs::MoveBaseResult result;
    if (chargerDetected == false) {
        state = STATE_REJECTED;
        sprintf(response,"Cannot undock because not on the charging station.");
    } else {
        robot->wait(100);
        state = STATE_UNDOCK_INIT;
    }
    if (state == STATE_REJECTED) {
        undockingServer->setAborted(result);
        robot->lightsOff();
        return;
    }
    while (state != STATE_IDLE && state != STATE_ABORTED && state != STATE_TIMEOUT && state != STATE_PREEMPTED) {
        usleep(200000);
    }
    if (state == STATE_PREEMPTED) {
        undockingServer->setPreempted(result);
        state = STATE_IDLE;
        robot->lightsOff();
        return;
    } else if (state == STATE_ABORTED) {
        undockingServer->setAborted(result);
        robot->lightsOff();
        return;
    } else if (success)
    {
        robot->progress = 100;
        undockingServer->setSucceeded(result);
        success = false;
    } else {
        undockingServer->setAborted(result);
    }
    robot->lightsOff();
}
Esempio n. 22
0
int main(int argc,char* argv[])
{
    ros::init(argc, argv, "charging");
    nh = new ros::NodeHandle;
    robot = new CChargingActions(nh);
    image_transport::ImageTransport it(*nh);

    dump = new CDump(NULL,256,1000000);
    image = new CRawImage(defaultImageWidth,defaultImageHeight,4);
    trans = new CTransformation(circleDiameter,nh);
    for (int i = 0; i<MAX_PATTERNS; i++) detectorArray[i] = new CCircleDetect(defaultImageWidth,defaultImageHeight);

    initComponents();
    success = false;
    image_transport::Subscriber subim = it.subscribe("head_xtion/rgb/image_mono", 1, imageCallback);
    nh->param("positionUpdate",positionUpdate,false);
    imdebug = it.advertise("/charging/processedimage", 1);
    ros::Subscriber subodo = nh->subscribe("odom", 1, odomCallback);
    ros::Subscriber subcharger = nh->subscribe("battery_state", 1, batteryCallBack);
    ros::Subscriber subcamera = nh->subscribe("head_xtion/rgb/camera_info", 1,cameraInfoCallBack);
    ros::Subscriber joy_sub_ = nh->subscribe("/teleop_joystick/action_buttons", 10, joyCallback);
    ros::Subscriber ptu_sub_ = nh->subscribe("/ptu/state", 10, ptuCallback);
    ros::Subscriber robot_pose = nh->subscribe("/robot_pose", 1000, poseCallback);
    server = new Server(*nh, "chargingServer", boost::bind(&actionServerCallback, _1, server), false);
    dockingServer = new DockingServer(*nh, "docking", boost::bind(&dockingServerCallback, _1, dockingServer), false);
    undockingServer = new DockingServer(*nh, "undocking", boost::bind(&undockingServerCallback, _1, undockingServer), false);

    server->start();
    dockingServer->start();
    undockingServer->start();
    ROS_DEBUG("Server running");
    while (ros::ok()) mainLoop();
    delete image;
    for (int i = 0; i<MAX_PATTERNS; i++) delete detectorArray[i];
    delete trans;
    return 0;
}
Esempio n. 23
0
void FirstOrderR::initialize(Interaction& inter, VectorOfBlockVectors& DSlink, VectorOfVectors& workV, VectorOfSMatrices& workM)
{
  workV.resize(FirstOrderR::workVecSize);
  workM.resize(FirstOrderR::mat_workMatSize);
  initComponents(inter, DSlink, workV, workM);
}
Esempio n. 24
0
void App::runNormal()
{
   bool componentsStarted = false;
   RunMode runMode;

   // init data objects
   initDataObjects(argc, argv);

   // check if mgmt host is defined if mode is not "help"
   runMode = this->cfg->determineRunMode();
   if ( (runMode != RunMode_INVALID) && !cfg->getSysMgmtdHost().length() )
      throw InvalidConfigException("Management host undefined");

   // tests
   if ( cfg->getDebugRunStartupTests() )
   {
      if ( !StartupTests::perform() )
      {
         this->log->log(1, "Startup Tests failed => shutting down...");
         appResult = APPCODE_RUNTIME_ERROR;
         return;
      }
   }

   // init components

   try
   {
      initComponents();

      // tests
      if(cfg->getDebugRunComponentTests() )
      {
         if(!ComponentTests::perform() )
         {
            this->log->log(1, "Component Tests failed => shutting down...");
            appResult = APPCODE_RUNTIME_ERROR;
            return;
         }
      }
   }
   catch(ComponentInitException& e)
   {
      log->logErr(e.what() );
      log->log(1, "A hard error occurred. Shutting down...");
      appResult = APPCODE_INITIALIZATION_ERROR;
      return;
   }


   // log system and configuration info

   logInfos();


   // detach process

   try
   {
      if(this->cfg->getRunDaemonized() )
         daemonize();
   }
   catch(InvalidConfigException& e)
   {
      log->logErr(e.what() );
      log->log(1, "A hard error occurred. Shutting down...");
      appResult = APPCODE_INVALID_CONFIG;
      return;
   }


   // start component threads

   if(this->cfg->getDebugRunComponentThreads() )
   {
      startComponents();

      componentsStarted = true;

      // tests
      if(cfg->getDebugRunIntegrationTests() )
      {
         if(!IntegrationTests::perform() )
         {
            this->log->log(1, "Integration Tests failed => shutting down...");
            appResult = APPCODE_RUNTIME_ERROR;

            stopComponents();
            goto err_joinAndExit;
         }
      }

      appResult = executeMode(runMode);

      // self-termination
      stopComponents();
   }


err_joinAndExit:
   if(componentsStarted)
   {
      joinComponents();
      log->log(3, "All components stopped. Exiting now!");
   }
}
// Start the application
void ClientMain::start()
{
    setupComponents();
    setupRendering();
    initComponents();
}
Esempio n. 26
0
/* TO DO
 * - add toggle console binding
 * - add show fps binding
 * - save settings !!
 */
OptionState::OptionState(AssetManager *m_assets)
{
    assets = m_assets;
    initComponents();
}
Esempio n. 27
0
void LimbsWeightDialog::on_prevFrameButton_clicked()
{
  currentFrame--;
  emit previousFrame();
  initComponents();
}
Esempio n. 28
0
void LimbsWeightDialog::on_nextFrameButton_clicked()
{
  currentFrame++;
  emit nextFrame();
  initComponents();
}
Esempio n. 29
0
void actionServerCallback(const scitos_apps_msgs::ChargingGoalConstPtr& goal, Server* as)
{
    initComponents();
    timer.reset();
    timer.start();
    timeOut = (int) goal->Timeout*1000;
    if (goal->Command == "charge") {
        if (calibrated==false) {
            sprintf(response,"Cannot approach the charging station because the docking is not calibrated.\nRead the readme file on how to perform calibration procedure.");
            state = STATE_REJECTED;
        } else {
            state = STATE_INIT;
            robot->progress = 10;
            robot->lightsOn();
        }
    }
    if (goal->Command == "test") {
        robot->lightsOn();
        ptupos = (int)goal->Timeout;
        robot->movePtu(275,0);
        waitCycles = 0;
        state = STATE_TEST1;
    }
    if (goal->Command == "calibrate") {
        state = STATE_CALIBRATE;
        robot->measure(NULL,NULL,maxMeasurements);
        robot->lightsOn();
    }
    if (goal->Command == "undock") {
        if (chargerDetected == false) {
            state = STATE_REJECTED;
            sprintf(response,"Cannot undock because not on the charging station.");
        } else {
            robot->wait(100);
            state = STATE_UNDOCK_INIT;
        }
    }
    if (state == STATE_REJECTED) {
        result.Message = response;
        server->setAborted(result);
        robot->lightsOff();
        return;
    }
    while (state != STATE_IDLE && state != STATE_ABORTED && state != STATE_TIMEOUT && state != STATE_PREEMPTED) {
        usleep(200000);
        server->publishFeedback(feedback);
    }
    result.Message = response;
    if (state == STATE_PREEMPTED) {
        server->setPreempted(result);
        state = STATE_IDLE;
        robot->lightsOff();
        return;
    } else if (state == STATE_ABORTED) {
        server->setAborted(result);
        robot->lightsOff();
        return;
    } else if (success)
    {
        robot->progress = 100;
        server->setSucceeded(result);
        success = false;
    } else {
        server->setAborted(result);
    }
    robot->lightsOff();
}
Esempio n. 30
0
MainWindow::MainWindow(QWidget *parent) : QWidget(parent){
    initComponents();
}