当前位置: 首页>>代码示例>>C++>>正文


C++ rb函数代码示例

本文整理汇总了C++中rb函数的典型用法代码示例。如果您正苦于以下问题:C++ rb函数的具体用法?C++ rb怎么用?C++ rb使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rb函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: recurClear

//-----% Room Generation Functions %------
int recurClear(lvl *level, int h, int w, int x, int y, int doH, int showGen){

	if (h && doH == 1) recurClear(level, h-1, w, x, y,1, showGen);
	if (w) recurClear(level, h, w-1, x, y,0, showGen);

	if(rb(1,CHANCE_HIGH)==1)
		level->nodeSet(y+h,x+w, '$');
	else if(rb(1,CHANCE_LOW)==1)
		level->nodeSet(y+h,x+w, '*');
	else if(rb(1,CHANCE_MED)==1)
		level->nodeSet(y+h,x+w, 'o');
	else
		level->nodeSet(y+h,x+w, ' ');

	if (showGen){
		system("CLS");
		for (int i = 0; i < MAX_H; i++){
			for (int j = 0; j < MAX_W; j++){
					printf("%c", level->nodeGet(i,j));
			}
				printf("\n");
		}
	}
	return 1;
}
开发者ID:Liamgunboun,项目名称:WebSlash-Solo,代码行数:26,代码来源:LevelGen+0.02.cpp

示例2: makeStartInv

void makeStartInv(){
    FILE* invFile;
    invFile = fopen("../playerFiles/playerInv.txt","w");
    char itemName[MAX_NAME_LEN];
    fprintf(invFile,"%s %i %i\n", weaponNameGen(itemName, rb(1,3), 2),0,WEAPON_FLAG);
    fprintf(invFile,"%s %i %i\n", armorNameGen(itemName, rb(1,5), 2),0,ARMOR_FLAG);

    fclose(invFile);
}
开发者ID:Liamgunboun,项目名称:WebSlash-Solo,代码行数:9,代码来源:inv.cpp

示例3: getmarker

static int
getmarker(void) {
	int c;
	
	c = rb(0);
	if (c == -1) return -1;
	if (c!=0xff) return -1;
	c = rb(0);
	return c;
}
开发者ID:mejedi,项目名称:Gphoto2.framework,代码行数:10,代码来源:xjpeg.c

示例4: addRandToInv

void addRandToInv(int type){
    FILE* invFile;
    invFile = fopen("../playerFiles/playerInv.txt","a");
    char itemName[MAX_NAME_LEN];
    if (type == 1)
    fprintf(invFile,"%s %i %i\n", weaponNameGen(itemName, rb(1,3), MIN_WEP_ATK + 0.5 * WEP_ATK_INC),0,WEAPON_FLAG);
    else
    fprintf(invFile,"%s %i %i\n", armorNameGen(itemName, rb(1,5), MIN_ARM_DEF + 0.5 * ARM_DEF_INC),0,ARMOR_FLAG);

    fclose(invFile);
}
开发者ID:Liamgunboun,项目名称:WebSlash-Solo,代码行数:11,代码来源:inv.cpp

示例5: getlength

static int
getlength(void) {
	int x1,x2;
	
	x1 = rb(1);
	if (x1 == -1) return -1;
	x2 = rb(1);
	if (x2 == -1) return -1;
	x1 =  (x1 << 8) | x2;
	fprintf(stderr,"(%d)",x1);
	return x1;
}
开发者ID:mejedi,项目名称:Gphoto2.framework,代码行数:12,代码来源:xjpeg.c

示例6: rd

static int
rd(int len, char *data) {
	unsigned int c,i;

	for (i=0;i<len;i++) {
		c = rb(1);
		if (c == -1) return -1;
		if (c == 0xff) c = rb(1);
		if (c == -1) return -1;
		data[i] = c;
	}
	return len;
}
开发者ID:mejedi,项目名称:Gphoto2.framework,代码行数:13,代码来源:xjpeg.c

示例7: shuffleDeck

void shuffleDeck (cardType *deck) {
	cardType temp;
	int i1, i2; 
	
	for (int i = 0; i < NUM_SHUFFLES; i++) {
		i1 = rb (0, NUM_CARDS - 1);
		i2 = rb (0, NUM_CARDS - 1);
		
		temp = deck[i1];
		deck[i1] = deck[i2];
		deck[i2] = temp; 
	}
	
}
开发者ID:JamesonWeng,项目名称:Five-Card-Poker,代码行数:14,代码来源:Poker.c

示例8: move

static void		move(t_env *env, t_sort *s)
{
	if (s->dir)
		rb(env);
	else
		rrb(env);
}
开发者ID:GabrielPora,项目名称:WeThinkCode,代码行数:7,代码来源:sort.c

示例9: MyMotionState

btRigidBody* BulletPhysics::addObject(osg::MatrixTransform *root, osg::Node *node, btScalar mass, btVector3 inertia, collisionShapeType_t ctype, CollisionDataType * data,osg::Node * colShape) {
    

   btCollisionShape* cs;
   if(colShape==NULL)
     cs=GetCSFromOSG( node, ctype);
   else
     cs=GetCSFromOSG( colShape, ctype);

    MyMotionState* motion = new MyMotionState(node,root);
    cs->calculateLocalInertia( mass, inertia );
    btRigidBody::btRigidBodyConstructionInfo rb( mass, motion, cs, inertia );
    btRigidBody* body = new btRigidBody( rb );
    body->setUserPointer(data);

    //addRigidBody adds its own collision masks, changing after object creation do not update masks so objects are removed and readded in order to update masks to improve collisions performance.
    dynamicsWorld->addRigidBody( body);
    if(data->isVehicle){
      dynamicsWorld->btCollisionWorld::removeCollisionObject(body);
      dynamicsWorld->addCollisionObject(body,short( COL_VEHICLE),short(vehicleCollidesWith));
    }
    else{
      dynamicsWorld->btCollisionWorld::removeCollisionObject(body);
      dynamicsWorld->addCollisionObject(body,short( COL_OBJECTS),short(objectsCollidesWith));
    }

 

    return( body );

}
开发者ID:perezsolerj,项目名称:underwater_simulation,代码行数:31,代码来源:BulletPhysics.cpp

示例10: main

int main(int argc, char ** argv)
{
	try
	{
		Int64 x1 = std::numeric_limits<Int64>::min();
		Int64 x2 = 0;
		std::string s;

		std::cerr << static_cast<Int64>(x1) << std::endl;
		
		{
			DB::WriteBufferFromString wb(s);
			DB::writeIntText(x1, wb);
		}

		std::cerr << s << std::endl;

		{
			DB::ReadBufferFromString rb(s);
			DB::readIntText(x2, rb);
		}

		std::cerr << static_cast<Int64>(x2) << std::endl;
	}
	catch (const DB::Exception & e)
	{
		std::cerr << e.what() << ", " << e.displayText() << std::endl;
		return 1;
	}

	return 0;
}
开发者ID:Aahart911,项目名称:ClickHouse,代码行数:32,代码来源:read_write_int.cpp

示例11: lt

void ofxMesh::addFace(ofRectangle r) {
    ofVec2f lt(r.x,r.y);
    ofVec2f rt(r.x+r.width,r.y);
    ofVec2f rb(r.x+r.width,r.y+r.height);
    ofVec2f lb(r.x,r.y+r.height);
    addFace(lt,lb,rb,rt);
}
开发者ID:daitomanabe,项目名称:ofxMesh,代码行数:7,代码来源:ofxMesh.cpp

示例12: readCSV

void DataTypeArray::deserializeTextCSV(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const
{
    String s;
    readCSV(s, istr, settings.csv);
    ReadBufferFromString rb(s);
    deserializeText(column, rb, settings);
}
开发者ID:filimonov,项目名称:ClickHouse,代码行数:7,代码来源:DataTypeArray.cpp

示例13: on_draw

    virtual void on_draw()
    {
        int width = rbuf_window().width();
        int height = rbuf_window().height();

        typedef agg::scanline_u8_am<agg::alpha_mask_gray8> scanline_type;
        typedef agg::renderer_base<agg::pixfmt_bgr24> ren_base;
        typedef agg::renderer_scanline_aa_solid<ren_base> renderer;

        agg::pixfmt_bgr24 pixf(rbuf_window());
        ren_base rb(pixf);
        renderer r(rb);

        scanline_type sl(g_alpha_mask);
        rb.clear(agg::rgba8(255, 255, 255));

        agg::trans_affine mtx;
        mtx *= agg::trans_affine_translation(-g_base_dx, -g_base_dy);
        mtx *= agg::trans_affine_scaling(g_scale, g_scale);
        mtx *= agg::trans_affine_rotation(g_angle + agg::pi);
        mtx *= agg::trans_affine_skewing(g_skew_x/1000.0, g_skew_y/1000.0);
        mtx *= agg::trans_affine_translation(width/2, height/2);

        agg::conv_transform<agg::path_storage, agg::trans_affine> trans(g_path, mtx);

        agg::render_all_paths(g_rasterizer, sl, r, trans, g_colors, g_path_idx, g_npaths);
    }
开发者ID:asmboom,项目名称:PixelFarm,代码行数:27,代码来源:alpha_mask.cpp

示例14: loadTestData

void 
ResourceBundleTest::TestGetLocaleByType(void) 
{
    const struct {
        const char *requestedLocale;
        const char *resourceKey;
        const char *validLocale;
        const char *actualLocale;
    } test[] = {
        { "te_IN_BLAH", "string_only_in_te_IN", "te_IN", "te_IN" },
        { "te_IN_BLAH", "string_only_in_te", "te_IN", "te" },
        { "te_IN_BLAH", "string_only_in_Root", "te_IN", "root" },
        { "te_IN_BLAH_01234567890_01234567890_01234567890_01234567890_01234567890_01234567890", "array_2d_only_in_Root", "te_IN", "root" },
        { "[email protected]=euro", "array_2d_only_in_te_IN", "te_IN", "te_IN" },
        { "[email protected]=thai;collation=phonebook", "array_2d_only_in_te", "te_IN", "te" }
    };
    
    UErrorCode status = U_ZERO_ERROR;
    
    const char* testdatapath = loadTestData(status);
    int32_t i = 0;
    Locale locale;
    
    if(U_FAILURE(status))
    {
        dataerrln("Could not load testdata.dat %s\n", u_errorName(status));
        return;
    }
    
    for(i = 0; i < (int32_t)(sizeof(test)/sizeof(test[0])); i++) {
        ResourceBundle rb(testdatapath, test[i].requestedLocale, status);
        if(U_FAILURE(status))
        {
            err("Could not open resource bundle %s (error %s)\n", test[i].requestedLocale, u_errorName(status));
            status = U_ZERO_ERROR;
            continue;
        }
        
        ResourceBundle res = rb.get(test[i].resourceKey, status);
        if(U_FAILURE(status))
        {
            err("Couldn't find the key %s. Error: %s\n", test[i].resourceKey, u_errorName(status));
            status = U_ZERO_ERROR;
            continue;
        }
        
        locale = res.getLocale(ULOC_REQUESTED_LOCALE, status);
        if(locale != Locale::getDefault()) {
            err("Expected requested locale to be %s. Got %s\n", test[i].requestedLocale, locale.getName());
        }
        locale = res.getLocale(ULOC_VALID_LOCALE, status);
        if(strcmp(locale.getName(), test[i].validLocale) != 0) {
            err("Expected valid locale to be %s. Got %s\n", test[i].requestedLocale, locale.getName());
        }
        locale = res.getLocale(ULOC_ACTUAL_LOCALE, status);
        if(strcmp(locale.getName(), test[i].actualLocale) != 0) {
            err("Expected actual locale to be %s. Got %s\n", test[i].requestedLocale, locale.getName());
        }
    }
}
开发者ID:LittoCats,项目名称:OT_4010D,代码行数:60,代码来源:restest.cpp

示例15: draw_dashes_draft

    //------------------------------------------------------------------------
    void draw_dashes_draft()
    {
        pixfmt pixf(rbuf_window());
        base_renderer rb(pixf);
        primitives_renderer prim(rb);
        outline_rasterizer ras(prim);

        int i;
        for(i = 0; i < m_graph.get_num_edges(); i++)
        {
            graph::edge e  = m_graph.get_edge(i);
            graph::node n1 = m_graph.get_node(e.node1, width(), height());
            graph::node n2 = m_graph.get_node(e.node2, width(), height());
            curve c(n1.x, n1.y, n2.x, n2.y);
            dash_stroke_draft<curve> s(c, 6.0, 3.0, m_width.value());

            int r = rand() & 0x7F;
            int g = rand() & 0x7F;
            int b = rand() & 0x7F;
            int a = 255;
            if(m_translucent.status()) a = 80;
            prim.line_color(agg::srgba8(r, g, b, a));
            ras.add_path(s);
        }
    }
开发者ID:Bashakov,项目名称:agg,代码行数:26,代码来源:graph_test.cpp


注:本文中的rb函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。