Exemplo n.º 1
0
Keyboard::Keyboard(Jeu* jeu, Carte* carte, Encyclopedie* encycl, Poissons* poissons,
SDL_Surface* screen, int m, bool e) : 
    gpJeu(jeu), gpCarte(carte), gpEncyclopedie(encycl), gpPoissons(poissons), mode(m), 
    gFullScreen(1), gpScreen(screen), tmp(0), tmpx(0), tmpc(0), tmpw(0), tmpt(0), tmpp(0), 
    tmpm(0), tmpo(0), tmptp(0), tmpl(0), tmpi(0), ligne(0), colonne(0), ligneOption(2), 
    volume(32), volson(32), ligneRecord(3), colonneRecord(0), temps(0), ligneVal(0), 
    intro(0), telep(0), etire(e) {
    for (int i = 0; i < 3; i++) save[i]=0;
    for (int i = 0; i < 9; i++) rang[i]=0;
    loadP();
    loadOldP();
    gpJeu->getAudio()->setVolume(volume);
    gpJeu->getAudio()->setVolson(volson);
}
Exemplo n.º 2
0
int TextureUtil::genTexture( char const * const filename,
                             EmTexture * const texture)
{
  //cout<<"+ Texture::genTexture : "<<filename<<endl;
  *texture = 0;

#if EM_USE_SDL
  // Load Texture
  struct_image* image = 0;

  // load the texture
  image = loadP(filename);
  if (image == NULL) {
    cerr << "TextureUtil::loadTexture error loading file " << filename << endl;
    return -1;
  }
  //TODO : Pad texture != 2^n x 2^n //!rzr

  //cout<<" Create Texture"<<endl;
  glGenTextures(1, texture);
  glBindTexture(GL_TEXTURE_2D, *texture);


  // 2d texture, level of detail 0 (normal), 3 components (red, green, blue),
  // x size from image, y size from image,
  // border 0 (normal), rgb color data, unsigned byte data,
  // and finally the data itself.x
  GLenum comp;
  switch (image->channels) {
  case 3: comp = GL_RGB; break;
  case 4: comp = GL_RGBA; break;
  default: comp = GL_RGB;
    cerr << "TextureUtil::loadTexture unknown image format" << endl;
    return -1;
  }


  glTexImage2D(GL_TEXTURE_2D, 0, comp, image->width, image->height, 0, comp,
               GL_UNSIGNED_BYTE, image->pixels);

  EM_COUT("loaded texture: " << filename, 1);
  EM_COUT("size " << image->width <<" "<< image->height, 1);
  //    EM_COUT("bytes per pixel " << (int)image->format->BytesPerPixel, 1);
  //    EM_COUT("bits per pixel " << (int)image->format->BitsPerPixel, 1);

#endif
  EM_COUT("- Texture::genTexture : "<<filename<<hex<<texture,0);
  return 1;
}
Exemplo n.º 3
0
EmImage* TextureUtil::loadImage(const char* filename) {
#if EM_USE_SDL
  struct_image * image = loadP(filename);
  if (image == NULL) {
    cerr << "TextureUtil::loadImage unable to load " << filename << endl;
  }
  return image;
#endif // EM_USE_SDL
#if EM_USE_ALLEGRO
  RGB pal[256];
  BITMAP * bm = load_bitmap(filename, pal);
  if (bm == NULL) {
    cerr << "TextareUtil::loadImage unable to load " << filename << " : " << allegro_error << endl;
  }
  return bm;
#endif // EM_USE_ALLEGRO
}
Exemplo n.º 4
0
void
MainWindow::createActions(){
	openAction = new QAction( tr("&Open..."), this );
    openAction->setStatusTip(tr("Open an existing molecular file"));
	connect( openAction, SIGNAL( triggered() ), this, SLOT( openFile()  ) );

	viewAxisAction=new QAction(tr("&Axis"), this);
	viewAxisAction->setStatusTip(tr("Show Axis"));
	viewAxisAction->setCheckable(true);
	connect(viewAxisAction, SIGNAL(triggered()), this, SLOT(viewAxis()));

	viewStickAction=new QAction(tr("&Stick"), this);
	viewStickAction->setStatusTip( tr("Stick Model") );
	viewStickAction->setCheckable(true);
	connect(viewStickAction, SIGNAL(triggered()), this, SLOT(viewStick()));

	viewSphereAction=new QAction(tr("&Sphere"),this);
	viewSphereAction->setStatusTip(tr("Sphere Model"));
	viewSphereAction->setCheckable(true);
	connect(viewSphereAction, SIGNAL(triggered()), this, SLOT(viewSphere()));

	viewSurfaceAction=new QAction(tr("&Surface"),this);
	viewSurfaceAction->setStatusTip(tr("Surface Model"));
	viewSurfaceAction->setCheckable(true);
	connect(viewSurfaceAction, SIGNAL(triggered()), this, SLOT(viewSurface()));

	//---------------------------------------------------------------------------

	dockAction = new QAction( tr("&Dock"), this );
	dockAction->setStatusTip(tr("Config docking parameters."));
	connect( dockAction, SIGNAL( triggered() ), this, SLOT(dockConfig() ) );

	//----------------------- config dock --------------------------------------------------------
	confDlg = new ConfigDialog;
	connect( confDlg, SIGNAL( loadP(QString) ), this, SLOT(openFile(QString)) );
	connect( confDlg, SIGNAL( loadB(vector<float>) ), molViewer, SLOT( sDrawDots(vector<float>) ) );
    connect( confDlg, SIGNAL( loadL(QString) ), this, SLOT(openFile(QString)) );
    connect( confDlg, SIGNAL( dockRun() ), this, SLOT(dockRun()) );

    //-- textEdit
//    connect( deDock, SIGNAL(emitString(QString)), termEdit, SLOT(append(QString)) );
//    connect( this, SIGNAL(emitRun()), deDock, SLOT(run()) );
}
Exemplo n.º 5
0
void Macro::draw(QGraphicsScene* scene, QColor background, QColor font) {
    //size 241, 281
    //QBrush Ybrush(Qt::blue);
    //scene->setBackgroundBrush(Ybrush);

    QFont titleFont("Times", 10, QFont::Bold);
    QGraphicsTextItem * titleItem = new QGraphicsTextItem;
    titleItem->setPos(70,10);
    titleItem->setDefaultTextColor(font);
    titleItem->setFont(titleFont);
    titleItem->setPlainText("Macro Recorder");
    scene->addItem(titleItem);

    QFont actFont("Times", 9, QFont::Bold);
    QGraphicsTextItem * actItem = new QGraphicsTextItem;
    actItem->setPos(30,40);
    actItem->setDefaultTextColor(font);
    actItem->setFont(actFont);
    if (activationKeyRec == false) {
        QChar key = static_cast<char>(activationKey);
        QString sKey = key;
        actItem->setPlainText("Activation Key: (" + sKey + ")");
    }
    else {
        actItem->setPlainText("Activation Key: RECORDING");
    }
    scene->addItem(actItem);

    QBrush onB(font);
    QPen onP(font);
    scene->addRect(160,150,40,40, onP, onB);
    scene->addRect(160,200,40,40, onP, onB);

    QFont onFont("Times", 11, QFont::Bold);
    QGraphicsTextItem * onItem = new QGraphicsTextItem;
    onItem->setPos(166,158);
    if (on) {
        onItem->setDefaultTextColor(Qt::yellow);
    }
    else {
       onItem->setDefaultTextColor(Qt::black);
    }
    onItem->setFont(onFont);
    onItem->setPlainText("On");
    scene->addItem(onItem);

    QFont offFont("Times", 11, QFont::Bold);
    QGraphicsTextItem * offItem = new QGraphicsTextItem;
    offItem->setPos(166,208);
    if (on) {
        offItem->setDefaultTextColor(Qt::black);
    }
    else {
       offItem->setDefaultTextColor(Qt::yellow);
    }
    offItem->setFont(offFont);
    offItem->setPlainText("Off");
    scene->addItem(offItem);

    if (recording) {
        QBrush recB(Qt::red);
        QPen recP(Qt::red);
        scene->addRect(60,80,30,30, recP, recB);
    }
    else {
        QBrush recB(font);
        QPen recP(font);
        scene->addRect(60,80,30,30, recP, recB);
    }

    QBrush loadB(font);
    QPen loadP(font);
    scene->addRect(140,80,30,30, loadP, loadB);

    QFont loadFont("Times", 7, QFont::Bold);
    QGraphicsTextItem * loadItem = new QGraphicsTextItem;
    loadItem->setPos(140,85);
    loadItem->setDefaultTextColor(Qt::black);
    loadItem->setFont(loadFont);
    loadItem->setPlainText("Load");
    scene->addItem(loadItem);

    QFont recFont("Times", 8, QFont::Bold);
    QGraphicsTextItem * recItem = new QGraphicsTextItem;
    recItem->setPos(61,83);
    recItem->setDefaultTextColor(Qt::black);
    recItem->setFont(recFont);
    recItem->setPlainText("Rec");
    scene->addItem(recItem);

}