Пример #1
0
int main() {
    sf::Window win(sf::VideoMode(512, 512), "Lol");
    glewInit();
    Shader f("Frag", Shader::Fragment);
    Shader v("Vert", Shader::Vertex);
    Program p;
    p.Attach(f);
    p.Attach(v);
    for (;;) {
        sf::Event e;
        while (win.pollEvent(e)) switch (e.type) {
        case sf::Event::Closed:
            exit(0);
            break;
        }
        win.display();
    }
    //Game::Run();
    return EXIT_SUCCESS;
}
Пример #2
0
void display_splash_screen(){

        // Create a window
        Simple_window win(Point(100,100),450,450,"AggieSnap!");

        Text title(Point(140,25),"Welcome to Aggie Snap!");
        Text description_1(Point(18,370),"Welcome to AggieSnap! This program allows you to get pictures");
        Text description_2(Point(33,400),"from a file index or URL, tag the pictures, save the pictures,");
        Text description_3(Point(53,430),"and browse or search through these saved pictures.");

        Image splash(Point(75,45),"splash_screen.gif");
        win.attach(splash);
        win.attach(title);
        win.attach(description_1);
        win.attach(description_2);
        win.attach(description_3);

      win.wait_for_button();

};
Пример #3
0
void GameWidget::openBlock()
{
    blockSum--;
    //   qDebug()<<blockSum;
    if(blockSum==MineCount)
    {
        for(int i=0;i<Max;i++)
        {
            for(int j=0;j<Max;j++)
            {
                if(map[i][j]->getStatus()==Block::Default)
                {
                    map[i][j]->setFlag();
                }
                map[i][j]->locked();
            }
        }
        emit win();
    }
}
Пример #4
0
int main(int argc, char *argv[]) {
    // Lua test
    sel::State luaState{true};
    luaState["message"] = "Hello world!";
    std::string message = luaState["message"];
    std::cout << "Message: " << message << std::endl;

    // SDL test
    SDL2pp::SDL sdl(SDL_INIT_VIDEO);
    SDL2pp::SDLTTF ttf;
    SDL2pp::SDLImage img;
    SDL2pp::Window win("Hello world", 0, 0, 800, 600, SDL_WINDOWPOS_UNDEFINED);
    for (int i = 0; i < 10; ++i) {
        luaState["number"] = i;
        std::cout << "Number: " << int(luaState["number"]) << std::endl;
        SDL_Delay(1000);
    }

    luaState("print(\"Goodbye from Lua!\")");
}
Пример #5
0
int main(){
	Simple_window win(Point(100, 100), 600, 400, "RGB color chart");
	Vector_ref<Graph_lib::Rectangle> vr;
	
	int x = 0, y = 0;		// 座標
	const int a = 15;		// 正方形の一辺
	const int step = 51;	// Webセーフカラー( = 0x33 )

	for(int r = 0; r <= 255; r += step, y += a, x = 0){
		for(int g = 0; g <= 255; g += step){
			for(int b = 0; b <= 255; b += step, x += a){
				vr.push_back(new Graph_lib::Rectangle(Point(x, y), a, a));
				vr[vr.size() - 1].set_fill_color(Color(r * pow(2, 24) + g * pow(2, 16) + b * pow(2, 8)));
				win.attach(vr[vr.size() - 1]);						
			}
		}
	}

	win.wait_for_button();
}
Пример #6
0
// check distance between dots and mark them as exploded if too close
void Cube::collisionCheck() {
    for (uint8_t i=0; i<dot_n; i++)
        if (not vid.sprites[i].isHidden() && !dots[i].exp)
            for (uint8_t j=i+1; j<dot_n; j++)
                if (not vid.sprites[j].isHidden() && !dots[i].exp)  {
                    Float2 dif = dots[i].pos - dots[j].pos;
                    // are the dots too close ?
                    if (dif.len2() < SPR_size.len2()/4) {
                        dots[i].pos -= dif/2; // bring dots closer
                        dots[j].pos += dif/2; // to each other
                        dots[i].exp = exploDuration;
                        dots[j].exp = exploDuration;
#if ACCURATE == 1
                        // use a binary map to check if we hit or miss Conan:
                        dots[i].bnd = isHit(dots[i].pos);
                        dots[j].bnd = isHit(dots[j].pos);
#else
                        // ...or use a FlatAssetImage but it's less accurate:
                        Float2 o = SPR_size/2; // offset to sprite center
                        uint16_t linPosI = uint16_t( (dots[i].pos.x+o.x)/8 ) +
                                           uint16_t( (dots[i].pos.y+o.y)/8 ) *
                                           ConanIMG.tileWidth() ;
                        uint16_t linPosJ = uint16_t( (dots[j].pos.x+o.x)/8 ) +
                                           uint16_t( (dots[j].pos.y+o.y)/8 ) *
                                           ConanIMG.tileWidth() ;
                        // D'oh! need band aid ?
                        dots[i].bnd = (ConanIMG.tile(linPosI) != whiteTile);
                        dots[j].bnd = (ConanIMG.tile(linPosJ) != whiteTile &&
                                       linPosJ  != linPosI);
#endif
                        // D'oh! need band aid ?
                        if (dots[i].bnd)
                            lifeCounter -= 5;
                        if (dots[j].bnd)
                            lifeCounter -= 5;
                    }
                }

    if (lifeCounter <= 0)
        win();
}
void Layer::computeGeometry(const sp<const DisplayDevice>& hw, Mesh& mesh) const
{
    const Layer::State& s(getDrawingState());
    const Transform tr(hw->getTransform() * s.transform);
    const uint32_t hw_h = hw->getHeight();
    Rect win(s.active.w, s.active.h);
    if (!s.active.crop.isEmpty()) {
        win.intersect(s.active.crop, &win);
    }
    // subtract the transparent region and snap to the bounds
    win = reduce(win, s.activeTransparentRegion);

    Mesh::VertexArray<vec2> position(mesh.getPositionArray<vec2>());
    position[0] = tr.transform(win.left,  win.top);
    position[1] = tr.transform(win.left,  win.bottom);
    position[2] = tr.transform(win.right, win.bottom);
    position[3] = tr.transform(win.right, win.top);
    for (size_t i=0 ; i<4 ; i++) {
        position[i].y = hw_h - position[i].y;
    }
}
Пример #8
0
void  MainWindow::Blackplay(int x,int y)
{
           blackLabel=new QLabel(this);
           blackLabel->setPixmap(pixb);
           blackLabel->setGeometry(x-15,y-15,32,32);
           blackLabel->show();
           blackLabel;
           j=0;
           a[x][y]=-1;
           g[l]=blackLabel;
           l++;
           if(connected&&nn==QMessageBox::Yes){
               win();
               client_sendMessage();
               exchange = false;

           }
           else{
               exchange = true;
           }
}
Пример #9
0
void Layer::drawProtectedImage(const sp<const DisplayDevice>& hw, const Region& clip) const
{
    const State& s(getDrawingState());
    const Transform tr(hw->getTransform() * s.transform);
    const uint32_t hw_h = hw->getHeight();
    Rect win(s.active.w, s.active.h);
    if (!s.active.crop.isEmpty()) {
        win.intersect(s.active.crop, &win);
    }

    int w = win.getWidth();
    int h = win.getHeight();
    if (w > h) {
        win.left += ((w - h) / 2);
        win.right = win.left + h;
    } else {
        win.top += ((h - w) / 2);
        win.bottom = win.top + w;
    }

    Mesh::VertexArray<vec2> position(mMesh.getPositionArray<vec2>());
    position[0] = tr.transform(win.left,  win.top);
    position[1] = tr.transform(win.left,  win.bottom);
    position[2] = tr.transform(win.right, win.bottom);
    position[3] = tr.transform(win.right, win.top);
    for (size_t i=0 ; i<4 ; i++) {
        position[i].y = hw_h - position[i].y;
    }

    Mesh::VertexArray<vec2> texCoords(mMesh.getTexCoordArray<vec2>());
    texCoords[0] = vec2(0, 0);
    texCoords[1] = vec2(0, 1);
    texCoords[2] = vec2(1, 1);
    texCoords[3] = vec2(1, 0);

    RenderEngine& engine(mFlinger->getRenderEngine());
    engine.setupLayerProtectedImage();
    engine.drawMesh(mMesh);
    engine.disableBlending();
}
Пример #10
0
terminal *terminalTable(Table_T termtable, subBoard state)
{
  int player;
  int i;
  int w;
  int *canon = canonBoard(state);
  terminal *terms;

  if ((terms = Table_get(termtable, canon)) != 0) {
    free(canon);
    return terms;
  }

  terms = (terminal *) calloc(1, sizeof(terminal));

  if ((w = win(state)) != 0) {
    terms->max = (w == 1) ? 1 : 0;
    terms->min = (w == -1) ? 1 : 0;
  } else if (countOpen(state) == 0) {
    terms->max = 0;
    terms->min = 0;
  } else {
    int childState[9];
    memcpy(childState, state, 9*sizeof(int));

    for (i = 0; i < 9; ++i) {
      if (childState[i] == 0) {
	for (player = 0; player < 2; ++player) {
	  childState[i] = (2*player) - 1;
	  terminal *childterm = terminalTable(termtable, childState);
	  terms->max += childterm->max;
	  terms->min += childterm->min;
	}
	childState[i] = 0;
      }
    }
  }
  Table_put(termtable, canon, terms);
  return terms;
} 
Пример #11
0
HandleType FrameBuffer::createWindowSurface(int p_config, int p_width, int p_height)
{
    emugl::Mutex::AutoLock mutex(m_lock);

    HandleType ret = 0;

    const FbConfig* config = getConfigs()->get(p_config);
    if (!config) {
        return ret;
    }

    WindowSurfacePtr win(WindowSurface::create(
            getDisplay(), config->getEglConfig(), p_width, p_height));
    if (win.Ptr() != NULL) {
        ret = genHandle();
        m_windows[ret] = std::pair<WindowSurfacePtr, HandleType>(win,0);
        RenderThreadInfo *tinfo = RenderThreadInfo::get();
        tinfo->m_windowSet.insert(ret);
    }

    return ret;
}
Пример #12
0
int main(int argc, const char * argv[])
{
//    Packet pack = Packet::build(1, "tim le noob");
//    
//    
//    unsigned char *data = serPacket(pack);
//    
//    Packet *newPack = unserPacket(data);
//    
//    std::cout << newPack->getType() << std::endl;
//    std::cout << newPack->getSize() << std::endl;
//    auto datas = newPack->getData();
//    
//    for (unsigned int i=0; i<datas.size(); ++i)
//    {
//        std::cout << datas[i] << std::endl;
//    }
    MenuWindow win(1701, 1056, "R-TYPE");

    win.checkEvent();    
    return 0;
}
Пример #13
0
void CTScreenDevice::ConstructL()
	{
	//The following is just another test... it doesn't leave any resources for use by the test class AFAICT...
	RWsSession aSession;
	CWsScreenDevice *device1;
	CWsScreenDevice *device2;
	CWsScreenDevice *device3;

	aSession.Connect();
	device1=new(ELeave) CWsScreenDevice(aSession);
	device1->Construct(iTest->iScreenNumber);
	delete device1;
	device1=new(ELeave) CWsScreenDevice(aSession);
	device1->Construct(iTest->iScreenNumber);
	device2=new(ELeave) CWsScreenDevice(aSession);
	device2->Construct(iTest->iScreenNumber);
	device3=new(ELeave) CWsScreenDevice(aSession);
	device3->Construct(iTest->iScreenNumber);
	delete device3;
	CFbsFont *font;
	User::LeaveIfError(device1->GetNearestFontToDesignHeightInTwips((CFont *&)font,TFontSpec()));
	RWindowGroup group(aSession);
	group.Construct(777);
	group.SetOwningWindowGroup(TheClient->iGroup->GroupWin()->Identifier());
	RWindow win(aSession);
	win.Construct(group,77);
	CWindowGc *gc=new(ELeave) CWindowGc(device1);
	gc->Construct();
	gc->Activate(win);
	gc->UseFont(font);
	device1->ReleaseFont(font);
	aSession.Flush();
	delete gc;
	win.Close();
	group.Close();
	delete device1;
	delete device2;
	aSession.Close();
	}
Пример #14
0
void BPlayer::update(float dt)
{
    if (gettimeofday(&lastUpdate, NULL) != 0)
    {
        CCLOG("error in gettimeofday");
        lastUpdate.tv_sec = 0;
        lastUpdate.tv_usec = 0;
    }
    //adjust for how much has already been calcualted
    dt -= dtCalculated;
    dtCalculated = 0;
    
    //check explosions incase one went off on player
    if (level->checkExplosions(player->getBoundingBox()) && !isDying)
        die();
    
    handleCollisions(velocity.x * dt, velocity.y * dt);
    
    if (level->inExit(player->getBoundingBox()) && !isDying)
        win();
    
}
Пример #15
0
void  MainWindow::Whiteplay(int x,int y)
{
        whiteLabel=new QLabel(this);
        whiteLabel->setPixmap(pixw);
        whiteLabel->setGeometry(x-15,y-15,32,32);
        whiteLabel->show();
        whiteLabel;
        j=1;
        a[x][y]=1;
        g[l]=whiteLabel;
        l++;

        if(beconnected&&nn==QMessageBox::Yes){
           win();
            server_sendMessege();
            exchange = false;
        }
        else{
            exchange =true;
        }

}
Пример #16
0
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
	VideoMode vMode(800,600,32);
	RenderWindow win(vMode, "ASTEROIDS");
	win.SetFramerateLimit(120);
	//win.ShowMouseCursor(false);
	win.UseVerticalSync(false);

	int currentScreen = 0;
	Menu menu;

	Game game;

	Splash splash;
	

	while(currentScreen >= 0)
	{
		if (currentScreen == 0)
		{
			currentScreen = splash.Run(win, vMode);
			
		}
		if(currentScreen == 2)
		{
			currentScreen = menu.Run(win, vMode);
		}

		if(currentScreen == 1)
		{
			currentScreen = game.Run(win, vMode);
		}

	}

	return EXIT_SUCCESS;

	
}
Пример #17
0
int main()
{
    bwindow win(640,480);
    printf("%d\n",win.init());
    win.map();
    srand(time(NULL));
	Boids shield = Boids(100);
	Pred predators;
    for(;;)
    {
		int ev = win.parse_event();
		switch(ev)
		{
	    	case BKPRESS :
			printf("keypressed\n"); 
			printf("key : %s\n",win.get_lastkey());
			break;
	    	case BBPRESS:
			printf("buttonpressed\n"); break;
	    	case BEXPOSE:
			printf("expose\n"); break;
	    	case BCONFIGURE:
			printf("configure\n"); break;
		}
		win.draw_fsquare(0,0,640,480,0xFFFFFF);
		win.draw_fsquare(CENTEROBSTACLE - 5,CENTEROBSTACLE -5,CENTEROBSTACLE + 5,CENTEROBSTACLE + 5,0xFF00);
		win.draw_boids(shield);
		shield.nextflock();
		usleep(100000);
		/*
		win.draw_point(100,100,0xFF00);
		win.draw_line(100,100,200,200,0xFF0000);
		win.draw_text(10,10,0x0,"Hello World",strlen("Hello World"));
		win.draw_square(200,200,220,220,0xFF00);
		win.draw_fsquare(400,400,440,440,0xFF00);
		*/
    }
    return 0;
}
Пример #18
0
int main()
{
	try
	{
		game_win win(Point (100,100), 800, 600, "tic tac toe");
		
		
		return Fl::run();
	}
	catch(exception& e)
	{
		cerr << "Error: " << e.what() << endl;
		keep_window_open();
		return 1;
	}
	catch(...)
	{
		cerr << "Oops.\n";
		keep_window_open();
		return 2;
	}
}
Пример #19
0
void STGM::CBoolSphereSystem::IntersectWithPlane(STGM::Intersectors<STGM::CSphere>::Type &objects, STGM::CPlane &plane, int intern)
{
  /// Intersect only objects fully inside the observation window
   int i=0,j=0;
   int l =plane.idx();
   switch(l) {
      case 0: i=1; j=2; break; // YZ
      case 1: i=0; j=2; break; // XZ
      case 2: i=0; j=1; break; // XY
   }

   // assume left-down corner is origin of box
   CWindow win(m_box.m_size[i],m_box.m_size[j]);

   for(size_t i=0; i<m_spheres.size(); ++i) {
       STGM::Intersector<STGM::CSphere> intersector( m_spheres[i], plane, m_box.m_size);
        if(intersector.FindIntersection()) {
          if(intersector.getCircle().isInWindow(win))
              objects.push_back( intersector );
        }
   }
}
Пример #20
0
int main()
{
  typedef  CGAL::Tree_traits_1::Key Key;
  typedef  CGAL::Tree_traits_1::Interval Interval;
  std::vector<Key> InputList, OutputList;
  std::vector<Key>::iterator first, last, current;

  InputList.push_back(8.0);
  InputList.push_back(1.0);
  InputList.push_back(3.9);
  InputList.push_back(2.0);
  InputList.push_back(5.0);
  InputList.push_back(4.8);
  InputList.push_back(7.7);
  InputList.push_back(6.8);

  first = InputList.begin();
  last = InputList.end();

  Range_tree_1_type Range_tree_1(first,last);

  Interval win(Interval(4.6, 6.8));

  std::cerr << "\n Window Query (4.6, 6.8) \n";
  Range_tree_1.window_query(win, std::back_inserter(OutputList));
  current=OutputList.begin();

  while(current!=OutputList.end())
  {
    std::cerr << (*current) << std::endl;
    current++;
  }

  if(Range_tree_1.range_tree_1->is_valid())
    std::cerr << "Tree is valid\n";
  else
    std::cerr << "Tree is not valid\n";
  return 0;
}
Пример #21
0
int
check_up(void)
{
    if (!wizard) {
        if (!(dungeon[rogue.row][rogue.col] & STAIRS)) {
            messagef(0, "I see no way up");
            return(0);
        }
        if (!has_amulet()) {
            messagef(0, "your way is magically blocked");
            return(0);
        }
    }
    new_level_message = "you feel a wrenching sensation in your gut";
    if (cur_level == 1) {
        win();
    } else {
        cur_level -= 2;
        return(1);
    }
    return(0);
}
Пример #22
0
NS_IMETHODIMP    
nsMsgPrintEngine::SetWindow(nsIDOMWindow *aWin)
{
	if (!aWin)
  {
    // It isn't an error to pass in null for aWin, in fact it means we are shutting
    // down and we should start cleaning things up...
		return NS_OK;
  }

  mWindow = aWin;

  nsCOMPtr<nsPIDOMWindow> win( do_QueryInterface(aWin) );
  NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);

  win->GetDocShell()->SetAppType(nsIDocShell::APP_TYPE_MAIL);

  nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
    do_QueryInterface(win->GetDocShell());
  NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);

  nsCOMPtr<nsIDocShellTreeItem> rootAsItem;
  docShellAsItem->GetSameTypeRootTreeItem(getter_AddRefs(rootAsItem));

  nsCOMPtr<nsIDocShellTreeNode> rootAsNode(do_QueryInterface(rootAsItem));
  NS_ENSURE_TRUE(rootAsNode, NS_ERROR_FAILURE);

  nsCOMPtr<nsIDocShellTreeItem> childItem;
  rootAsNode->FindChildWithName(NS_LITERAL_STRING("content").get(), true,
				false, nsnull, nsnull,
				getter_AddRefs(childItem));

  mDocShell = do_QueryInterface(childItem);

  if(mDocShell)
    SetupObserver();

  return NS_OK;
}
Пример #23
0
int main(int argc, char* argv[])
{
  QApplication app(argc, argv);
  app.setOrganizationName(ORG_NAME);
  app.setApplicationName(APP_NAME);
  int mainRows, mainCols, subRows, subCols;
  {
    // qui non è necessario usare i settings: servono per modificare/ripristinare il numero di video a runtime!
    QSettings settings(app.organizationName(), app.applicationName());
    settings.beginGroup("grid");
    mainRows = settings.value("mainRows", VIDEO_MAIN_ROWS).toInt();
    mainCols = settings.value("mainCols", VIDEO_MAIN_COLS).toInt();
    subRows  = settings.value( "subRows", VIDEO_SUB_ROWS ).toInt();
    subCols  = settings.value( "subCols", VIDEO_SUB_ROWS ).toInt();
    settings.endGroup();
  }
  Frontend win(mainRows, mainCols, subRows, subCols);
  //QUrl url = QUrl("file:///Users/awaken/Pictures/foto/CELL/video-2010-12-13-07-31-46.mp4");
  //win.mainVideo()->setUri(&url);
  win.show();
  return app.exec();
}
Пример #24
0
int minimax(int board[9], int player) {
    //How is the position like for player (their turn) on board?
    int winner = win(board);
    if(winner != 0) return winner*player;

    int move = -1;
    int score = -2;//Losing moves are preferred to no move
    int i;
    for(i = 0; i < 9; ++i) {//For all moves,
        if(board[i] == 0) {//If legal,
            board[i] = player;//Try the move
            int thisScore = -minimax(board, player*-1);
            if(thisScore > score) {
                score = thisScore;
                move = i;
            }//Pick the one that's worst for the opponent
            board[i] = 0;//Reset board after try
        }
    }
    if(move == -1) return 0;
    return score;
}
Пример #25
0
int main(int argc, char *argv[]) {
    int w = WIDTH/2, h = HEIGHT/2;
    SDL_Rect window_rect = {(WIDTH - w) / 2, (HEIGHT - h) / 2, w, h};
	Application *app = Application::getInstance();

    char dir[513] = {0x00};
    getcwd(dir, 512);
    LOGD("DIR: %s", dir);
	Window      win2(std::string("uuuuu hello world"), WIDTH , HEIGHT , SDL_WINDOW_SHOWN); 
    Layout dlg2("Hello, world!", window_rect);
	win2.addChild(&dlg2);
	LOGD("create win2 end");	

	std::string title("hello");
	Window      win(title, WIDTH, HEIGHT, SDL_WINDOW_SHOWN); 
	//Window      win(std::string("hello"), WIDTH, HEIGHT); 

    Layout dlg("Hello, world!", window_rect);
    //Label label(renderer, (SDL_Rect){0,0,w,h}, "Hello!");
    Label label((SDL_Rect){0,0, 64,28}, "Hello!");
    dlg.addChild(&label);

    Input input((SDL_Rect){64 + 4, 0, 128,28});
    dlg.addChild(&input);

    Button button((SDL_Rect){w / 2,h / 2,w / 2 ,h / 2}, "OK");
    dlg.addChild(&button);

	win.addChild(&dlg);

    LOGD("app addChild 1");
    app->addChild(&win);
    LOGD("app addChild 2");
    //app->addChild(&win2);
    LOGD("app run");
    //sleep(1000 * 30);
	app->run();
    return 0;
}
Пример #26
0
int main(){
	Simple_window win(Point(100, 100), 600, 400, "ClassDiagram");
	
	Vector_ref<Box> boxes;
	Vector_ref<Arrow> arrows;

	boxes.push_back(new Box(Point(50, 50), 100, 30, 10, "Window"));
	boxes.push_back(new Box(Point(200, 50), 100, 30, 10, "Line style"));
	boxes.push_back(new Box(Point(350, 50), 70, 30, 10, "Color"));
	boxes.push_back(new Box(Point(25, 150), 150, 30, 10, "Simple window"));
	boxes.push_back(new Box(Point(400, 150), 70, 30, 10, "Point"));
	boxes.push_back(new Box(Point(240, 120), 70, 30, 10, "Shape"));
	boxes.push_back(new Box(Point(15, 300), 50, 30, 10, "Line"));
	boxes.push_back(new Box(Point(70, 300), 70, 30, 10, "Lines"));
	boxes.push_back(new Box(Point(145, 300), 100, 30, 10, "Polygon"));
	boxes.push_back(new Box(Point(250, 300), 50, 30, 10, "Axis"));
	boxes.push_back(new Box(Point(305, 300), 100, 30, 10, "Rectangle"));
	boxes.push_back(new Box(Point(410, 300), 60, 30, 10, "Text"));
	boxes.push_back(new Box(Point(475, 300), 70, 30, 10, "Image"));

	Arrow a(n(boxes[3]), s(boxes[0]), 10);
	a.set_style(Line_style(Line_style::solid, 3));
	win.attach(a);

	for(int i = 6; i <= 12; ++i){
		arrows.push_back(new Arrow(n(boxes[i]), Point(s(boxes[5]).x - 30 + (i - 6) * 10, s(boxes[5]).y), 10));
		arrows[arrows.size() - 1].set_style(Line_style(Line_style::solid, 3));
		win.attach(arrows[arrows.size() - 1]);
	}

	for(int i = 0; i < boxes.size(); ++i){
		boxes[i].set_style(Line_style(Line_style::solid, 3));
		boxes[i].set_fill_color(Color(220));	// 青
		win.attach(boxes[i]);
	}

	win.wait_for_button();
}
Пример #27
0
/**
 * 
 * @param argc
 * @param argv first is input path, second ist output path, third to disable window
 * @return 
 */
int main(int argc, char* argv[]) {
    unsigned const width = 1280;
    unsigned const height = 720;

    std::cout << "welcome to Raytracer ("<< width<<"x"<<height<<")." <<std::endl;
    Renderer* app = nullptr;
    if (argc>1)
        app = new Renderer(width, height, argv[1]);
    else
        app = new Renderer(width, height);

    std::thread thr([&app]() { app->render(); });

    bool nogui=false;
    for (int i = 0; i < argc; i++) {
        if (string(argv[i]).compare("nogui")==0)
            nogui=true;
    }

    if (!nogui){
        Window win(glm::ivec2(width,height));

        while (!win.shouldClose()) {
          if (win.isKeyPressed(GLFW_KEY_ESCAPE)) {
            win.stop();
          }

          glDrawPixels( width, height, GL_RGB, GL_FLOAT
                      , app->colorbuffer().data());

          win.update();
        }
    }
    thr.join();

    delete(app);
    return 0;
}
Пример #28
0
bool recur(char player) {
	if (win() && player == 'o') return false;
	if (full() && player == 'o') return true;
	for (int i = 0; i < 3; ++i)
		for (int j = 0; j < 3; ++j) {
			if (a[i][j] == '.') {
				a[i][j] = player;
				if (player == 'o') {
					if (!recur('x')) {
						a[i][j] = '.';
						return true;
					}
				} else {
					if (!recur('o')) {
						a[i][j] = '.';
						return true;
					}	
				}
				a[i][j] = '.';
			}
		}
	return false;
}
Пример #29
0
void ClassDemoApp::Render() {
	program->setModelMatrix(modelMatrix);
	program->setProjectionMatrix(projectionMatrix);
	program->setViewMatrix(viewMatrix);
	glClear(GL_COLOR_BUFFER_BIT);
	switch (state) {
	case STATE_MENU:
		RenderMenu();
		break;
	case STATE_GAME:
		RenderGame();
		break;
	case STATE_END:
		if (amAlive){ 
			win(); 
		}
		else{ 
			lose(); 
		}
		break;
	}
	SDL_GL_SwapWindow(displayWindow);
}
Пример #30
0
int main( int argc, char **argv )
{
	phobos::system::qt4::base test_factory( argc, argv );
	
	fcppt::io::stringstream input( event );
	phobos::primitives::widget w( phobos::primitives::compile( input ) );

	phobos::system::window_ptr win(
		test_factory.create(
			phobos::system::window_parameters()
				.type(
					phobos::system::window_type::managed)
				.size(
					phobos::dim(400, 400))
				.root(
					w)));

	presenter p( w );

	win->root( w );

	return test_factory.run();
}