Exemplo n.º 1
0
int main( int argc, char **argv ) {

  initCommunication( &argc, &argv );
  
  // make up a simple test
  int size = read_int( argc, argv, "-s", 8 );
  int r = read_int( argc, argv, "-r", 2 );
  int P;
  MPI_Comm_size( MPI_COMM_WORLD, &P );
  initSizes( P, r, size );
  if( getRank() == 0 ) {
    if( P > (1<<r) )
      printf("Need more recursive steps for this many processors\n");
    if( P > (size/(1<<r))*(size/(1<<r)+1)/2)
      printf("Need a bigger matrix/fewer recursive steps for this many processors\n");
    printf("-s %d -r %d -n %d\n", size, r, P);
  }
  int sizeSq = getSizeSq(r,P);
  int sizeTri = getSizeTri(r,P);
  double *X = (double*) malloc( sizeSq*sizeof(double) );
  srand48(getRank());
  fill(X,sizeSq);
  double *A = (double*) malloc( sizeTri*sizeof(double) );
  if( getRank() == 0 )
    printf("Generating a symmetric positive definite test matrix\n");
  initTimers();
  MPI_Barrier( MPI_COMM_WORLD );
  double st2 = read_timer();
  syrk( A, X, size, P, r, 0. );
  MPI_Barrier( MPI_COMM_WORLD );
  double et2 = read_timer();
  if( getRank() == 0 )
    printf("Generation time: %f\n", et2-st2);
  initTimers();
  free(X);
  for( int i = 0; i < sizeTri; i++ )
    A[i] = -A[i];

  if( getRank() == 0 )
    printf("Starting benchmark\n");
  MPI_Barrier( MPI_COMM_WORLD );
  double startTime = read_timer();
  chol( A, size, P, r );
  MPI_Barrier( MPI_COMM_WORLD );
  double endTime = read_timer();
  
  if( getRank() == 0 )
    printf("Time: %f Gflop/s %f\n", endTime-startTime, size*1.*size*size/3./(endTime-startTime)/1.e9);

  free(A);
  printCounters(size);
  MPI_Finalize();
}
Exemplo n.º 2
0
void start_settings(void)
{
  // Init MMU
  CP15_Mmu(FALSE);            // Disable MMU
  // Privileged permissions  User permissions AP
  // Read-only               Read-only        0
  CP15_SysProt(FALSE);
  CP15_RomProt(TRUE);
  CP15_InitMmuTtb(TtSB,TtTB); // Build L1 and L2 Translation tables
  CP15_SetTtb(L1Table);       // Set base address of the L1 Translation table
  CP15_SetDomain( (DomainManager << 2*1) | (DomainClient << 0)); // Set domains
  CP15_Mmu(TRUE);             // Enable MMU
  CP15_Cache(TRUE);           // Enable ICache,DCache

  /* Disable interrupts in ARM core */
  disable_irq_fiq();

  InitializeInterruptSystem();

  // Enable IRQ interrupts in the ARM core
  enable_irq_fiq();

  initCallBackElement();//инит callBackElement
  initTimers();//инит таймеров
  initTimers_WL();//TIMERS INIT РЛ

  WideLogActual = &(pActualCMD[DQUADRO]);//командный массив расшир логики(вторая половина)

  ResetSystemMenu();//сбросить сист меню
   
  timing = 0;  

}//start_settings(void)
Exemplo n.º 3
0
int main(void)
{
	initPort();
	initTimers();

	static update = 0;

	while(1)
	{
		while (~PINC & 1) // Run while bit 0 in PINC is 0 (Invert PINC then	AND with 1, this will return 1 if PINC0 was originally 0) (Check if button is pressed)
		{
			if (!update) {
				cli(); // Disable global interrupts
				PORTA = 0xFF;
				PORTB = 0xFF;
				update = 1; // Has been updated
			}
		}
		// If button is not pressed, continue blinking lights
		if (update)
		{
			update = 0;
			sei(); // Enable global interrupts
		}

		if (counter_A > 6) counter_A = 0;
		PORTA = (1 << counter_A++);  // Bitshifting shenanigans, shifts one up. Ex: 0b00000010 -> 0b00000100

		if (counter_B > 6) counter_B = 0;
		PORTB = (1 << counter_B++);  // Bitshifting shenanigans, shifts one up. Ex: 0b00000010 -> 0b00000100
	};

	return 0;
}
Exemplo n.º 4
0
void init() {
   // In case disabled by boot-loader
   __enable_irq();

   initPorts();
   initTimers();
   bdm_interfaceOff();
   initUSB();

#ifdef VDD_ON_INITIALLY
   // For compatibility with original board s/w
   // The board is powered when initially plugged in
   #if (VDD_ON_INITIALLY == 3)
      bdm_option.targetVdd = BDM_TARGET_VDD_3V3;
   #elif (VDD_ON_INITIALLY == 5)
      bdm_option.targetVdd = BDM_TARGET_VDD_5;
   #else
      bdm_option.targetVdd = BDM_TARGET_VDD_OFF;
   #endif
   bdm_setTargetVdd();
   RESET_LOW();
   WAIT_MS(100);
   RESET_3STATE();
#endif
}
Exemplo n.º 5
0
/**
*** tone() -- Output a tone (50% Dutycycle PWM signal) on a pin
***  pin: This pin is selected as output
***  frequency: [Hertz] 
**   duration: [milliseconds], if duration <=0, then we output tone continously, otherwise tone is stopped after this time (output = 0)
**/
void tone(uint8_t _pin, unsigned int frequency, unsigned long duration)
{
  uint8_t port = digitalPinToPort(_pin);
  if (port == NOT_A_PORT) return;

  // find if we are using it at the moment, if so: update it
  for (int i = 0; i < AVAILABLE_TONE_PINS; i++)
  {
    if (tone_pins[i] == _pin) 
    {
      setTimer(i, frequency, duration);
      return; // we are done, timer reprogrammed
    }
  }

  // new tone pin, find empty timer and set it
  for (int i = 0; i < AVAILABLE_TONE_PINS; i++)
  {
    if (tone_pins[i] == 255)      
    {
      tone_pins[i] = _pin;
      tone_bit[i] = digitalPinToBitMask(_pin);
      tone_out[i] = portOutputRegister(port);
      if ( tone_state == 0 ) 
        initTimers();
      pinMode(_pin, OUTPUT);
      setTimer(i, frequency, duration);
      return; // we are done, timer set
    }
  }
  // if we exit here, no unused timer was found, nothing is done
}
Exemplo n.º 6
0
// (re)set pointers, counters, first charcter
void ttMorse::msendSet( ) {
	eltOn = false;
	sending = true;
	cidx = 0;
	tabsiz = strlen( mstr );
//	elementStart = millis( ) + 2;
	if( mstr[cidx] == '*' ) {
		prosign = true;
		cidx++;
	} // if start of prosign
	elementStart = initTimers( ) + 2;
//	codeChar = morseTable[(mstr[cidx]&0x7f)-0x20];
	mtidx = ((mstr[cidx]-0x20)>0x3f) ? mstr[cidx]-0x40 : mstr[cidx]-0x20;
	codeChar = morseTable[mtidx];
	while( codeChar == 0 && cidx < tabsiz ) {		// handle several leading spaces
		elementStart += 7*dotDur;
		cidx++;
//		codeChar = morseTable[(mstr[cidx]&0x7f)-0x20];
		mtidx = ((mstr[cidx]-0x20)>0x3f) ? mstr[cidx]-0x40 : mstr[cidx]-0x20;
		codeChar = morseTable[mtidx];
	}
	if( cidx >= tabsiz ) { 		// only spaces found
		lastelt = true;
		eltOn = true;
		elementEnd = elementStart - dotDur;		// pretend elt on, end after space(s)
		prosign = false;		// cancel possible isolated prosign
	} else {					// char found, setup decoder
		setGetBit( );
		endCode = false;
	}
} // msendSet( )
Exemplo n.º 7
0
/* Main program loop */
int main(void)
{
    
#if 1
    /* Hardware initialization */
    initPorts();
    
    initTimers();
    initRadio();

    rfQueue = xQueueCreate(64, sizeof(uint8_t));  //64 byte queue for RF transfer data

    xTaskCreate(radioTask, (const signed portCHAR *)"Radio", 218, NULL, 2, NULL);
    xTaskCreate(taskHeartbeat2, (const signed portCHAR *)"Blink2", 48, NULL, 1, NULL);


    vTaskStartScheduler();
#else
    //Make PortB.0 an output
    DDRB |= _BV(0);
    while(1)
    {
        // Toggle PortB.0
        PORTB ^= _BV(0);
        _delay_ms(500);
    }    

    
#endif

    return 0;
}
Exemplo n.º 8
0
int main(void){
   _delay_ms(100);			// startup delay
	
	init();					// initializations for Arduino.h
	Tlc.init();				// initialize the TLC chip
	initGPIO();				// initialize GPIO and pull-ups
	_delay_ms(100);			// GPIO stability delay
	initTimers();			// initialize timer0 (CTC, T~100us)
	initPCINT();			// initialize pin change interrupts (2:0)
   
	// Temporary idea: Determine the bottom/back LED, send it to rgbUtil so that
	//  it knows which led to cycle to next
	setBottomLED(0);
	setAmbientColor(0, 0, 0 );
	
	Serial.begin(9600);
   
	//Infinitely cycle an LED around the loop
	while (1) {
      if (dt_us > 3000000)
         stopped();
	   _delay_ms(75);
	}
	return 0;
}
Exemplo n.º 9
0
void initAll(void)
{
    HAL_Init();

    initClock();
    initGPIO();
    initTimers();
}
Exemplo n.º 10
0
void measinit(void) {
	cycleData.intFlag = 0;
	cycleData.Cnt = 0;
	initWheelData();
	initPorts();
	initTimers();
	initInterrupts();
}
Exemplo n.º 11
0
SceneRenderer::SceneRenderer(bool isES2)
{
    initTimers();

    // Call this early to give it time to multi-thread init.
    m_particles = new ParticleRenderer(isES2);

    m_texStorage["floor"]       = NvImage::UploadTextureFromDDSFile("images/tex1.dds"); 
    m_texStorage["white_dummy"] = NvImage::UploadTextureFromDDSFile("images/white_dummy.dds"); 

    m_modelStorage["T34-85"] = loadModelFromFile("models/T34-85.obj", 30.0f);
    m_modelStorage["cow"]    = loadModelFromFile("models/cow.obj",    10.0f);

    const float treeOffset = 20;
    NvImage::VerticalFlip(false);
    m_texStorage["palm"]   = NvImage::UploadTextureFromDDSFile("images/palm.dds");
    NvImage::VerticalFlip(true);
    m_modelStorage["palm"] = loadModelFromFile("models/palm_tree.obj", 50.0f);

    // create terrain
    nv::vec3f scale(1000.0f, 100.0, 1000.0f);
    nv::vec3f translate(0.0f, -45.0, 0.0f);
    nv::matrix4f scaleMat, translateMat;
    scaleMat.set_scale(scale);
    translateMat.set_translate(translate);
    
    TerrainInput input;
    input.heightmap = "images/terrain_heightmap.dds";
    input.colormap  = "images/terrain_colormap.dds";
    input.transform = translateMat*scaleMat;
    input.subdivsX  = 128;
    input.subdivsY  = 128;
    m_pTerrain = new Terrain(input);

    CreateRandomObjectsOnLandScape(m_models, m_modelStorage, m_texStorage, treeOffset);
    std::sort(m_models.begin(), m_models.end(), ObjectSorter());

    m_opaqueColorProg = new OpaqueColorProgram(isES2);
    m_opaqueSolidDepthProg = new OpaqueDepthProgram("shaders/unshaded_solid.frag");
    m_opaqueAlphaDepthProg = new OpaqueDepthProgram("shaders/unshaded_alpha.frag");

    m_fbos = new SceneFBOs();

    m_upsampler = new Upsampler(m_fbos);

    // Disable particle self-shadowing and render all particles in one draw call (slice).
    getParticleParams()->numSlices = 1;

    m_scene.setLightVector(vec3f(-0.70710683f, 0.50000000f, 0.49999994f));
    m_scene.setLightDistance(6.f);
    m_scene.m_fbos = m_fbos;

    m_scene.m_lightAmbient = 0.15f;
    m_scene.m_lightDiffuse = 0.85f;

    m_statsCountdown = STATS_FRAMES;
}
Exemplo n.º 12
0
void initMotors(){
	
	DDRH |= (1 << PH6);
	
	DDRG |= (1 << PG5);
	
	DDRB |= (1<<PB4) | (1<<PB5) | (1<<PB6) | (1<<PB7);
	
	initTimers();
}
Exemplo n.º 13
0
/**
*** tone() -- Output a tone (50% Dutycycle PWM signal) on a pin
***  pin: This pin is selected as output
***  frequency: [Hertz] 
**   duration: [milliseconds], if duration <=0, then we output tone continously, otherwise tone is stopped after this time (output = 0)
**/
void timer( unsigned int frequency, void (*userFunc)(void))
{


      if ( timer_state == 0 ) 
        initTimers();
      setTimer(frequency, userFunc);
      return; // we are done, timer set

}
Exemplo n.º 14
0
/********************************************************************************
	Main
********************************************************************************/
int main(void) {
    // initialize usart module
	usart_init();

    // enable interrupts
    sei();

    // Init GPIO
    initGPIO();

    // Init Timer 1
    initTimer();

    // Init Timer 0 & 2
    initTimers();

	OCR0A = 255;
	OCR0B = 255;
	OCR2A = 255;
	OCR2B = 255;

    _delay_ms(1000);

	OCR0A = 0;
	OCR0B = 0;
	OCR2A = 0;
	OCR2B = 0;

    fixZeroValueOCR();

	// Console friendly output
    printf("Start...");
    printf(CONSOLE_PREFIX);

    // Init NRF24L01+
    radio.begin();
    radio.setRetries(15,15);
    radio.setPayloadSize(8);
    radio.setPALevel(RF24_PA_MAX);
    radio.setChannel(115);

    radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipes[1]);

    radio.startListening();

    // Some RF module diagnostics logs
    radio.printDetails();

	// main loop
    while (1) {
    	// main usart loop for console
    	usart_check_loop();
    }
}
Exemplo n.º 15
0
Arquivo: comp.c Projeto: enyone/cvavr
void main(void)
{
  initd();
       
  LED1 = 0;
  LED2 = 0;
  initIdle();
  
  initTimers();
  
  while (1)
  {
    readInputs();
    
    if(timerflag)
    {
      bcount ++;
      if(bcount >= blinkspeed)
      {
        if(blink == 0) blink = 1; else blink = 0;
        LED1 = blink;
        bcount = 0;
      }
      
      if(scount <= 1) { scount ++; LED2 = 0; }
      else LED2 = 1;
      
      sendcount ++;
      
      if(serial0_null <= 4) serial0_null ++;
      else u0 = 0;
      
      if(wakecheck > 0) wakecheck --;
      else initReset();
      
      timerflag = 0;
    }
    
    if(sendcount >= 25)
    {
      if(tied.onoff)
      {
        sendLcdChar(kmh);
        sendLcdChar(rpm);
        sendLcdChar(20);
        sendLcdChar(20);
        sendLcdChar(1);
        sendLcdChar(1);
        sendLcdChar(matka>>8);
        sendLcdChar(matka);
        sendcount = 0;
        matka = 0;
      }
    }    
  }
Exemplo n.º 16
0
void _ma3_init()
{
  initGpio();
  initTimers();

  IC3ReadValue1 = 0;
  IC3ReadValue2 = 0;
  ma3_capture = 0;
  CaptureNumber = 0;
  dataCaptureReady = 0;
  ma3_capture_angle=0;
}
Exemplo n.º 17
0
void initHW(void) {
    volatile unsigned long ulLoop;

    SysCtlClockSet(
        SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN
        | SYSCTL_XTAL_8MHZ);

    // Enable the ports
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

    // Inputs :
    // PE0 : Up button
    // PE1 : Down button
    // PE2 : Left button
    // PE3 : Right button
    // PF1 : Select button
    //
    GPIODirModeSet(GPIO_PORTE_BASE,
                   GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3,
                   GPIO_DIR_MODE_IN);
    GPIOPadConfigSet(GPIO_PORTE_BASE,
                     GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3,
                     GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);

    GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_DIR_MODE_IN);
    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_STRENGTH_2MA,
                     GPIO_PIN_TYPE_STD_WPU);

    // Outputs:
    // PF0 : Status LED
    GPIODirModeSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_DIR_MODE_OUT);
    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_STRENGTH_2MA,
                     GPIO_PIN_TYPE_STD);
    GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 1);

    initTimers();

    // a short delay to ensure stable IO before running the rest of the program
    for (ulLoop = 0; ulLoop < 200; ulLoop++) {
    }

    //
    // Enable processor interrupts.
    //
    IntMasterEnable();
}
Application::Application(int argc, char *argv[])
    : QApplication(argc, argv),
      engine(),
      tcpClient(),
      dataParser(QString("code.txt")),
      serialPort(QString("COM4"),QSerialPort::Baud9600,QSerialPort::Data8,QSerialPort::NoParity,QSerialPort::OneStop),
      eventhandler(*engine.rootContext()),
      dataLogger("log/log.csv", "log/logstyle.txt", "log/strlog.csv")
{
    generateQMLData();
    initQML();
    makeConnections();
    initTimers();
}
Exemplo n.º 19
0
//Usings
USING_NS_GAMEKABOOM


////////////////////////////////////////////////////////////////////////////////
// CTOR / DTOR                                                                //
////////////////////////////////////////////////////////////////////////////////
SplashScene::SplashScene()
{
    Lore::WindowManager::instance()->setClearColor(Lore::Color::White());

    initSprites();
    initTimers ();
    initSounds ();
}
bool initialise()
{
	
	bool success = true;

	
	USART_init(USART_PC,9600);
	debug_println("Begininning Initialisation...");
	
	initTimers();
	
	if(gps_demonstration==true)
	{
		//GPS Demonstration
		altimeter_init();
		
		init_HMC5883L();
		
		
		gps_init();
		
		//Initialise a series of waypoints in a circle around the current coordinates..
		_delay_ms(1000);
		chris_waypoint_init();
	}
	else
	{
		//RX and servo Demonstration
		rx_init();
		quad_output_init();
	}
	
	
	debug_println("Initialization succeeded!");
	
	//beep some pattern I can recognize
	debug_beep_long();
	_delay_ms(250);
	debug_beep();
	_delay_ms(250);
	debug_beep();
	_delay_ms(250);
	debug_beep();
	_delay_ms(250);
	debug_beep_long();
	
	return success;
}
Exemplo n.º 21
0
// Listens to events during the whole time of the application
// and distributes corresponding tasks
void Application::loop() {
    initTimers();
    m_LastStartTime = getTime();
    SDL_Event event;
    
    // While the application is running (done==false),
    while (m_bRunning) {
        // SDL_PollEvent return 1 when there is still events on the stack of events
        // It takes the first event in the queue and writes it in the "event" parameter
        // Then it removes it from the stack.
        while (SDL_PollEvent(&event))
            handleEvent(event); // Checks each event for types and loach corresponding actions

        // Reports any possible glError
        printGlErrors();
    }
}
Exemplo n.º 22
0
int main(void) {
    cli();
    cycleData.intFlag = 0;
    cycleData.Cnt = 0;
    initWheelData();
    initPorts();
    initTimers();
    initUSART();
    initInterrupts();
    sei();
    for(;;) {
        if(cycleData.intFlag)
            prgm800Hz();
        if(cycleData.Cnt == 8)
            prgm100Hz();
    }
}
Exemplo n.º 23
0
SceneRenderer::SceneRenderer(bool isGL)
: m_model(NULL)
{
    initTimers();
    loadModel();

    m_opaqueColorProg = new OpaqueColorProgram();
    m_opaqueDepthProg = new OpaqueDepthProgram();

    m_fbos = new SceneFBOs();
    m_particles = new ParticleRenderer(isGL);
    m_upsampler = new Upsampler(m_fbos, isGL);

    memset(&m_scene, 0, sizeof(m_scene));
    m_scene.setLightVector(vec3f(-0.70710683f, 0.50000000f, 0.49999994f));
    m_scene.setLightDistance(6.f);
    m_scene.m_fbos = m_fbos;
}
int main()
{
	initTimers();
	initVideo();
	sound_initAC97();
	mouse_init();
	initInterrupts();
	isNewGame = true;
	initGameScreen();

	PIT_startRecurringTimer(XPAR_PIT_0_BASEADDR, CLOCK_FREQ_HZ / INTERRUPTS_PER_SECOND);

	while(1) // Program never ends.
		if(low_priority_intc_status != 0)
			lowPriorityInterruptHandler();

	cleanup_platform();
	return 0;
}
Exemplo n.º 25
0
Viewport::Viewport(representation::t type, QGLWidget *target)
    : type(type), target(target), width(0), height(0),
      ctx(new SharedData<ViewportCtx>(new ViewportCtx())),
      sets(new SharedData<std::vector<BinSet> >(new std::vector<BinSet>())),
      selection(0), hover(-1), limiterMode(false),
      active(false), useralpha(1.f),
      showLabeled(true), showUnlabeled(true),
      overlayMode(false),
      illuminant_show(true),
      zoom(1.), holdSelection(false), activeLimiter(0),
      drawLog(nullptr), drawMeans(nullptr), drawRGB(nullptr), drawHQ(nullptr),
      bufferFormat(RGBA16F),
      drawingState(HIGH_QUALITY), yaxisWidth(0), vb(QGLBuffer::VertexBuffer)
{
	(*ctx)->wait = 1;
	(*ctx)->reset = 1;
	(*ctx)->ignoreLabels = false;

	initTimers();
}
Exemplo n.º 26
0
//*****************************************************************************
// Main
//*****************************************************************************
void main (void)
{
    // Stop watchdog timer
    WDT_A_hold( WDT_A_BASE );

    // Initialize GPIO
    initGPIO();

    // Initialize clocks
    initClocks();

    // Initialize timers
    initTimers();

    __bis_SR_register( GIE );         // Enable interrupts globally

    while(1) {
        __no_operation();             // Placeholder for while loop (not required)
    }
}
Exemplo n.º 27
0
static void testMode() {
   // In case disabled by boot-loader
   __enable_irq();

   initPorts();
   initTimers();
   bdm_interfaceOff();
   initUSB();
   ledEnable();
   testEnable();
   bootInputEnable();
   for(;;) {
      WAIT_MS(100);
      ledToggle();
      testToggle();
      if (bootInputActive() == 0) {
         reboot();
      }
   }
}
Exemplo n.º 28
0
/**
 * Runs all the initialisations that are needed
 * Please put them in here.
 */
void initialise() {
  debug_frmwrk_init();
  setSensorSide(-1);
  trackingState = 0;
  timerCounter = 0;
  courseType = 0;
  initSerial();
  serialTest();
  initSensors();
  // Even tho this is a test it needs to run so that the serial is set up properly
  initTimers();
  //__enable_irq();
  if (DBG_LEVEL >= 1) {
	  _DBG_("MOUSE");
  }
 	mouseinitial();  
  if (DBG_LEVEL >= 1) {
	  _DBG_("I've completed"); 
	}

}
Exemplo n.º 29
0
////////////////////////////////////////////////////////////////////////////////
// CTOR / DTOR                                                                //
////////////////////////////////////////////////////////////////////////////////
Bomb::Bomb() :
    //HouseKeeping
    //m_turnInfo - Set in reset.
    m_state(Bomb::State::Dead),
    m_hitBox(Lore::Rectangle::Empty()),
    //Sprite / Animation
    //m_aliveAnimation     - Initialized in InitAnimations
    //m_explodingAnimation - Initialized in InitAnimations
    m_pCurrentAnimation(nullptr),
    //Movement / Bounds
    m_pos            (Lore::Vector2::Zero()),
    m_speed          (Lore::Vector2::Zero()),
    m_maxY           (0),
    //Callback
    m_reachTargetCallback     (nullptr),
    m_explodedFinishedCallback(nullptr)
{
    setOnReachTargetCallback(ReachTargetCallback());
    initAnimations();
    initTimers    ();
}
Exemplo n.º 30
0
// Main timer functions for starting and killing timers
int qStartTimer( int interval, QObject *obj )
{
    if ( !timerList )				// initialize timer data
	initTimers();
    int id = allocTimerId();			// get free timer id
    if ( id <= 0 ||
	 id > (int)timerBitVec->size() || !obj )// cannot create timer
	return 0;
    timerBitVec->setBit( id-1 );		// set timer active
    TimerInfo *t = new TimerInfo;		// create timer
    Q_CHECK_PTR( t );
    t->id = id;
    t->interval.tv_sec  = interval/1000;
    t->interval.tv_usec = (interval%1000)*1000;
    timeval currentTime;
    getTime( currentTime );
    t->timeout = currentTime + t->interval;
    t->obj = obj;
    insertTimer( t );				// put timer in list
    return id;
}