Exemplo n.º 1
0
void GTerm::erase_display()
{
    switch (param[0])
    {
        case 0:
            clear_area(cursor_x, cursor_y, width - 1, cursor_y);

            if (cursor_y<height - 1)
			{
                clear_area(0, cursor_y + 1, width - 1, height - 1);
			}
            break;

        case 1:
            clear_area(0, cursor_y, cursor_x, cursor_y);

            if (cursor_y>0)
			{
                clear_area(0, 0, width - 1, cursor_y - 1);
			}
            break;

        case 2:
            clear_area(0, 0, width - 1, height - 1);
            break;
    }
}
Exemplo n.º 2
0
//int selectmenu(char *menu1,char *menu2,char *menu3,int no)
int selectmenu(char *menu1,char *menu2,int no)
{
	
	int x1=6,y1=12,x2=126,y2=36,yfill1=15,n1=1;
	clear_area (5, 12, 121, 48);
	clear_area (xstart,yfill1,xend,15);	
	if(strlen(menu1)>0)
	kmy_LcdTextOut(xstart,15,menu1);
	if(strlen(menu2)>0)
	kmy_LcdTextOut(xstart,30,menu2);
	//if(strlen(menu3)>0)
	//kmy_LcdTextOut(xstart,45,menu3);
	reverse_area(xstart,yfill1,xend,15,2);
	myprintf("\n Select Menu Is called\n");
	Keydata=0;
	//	while(Keydata!=KEY_L1 && Keydata!=KEY_R1)
	while(Keydata!=KEY_ReturnPrevious && Keydata!=KEY_Enter)
	{
		Keydata=0;
		Keydata=kmy_GetKeyValue();
		if(Keydata==KEY_ReturnPrevious)
		return 0;
		if(Keydata==KEY_DOWN && n1<no)
		{
			n1++;
			clear_area (xstart,yfill1,xend,15);	
			if(strlen(menu1)>0)
			kmy_LcdTextOut(xstart,15,menu1);
			if(strlen(menu2)>0)
			kmy_LcdTextOut(xstart,30,menu2);
		//	if(strlen(menu3)>0)
		//	kmy_LcdTextOut(xstart,45,menu3);
			yfill1=yfill1+15;
			reverse_area(xstart,yfill1,xend,15,2);
		}else if(Keydata==KEY_UP && n1>1)
		{	n1--;
			clear_area (xstart,yfill1,xend,15);	
			yfill1=yfill1-15;	
			if(strlen(menu1)>0)
			kmy_LcdTextOut(xstart,15,menu1);
			if(strlen(menu2)>0)
			kmy_LcdTextOut(xstart,30,menu2);
		//	if(strlen(menu3)>0)
			//kmy_LcdTextOut(xstart,45,menu3);
			reverse_area(xstart,yfill1,xend,15,2);
		}
		
		
		
	}
	printf("\nyfill in selectmenu()=%d\n",yfill1);
	x1=yfill1/15;

	return x1;
	

}
Exemplo n.º 3
0
void VTerm::erase_line()
{
	switch (param[0]) {
	case 0:
		clear_area(cursor_x, cursor_y, width - 1, cursor_y);
		break;
	case 1:
		clear_area(0, cursor_y, cursor_x, cursor_y);
		break;
	case 2:
		clear_area(0, cursor_y, width - 1, cursor_y);
		break;
	}
}
Exemplo n.º 4
0
int show(char a[160],char txt[40],int size)
{
    int i;
    char s[2];
  	D_Ycoord=20;
	D_Xcoord=-6;
	clear_area(5,12,121,48);
	kmy_LcdTextOut(5,12,txt);
    myprintf("********entered show detail*******");
    s[1]='\0';
	page=0;
    charlen=0;
	chklen=strlen(a);
	A_len=chklen-1;
   for(i=0;i<chklen;i++)
   {

        s[0]=a[i];
		D_Xcoord=D_Xcoord+6;
		kmy_LcdTextOut(5+D_Xcoord,5+D_Ycoord,s);
		//if(i==chklen-1)
		//kmy_LcdTextOut(D_Xcoord+6,5+D_Ycoord," ");
		if(i==56 || i==113)
		{ 
		 page++;
		 charlen++;
		D_Xcoord=-6;
		D_Ycoord=20;
		clear_area(5,22,121,42);
		//drawline1();	
		if(page>2)
		{
		page=2;
		charlen=2;
		}
		}
	    if(D_Xcoord>=108)
		 {	//text_out(5+D_Xcoord+6,5+D_Ycoord," ");
			D_Xcoord=-6;
			D_Ycoord=D_Ycoord+12;
		}
		if(A_len==56)
		D_Xcoord=-6;
	}
  kmy_LcdTextOut(11+D_Xcoord,5+D_Ycoord," ");
  printf("\n#####a[]=%s xco==%d len==%d",a,D_Xcoord,strlen(a));
  //ChkForAlphacreatesms(txt,size);
  myprintf("\nreturned from print\n");
  return 1;
}
void DisplayChannel::create_primary_surface(int width, int height, uint32_t format)
{
   Canvas *canvas;
   _mark = false;
    attach_to_screen(get_client().get_application(), get_id());
    clear_area();

    AutoRef<CreatePrimarySurfaceEvent> event(new CreatePrimarySurfaceEvent(*this, width, height,
                                                                           format));
    get_client().push_event(*event);
    (*event)->wait();
    if (!(*event)->success()) {
        THROW("Create primary surface failed");
    }

    _x_res = width;
    _y_res = height;
    _format = format;

    canvas = surfaces_mngr.get_canvas(0);

#ifdef USE_OGL
    if (canvas->get_pixmap_type() == CANVAS_TYPE_GL) {
        ((GCanvas *)(canvas))->touch_context();
        screen()->set_update_interrupt_trigger(&_interrupt_update);
        screen()->set_type_gl();
    }
#endif
}
Exemplo n.º 6
0
int cl_change_map(char *map_name, int gamemode)
{

    client.screenpos.x = 0;
    client.screenpos.y = 0;
    client.health = 0; /* To make sure statusbar updates */
    client.map_target_active = 0;

    draw_load_screen(client.loadscreen);

    /* Load the map */
    if( !(map = map_load(client.map, L_BASE|L_OBJECT|L_TOPLEVEL|L_TEXT, MAP))){
	printf("** ERROR LOADING MAP %s! **\n", client.map);
	cl_network_disconnect();
	client.state = MENU; /* Go back to menu */
	return 0;
    }

    /* Load tileset and store pixmap id's in tileset tables  */
    maptext_init(map->text_root);
    tileset_load(map->tileset);
    preload_entities(map_name, gamemode);

    client.state = GAME_JOIN;  /* Status of JOINING on the server */
    cl_netmsg_send_ready();    /* Request to be ACTIVE on the server */
    cl_net_finish();

    /* Clear the map buffer if map doesn't take up the entire buffer as there
       will still be stuff there from the last map */
    if( map->width < client.view_w || map->height < client.view_h )
	clear_area(win.map_buf, 0, 0, client.view_w, client.view_h, "black");
    return 1;

}
Exemplo n.º 7
0
void sceneShow::show_scene(int n)
{
    if (n < 0) {
        return;
    }
    if (scene_list.size() <= n) {
        std::cout << "ERROR: Scene List[" << n << "] invalid. List size is " << image_scenes.size() << "." << std::endl;
        return;
    }
    CURRENT_FILE_FORMAT::file_scene_list scene = scene_list.at(n);
    input.clean();

    for (int i=0; i<SCENE_OBJECTS_N; i++) {
        input.read_input();
        int scene_seek_n = scene.objects[i].seek_n;
        //std::cout << ">> sceneShow::show_scene - i: " << i << ", scene_seek_n: " << scene_seek_n << std::endl;

        if (_interrupt_scene == true || input.p1_input[BTN_START] == 1) {
            scene_seek_n = -1;
            break;
        }

        if (scene_seek_n != -1) {
            int scene_type = scene.objects[i].type;
            //std::cout << "### scene_type[" << scene_type << "]" << std::endl;
            if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_TEXT) {
                show_text(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_AREA) {
                clear_area(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_SCREEN) {
                graphLib.clear_area(0 ,0, RES_W, RES_H, 0, 0, 0);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_IMAGE) {
                show_image(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_VIEWPOINT) {
                show_viewpoint(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_MUSIC) {
                play_music(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_SFX) {
                play_sfx(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_ANIMATION) {
                show_animation(scene_seek_n, scene.objects[i].repeat_value, scene.objects[i].repeat_type);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_STOP_MUSIC) {
                soundManager.stop_music();
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SUBSCENE) {
                show_scene(scene_seek_n);
            } else {
                std::cout << ">> sceneShow::show_scene - unknown scene_type[" << scene_type << "]" << std::endl;
            }
            std::cout << "show_scene::DELAY[" << i << "][" << scene.objects[i].delay_after << "]" << std::endl;
            if (input.waitScapeTime(scene.objects[i].delay_after) == 1) {
                _interrupt_scene = true;
            }
        } else {
            break;
        }
    }
    std::cout << "show_scene::DONE" << std::endl;
}
Exemplo n.º 8
0
void Pit::fall_garbage(Garbage& garbage)
{
	RowCol rc = garbage.rc();
	RowCol to { rc.r+1, rc.c };

	clear_area(garbage);
	garbage.set_rc(to);
	fill_area(garbage);
}
Exemplo n.º 9
0
void GTerm::bs()
{
    if (cursor_x>0)
        move_cursor(cursor_x - 1, cursor_y);

    if (mode_flags & DESTRUCTBS)
    {
        clear_area(cursor_x, cursor_y, cursor_x, cursor_y);
    }
}
Exemplo n.º 10
0
void VTerm::delete_char()
{
	u16 n, mx;
	n = param[0];
	if (n < 1) n = 1;

	mx = width - cursor_x;

	if (n >= mx) clear_area(cursor_x, cursor_y, width - 1, cursor_y);
	else shift_text(cursor_y, cursor_x, width - 1, -n);
}
Exemplo n.º 11
0
void VTerm::delete_line()
{
	u16 n, mx;

	n = param[0];
	if (n < 1) n = 1;

	mx = scroll_bot - cursor_y + 1;

	if (n >= mx) clear_area(0, cursor_y, width - 1, scroll_bot);
	else scroll_region(cursor_y, scroll_bot, n);
}
Exemplo n.º 12
0
void VTerm::erase_char()
{
	u16 n, mx;

	n = param[0];
	if (n < 1) n = 1;

	mx = width - cursor_x;
	if (n > mx) n = mx;

	clear_area(cursor_x, cursor_y, cursor_x + n - 1, cursor_y);
}
Exemplo n.º 13
0
void cl_net_connection_lost(char *str)
{
    if( str ) {
	clear_area(win.buf, 0, client.view_h/2, client.view_w, 32, "black");
	win_center_print(win.buf, str, client.view_h/2, 3, "white");
    } else
	win_center_print(win.buf, "Connection to server lost", 
			 client.view_h/2, 3, "white");
    win_update();
    delay(2*M_SEC);
    cl_network_disconnect();
    client.state = MENU;
}
Exemplo n.º 14
0
/*Function to move a particular box upwards while swapping*/
void moveupforswap(int starty, int endy, int pos1, int pos2, boxx b, int speed){
	int i,j;
	for(i = starty ; i >= endy ; i--){
		clear_area();
		for(j = 0 ; j < 8 ; j++){
			if(j == pos1)
				printbox(coords[pos1].x-array[j].length/2, i-array[j].length/2, b);
			else if(j != pos2)
				printbox(coords[j].x-array[j].length/2,coords[j].y-array[j].length/2, array[j]);
		}
		napms(1000/speed);
		refresh();
	}
}
Exemplo n.º 15
0
/*Function to move a box left while swapping*/
void moveleftforswap(int pos1, int pos2, boxx b, int yy, int speed){
	int i,j;
	if(yy == -1)
		yy =  coords[pos1].y - AIR - array[pos1].length/2;
	for(i = coords[pos1].x; i >= coords[pos2].x ; i--){
		clear_area();
		for(j = 0 ; j < 8 ; j++){
			if(j == pos1)
				printbox(i-array[pos1].length/2, yy, b);
			else if (j != pos2) 
				printbox(coords[j].x-array[j].length/2, coords[j].y-array[j].length/2, array[j]);
		}
		napms(1000/speed);
		refresh();
	}
}
Exemplo n.º 16
0
void GTerm::erase_char()
{
    int n, mx;

    n = param[0];

    if (n<1)
        n = 1;

    mx = width - cursor_x;

    if (n>mx)
        n = mx;

    clear_area(cursor_x, cursor_y, cursor_x + n - 1, cursor_y);
	tm[cursor_y].replace(cursor_x, n - 1, n -1, ' ');
}
Exemplo n.º 17
0
void GUI::OnRender() {
    if(current_screen == MENU_SCREEN) {
        render_menu(menu);
    } else if(current_screen == MAP_SCREEN) {
        std::vector<std::vector<MapTile> > map_canvas = world_map_gui.get_canvas();
        for(size_t i = 0; i < map_canvas.size(); i++) {
            for(size_t j = 0; j < map_canvas[i].size(); j++) {
                drawChr(j, i, map_canvas[i][j].char_count, ascii, screen, map_canvas[i][j].color);
            }
        }
        drawStr(0, GAME_HEIGHT - 2, std::string("Use the arrow keys to move the cursor.").c_str(),
                ascii, screen, WHITE);
        drawStr(0, GAME_HEIGHT - 1, std::string("Press ENTER to spawn on the selected map tile.").c_str(),
                ascii, screen, WHITE);
    } else if (current_screen == GAME_SCREEN) {
        render_canvas();
        render_target();
        render_characters();
        render_main_char();
        render_animations();
        clear_area(IntPoint(0, UI_START), IntPoint(UI_HEIGHT, UI_WIDTH));
        render_interface();
        render_message();

    } else if(current_screen == DIRECTION_SCREEN)
    {
        drawStr(0, 0, std::string("Pick a direction to perform the action.").c_str(), ascii, screen, WHITE);
    } else if (current_screen == DEATH_SCREEN) {
        clear_screen();
        drawStr(GAME_WIDTH/2 - 12, GAME_HEIGHT/2, std::string("You suck, uninstall bro.").c_str(), ascii, screen, WHITE);
    } else if (current_screen == DEBUG_CONSOLE) {
        render_canvas();
        render_target();
        render_characters();
        render_main_char();
        render_debug();
    }
    if(game.is_paused()) {
        drawStr(GAME_WIDTH-20, 0, std::string("Paused").c_str(), ascii, screen, WHITE);
    }

    SDL_Flip(screen);
}
Exemplo n.º 18
0
void Pit::remove_dead()
{
	bool did_erase = false;

	for(auto it = m_contents.begin(); it != m_contents.end(); ) {
		if(Physical::State::DEAD == (*it)->physical_state()) {
			clear_area(**it);
			did_erase = true;

			it = m_contents.erase(it);
		}
		else {
			++it;
		}
	}

	if(did_erase)
		refresh_peak();
}
Exemplo n.º 19
0
void GTerm::insert_line()
{
    int n, mx;

    n = param[0];

    if (n<1)
        n = 1;

    mx = scroll_bot - cursor_y + 1;

    if (n>=mx)
    {
        clear_area(0, cursor_y, width - 1, scroll_bot);
    }
    else
    {
        scroll_region(cursor_y, scroll_bot, -n);
    }
}
Exemplo n.º 20
0
void GTerm::insert_char()
{
    int n, mx;

    n = param[0];

    if (n<1)
        n = 1;

    mx = width - cursor_x;

    if (n>=mx)
    {
        clear_area(cursor_x, cursor_y, width - 1, cursor_y);
    }
    else
    {
        shift_text(cursor_y, cursor_x, width - 1, n);
    }
}
Exemplo n.º 21
0
int showdetForDigit(char a[40],char txt[40],int size)
{
   int i,fd;
   char s[1];
   
 

	D_Ycoord=20;
   	D_Xcoord=-6;
	clear_area(5,12,121,48);
   myprintf("********entered show detail*******");
    s[1]='\0';
   for(i=0;i<chklen;i++)
   {
       s[0]=a[i];
       myprintf("s[0]=%c",s[0]);
       D_Xcoord=D_Xcoord+6;
	   kmy_LcdTextOut(5+D_Xcoord,5+D_Ycoord,s);
	   if(D_Xcoord>102)
    		{	 kmy_LcdTextOut(5+D_Xcoord+6,5+D_Ycoord," ");
			D_Xcoord=-6;
			D_Ycoord=D_Ycoord+12;
		}
		
	 if(i==chklen-1)
	 kmy_LcdTextOut(5+D_Xcoord+6,5+D_Ycoord," ");
	
	 
       
   }

 myprintf("\na[]=%s",a);
 
   
  ChkForDig(txt,size);
  
 
  
  return 0;
}
Exemplo n.º 22
0
void sceneShow::show_scene(int n)
{
    if (scene_list.size() <= n) {
        std::cout << "ERROR: Scene List[" << n << "] invalid. List size is " << image_scenes.size() << "." << std::endl;
        exit(-1);
    }
    CURRENT_FILE_FORMAT::file_scene_list scene = scene_list.at(0);
    for (int i=0; i<SCENE_OBJECTS_N; i++) {
        int scene_seek_n = scene.objects[i].seek_n;
        if (scene_seek_n != -1) {
            int scene_type = scene.objects[i].type;
            if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_TEXT) {
                show_text(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_AREA) {
                clear_area(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_CLEAR_SCREEN) {
                graphLib.clear_area(0 ,0, RES_W, RES_H, 0, 0, 0);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_IMAGE) {
                show_image(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_MOVE_VIEWPOINT) {
                /// @TODO
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_MUSIC) {
                play_music(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_PLAY_SFX) {
                play_sfx(scene_seek_n);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SHOW_ANIMATION) {
                show_animation(scene_seek_n, scene.objects[i].repeat_value, scene.objects[i].repeat_type);
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_STOP_MUSIC) {
                soundManager.stop_music();
            } else if (scene_type == CURRENT_FILE_FORMAT::SCENETYPE_SUBSCENE) {
                show_scene(scene_seek_n);
            }
            timer.delay(scene.objects[i].delay_after);
        }
    }
}
Exemplo n.º 23
0
void func_48(int iParam0, auto uParam1)
{
	Vector3 vVar0;
	Vector3 vVar3;
	
	vVar0 = {2711.198f, 4134.425f, 32.90168f};
	vVar3 = {2739.981f, 4155.221f, 50.28859f};
	if (iParam0)
	{
		*uParam1 = add_scenario_blocking_area(vVar0, vVar3, 0, 1, 1, 1);
		set_ped_non_creation_area(vVar0, vVar3);
		set_all_vehicle_generators_active_in_area(vVar0, vVar3, false, 1);
		remove_vehicles_from_generators_in_area(vVar0, vVar3, 0);
		set_roads_in_area(2697.222f, 4119.894f, 42.79107f, 2746.04f, 4162.974f, 43.62732f, false, 1);
		clear_area(2728.333f, 4144.778f, 43.29292f, 7.5f, 1, 0, 0, false);
	}
	else
	{
		remove_scenario_blocking_area(*uParam1, 0);
		clear_ped_non_creation_area();
		set_all_vehicle_generators_active_in_area(vVar0, vVar3, true, 1);
		set_roads_back_to_original(2697.222f, 4119.894f, 42.79107f, 2746.04f, 4162.974f, 43.62732f, 1);
	}
}
Exemplo n.º 24
0
void GTerm::reset()
{
    int i;

    pending_scroll = 0;
    bg_color = 0;
    fg_color = 7;
    scroll_top = 0;
    scroll_bot = height - 1;

    for (i = 0; i<MAXHEIGHT; i++)
        linenumbers[i] = i;

    memset(tab_stops, 0, sizeof(tab_stops));
    current_state = GTerm::normal_state;

    clear_mode_flag(NOEOLWRAP | CURSORAPPMODE | CURSORRELATIVE | NEWLINE | INSERT | UNDERLINE | BLINK | KEYAPPMODE
                              | CURSORINVISIBLE);

    clear_area(0, 0, width - 1, height - 1);
    move_cursor(0, 0);

	tm.Reset();
}
Exemplo n.º 25
0
void pendingorder()
{
  int flag=0,count=-1,count1=1,yfillarea=15;
  struct Msgstore obj,obj1,obj2,obj3;
  memset(&obj,'\0',sizeof(obj));
  callpending:
 // drawline1();
  obj.slno=1;
  count=-1;count1=1;yfillarea=15;
  while(count<256)
	{
				kmy_FlashReadBuffer((char *)&obj,0x070000+obj.slno*256,sizeof(obj));
				myprintf("\n reading smsno==%d sms==%s\n",obj.slno,obj.sms);
				if(obj.slno==0||obj.slno==-1)
				break;
				count=obj.slno;
				obj.slno++;
					
		
	}
	if(count==-1)
	{
	 	popup("   LIST IS EMPTY");
	}else
	{	   kmy_FlashReadBuffer((char *)&obj1,0x070000+1*256,sizeof(obj1));
		   kmy_FlashReadBuffer((char *)&obj2,0x070000+2*256,sizeof(obj2));
		   kmy_FlashReadBuffer((char *)&obj3,0x070000+3*256,sizeof(obj3));
		   clear_area(xstart,ystart,xend,yend);
		   if(obj1.slno>0)
		   kmy_LcdTextOut(5,15,obj1.mobileno);
		   if(obj2.slno>0)
		   kmy_LcdTextOut(5,30,obj2.mobileno);
		   if(obj3.slno>0)
		   kmy_LcdTextOut(5,45,obj3.mobileno);
		   Keydata=0;
		   reverse_area(xstart,yfillarea,xend,15,2);
		   //while(Keydata!=KEY_L1 && Keydata!=KEY_R1)
		    while(Keydata!=KEY_LEFT && Keydata!=KEY_RIGHT)
			{	
				//	ReadDataFSPort();
	       	//		Process_Modem_data();
			 		Keydata=0;
					Keydata=kmy_GetKeyValue();
				//	if(Keydata==KEY_L1)
					if(Keydata==KEY_LEFT)
					{
						flag=1;
						break;
					}else
					// if(Keydata==KEY_R1)
					 if(Keydata==KEY_RIGHT)
					{
						flag=0;
						break;
					}
					if(Keydata==KEY_DOWN && count1<count)
					{	
						count1++;
						clear_area(xstart,yfillarea,xend,15);
						yfillarea+=15;
						if(yfillarea>45)
						{
						 	kmy_FlashReadBuffer((char *)&obj1,0x070000+count1*256,sizeof(obj1));
		   					kmy_FlashReadBuffer((char *)&obj2,0x070000+(count1+1)*256,sizeof(obj2));
		   					kmy_FlashReadBuffer((char *)&obj3,0x070000+(count1+2)*256,sizeof(obj3));	
							yfillarea=15;
							clear_area(xstart,ystart,xend,yend);
						}
						   
						   if(obj1.slno>0)
						   kmy_LcdTextOut(5,15,obj1.mobileno);
						   if(obj2.slno>0)
						   kmy_LcdTextOut(5,30,obj2.mobileno);
						   if(obj3.slno>0)
						   kmy_LcdTextOut(5,45,obj3.mobileno);
						   reverse_area(xstart,yfillarea,xend,15,2);
						   printf("\n DOWN count1==%d\n",count1);
					  
					}else if(Keydata==KEY_UP &&  count1>1)
					{
						count1--;
						clear_area(xstart,yfillarea,xend,15);
						yfillarea-=15;
						if(yfillarea<15)
						{
						 	yfillarea=45;
							kmy_FlashReadBuffer((char *)&obj3,0x070000+count1*256,sizeof(obj3));
		   					kmy_FlashReadBuffer((char *)&obj2,0x070000+(count1-1)*256,sizeof(obj2));
		   					kmy_FlashReadBuffer((char *)&obj1,0x070000+(count1-2)*256,sizeof(obj1));
							clear_area(xstart,ystart,xend,yend);
						}
						   if(obj1.slno>0)
						   kmy_LcdTextOut(5,15,obj1.mobileno);
						   if(obj2.slno>0)
						   kmy_LcdTextOut(5,30,obj2.mobileno);
						   if(obj3.slno>0)
						   kmy_LcdTextOut(5,45,obj3.mobileno);
						   reverse_area(xstart,yfillarea,xend,15,2);
						   printf("\n Up count1==%d\n",count1);
					}

			}// while loop
			if(flag==0)//confirm
			{
				myprintf("\n Count1==%d\n",count1);
				kmy_FlashReadBuffer((char *)&obj2,0x070000+count1*256,sizeof(obj2));
			//	readinbx(obj2);
			//	flag=selectmenu("ACCEPT ORDER","REJECT ORDER","EXIT",3);
				if(flag==1)
				{
				  kmy_FlashEraseSector(0x080000); 
				  count=-1;
				  obj.slno=1;
				  flag=0;
				//  acceptorder1(obj2);
				  while(count<256)
					{
								kmy_FlashReadBuffer((char *)&obj,0x070000+obj.slno*256,sizeof(obj));
								myprintf("\n reading smsno==%d sms==%s\n",obj.slno,obj.sms);
								if(obj.slno==0||obj.slno==-1)
								break;
								if(count1==obj.slno)
								{
									flag++;
								}else
								{	obj1=obj;
									if(flag==0)
									{
										kmy_FlashWriteBuffer((char *)&obj1,0x080000+obj1.slno*256,sizeof(obj1));
									}else
									{	obj1.slno=obj1.slno-flag;
										myprintf("\n Sector 8 Writting slno==%d\n",obj1.slno);
										kmy_FlashWriteBuffer((char *)&obj1,0x080000+obj1.slno*256,sizeof(obj1));	
									}
								}
								count=obj.slno;
								obj.slno++;
									
						
					}
					if(count>0)
					{	  
						  kmy_FlashEraseSector(0x070000);
						  count=-1;
						  obj.slno=1;
						  while(count<256)
							{
										kmy_FlashReadBuffer((char *)&obj,0x080000+obj.slno*256,sizeof(obj));
										myprintf("\n reading smsno==%d sms==%s\n",obj.slno,obj.sms);
										if(obj.slno==0||obj.slno==-1)
										break;
										kmy_FlashWriteBuffer((char *)&obj,0x070000+obj.slno*256,sizeof(obj));
										count=obj.slno;
										obj.slno++;
							}

					}
				   	
				}else if(flag==2)
				{
					
				  kmy_FlashEraseSector(0x080000); 
				  count=-1;
				  obj.slno=1;
				  flag=0;
				  popup2("   PLEASE WAIT","");
				 // rejectorder(obj2);
				  popup2("   PLEASE WAIT","");
				  while(count<256)
					{
								kmy_FlashReadBuffer((char *)&obj,0x070000+obj.slno*256,sizeof(obj));
								myprintf("\n reading smsno==%d sms==%s\n",obj.slno,obj.sms);
								if(obj.slno==0||obj.slno==-1)
								break;
								if(count1==obj.slno)
								{
									flag++;
								}else
								{	obj1=obj;
									if(flag==0)
									{
										kmy_FlashWriteBuffer((char *)&obj1,0x080000+obj1.slno*256,sizeof(obj1));
									}else
									{	obj1.slno=obj1.slno-flag;
										myprintf("\n Sector 8 Writting slno==%d\n",obj1.slno);
										kmy_FlashWriteBuffer((char *)&obj1,0x080000+obj1.slno*256,sizeof(obj1));	
									}
								}
								count=obj.slno;
								obj.slno++;
									
						
					}
					if(count>0)
					{	  
						  kmy_FlashEraseSector(0x070000);
						  count=-1;
						  obj.slno=1;
						  while(count<256)
							{
										kmy_FlashReadBuffer((char *)&obj,0x080000+obj.slno*256,sizeof(obj));
										myprintf("\n reading smsno==%d sms==%s\n",obj.slno,obj.sms);
										if(obj.slno==0||obj.slno==-1)
										break;
										kmy_FlashWriteBuffer((char *)&obj,0x070000+obj.slno*256,sizeof(obj));
										count=obj.slno;
										obj.slno++;
							}

					}
				}else
				{
				 	
				}
				goto callpending;
			}else if(flag==3)//return exit
			{
				return;
			}	
	}



}
Exemplo n.º 26
0
i4_bool r1_dx9_class::init(i4_display_class * display)
{
	HRESULT hResult = DD_OK;

	// JJ FOR TEST
	if (display!=i4_dx9_display)
	{
		// || !i4_dx9_display->using_accelerated_driver())
		return i4_F;
	}
	d3d_device=dx9_common.device;
	set_color_tint(0);
	init_d3d_vert_buffer();
	D3DDeviceInfo * info;
	info=dx9_common.get_driver_hardware_info(dx9_common.pD3D9,i4_dx9_display->cur_mode.adaptor_id);
	if (!info)
	{
		return i4_F;
	}



	if (info->Caps.TextureCaps & D3DPTEXTURECAPS_SQUAREONLY)
	{
		needs_square_textures = i4_T;
	}
	else
	{
		needs_square_textures = i4_F;
	}


	//turn zbuffering on
	i4_dx9_check(d3d_device->SetRenderState(D3DRS_ZENABLE,TRUE));

	//turn gouraud shading on the entire time
	i4_dx9_check(d3d_device->SetRenderState(D3DRS_SHADEMODE,D3DSHADE_GOURAUD));

	//dithering.. eh..
	i4_dx9_check(d3d_device->SetRenderState(D3DRS_DITHERENABLE,TRUE));

	//no monochomatic shading?
	//d3d_device->SetRenderState(D3DRS_MONOENABLE,FALSE);

	//texturemapping mode setup
	//d3d_device->SetRenderState(D3DRS_TEXTUREMAPBLEND,D3DTBLEND_MODULATE);
	//d3d_device->SetRenderState(D3DRS_TEXTUREHANDLE,0);

	i4_dx9_check(d3d_device->SetSamplerState(0, D3DSAMP_ADDRESSU,D3DTADDRESS_CLAMP));
	i4_dx9_check(d3d_device->SetSamplerState(0, D3DSAMP_ADDRESSV,D3DTADDRESS_CLAMP));
	i4_dx9_check(d3d_device->SetSamplerState(0, D3DSAMP_ADDRESSW,D3DTADDRESS_CLAMP));

	//d3d_device->SetRenderState(D3DRS_TEXTUREPERSPECTIVE,1);

	//no automatic face culling
	i4_dx9_check(d3d_device->SetRenderState(D3DRS_CULLMODE,D3DCULL_NONE));

	i4_dx9_check(d3d_device->SetFVF(FVF_CUSTOMVERTEX));
	//setup other basic modes
	set_write_mode(R1_WRITE_W | R1_COMPARE_W | R1_WRITE_COLOR);

	//Duh, I would need this, but it's not supported on my hw...
	//What else can we do?
	//Hm... the hw supports it, but the driver says it doesn't, so
	//we have a lot of false errors.
	i4_dx9_check(d3d_device->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE));
	//d3d_device->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_DISABLE);
	//i4_dx9_check(d3d_device->SetTextureStageState(0,D3DTSS_TEXCOORDINDEX,0);
	i4_dx9_check(d3d_device->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ));
	i4_dx9_check(d3d_device->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ));
	i4_dx9_check(d3d_device->SetTextureStageState( 0, D3DTSS_ALPHAOP,   D3DTOP_DISABLE ));
	i4_dx9_check(d3d_device->SetTextureStageState( 0, D3DTSS_TEXCOORDINDEX,
												  D3DTSS_TCI_CAMERASPACEPOSITION ));
	i4_dx9_check(d3d_device->SetRenderState(D3DRS_LIGHTING,FALSE));
	i4_dx9_check(d3d_device->SetRenderState(D3DRS_SPECULARENABLE,FALSE));
	//d3d_device->SetRenderState(D3DRS_WRAP0,
	//	  D3DWRAPCOORD_0 | D3DWRAPCOORD_1);


	set_shading_mode(R1_COLORED_SHADING);

	set_alpha_mode(R1_ALPHA_DISABLED);

	set_filter_mode(R1_BILINEAR_FILTERING);

	set_z_range(0.01f,1.0f);

	m_dwFogColor           = 0x00b5b5ff;
	m_dwFogMode            = D3DFOG_LINEAR;
	m_fFogStartValue       = 0.2f;
	m_fFogEndValue         = 1.0f;
	m_fFogDensity          = 0.5f;
	m_bRangeBasedFog       = FALSE;


	//clear the viewport, initialize type thing
	//clear_area(0,0,639,479,0x00000000,1.0);
	int w=i4_dx9_display->cur_mode.xres;
	int h=i4_dx9_display->cur_mode.yres;
	clear_area(0,0,w-1,h-1,0x0,RENDER_DEFAULT_FAR_DISTANCE);

	//if we're page flipping, flip so we can clear the other page initially as well
	i4_dx9_display->flush();

	//clear_area(0,0,639,479,0x00000000,1.0);
	clear_area(0,0,w-1,h-1,0x0,RENDER_DEFAULT_FAR_DISTANCE);

	tmanager = new r1_dx9_texture_class(display->get_palette());
	tmanagers.reallocate(10,10);
	r1_name_cache_file("dx9");
	default_state();
	return i4_T;
}
Exemplo n.º 27
0
void chart_draw_pie (struct pie_chart * pc, int app_handle, int x, int y, int w, int h) {
	int cx, cy, radius; /* centre and size of circle */
	int kx, ky; /* coordinates to start printing key */
	int i, total_values, bang;
	int char_h, char_w, cell_w, cell_h;

	clear_area (app_handle, x, y, w, h);
	if ((w < 50) || (h < 50)) return; /* too small to draw anything */

	vst_point (app_handle, TITLE_FONT, &char_w, &char_h, &cell_w, &cell_h);

	/* calculate circle bounds */
	if (w < h) {
		int wo_key_height = h-(pc->num_slices + 2 + 3.5)*cell_h;

		/* dimensions if width less than height, allow for key below */
		radius = w/2 - cell_w;
		if (2*radius > wo_key_height) {
			radius = wo_key_height/2;
		}
		cx = x + w/2;
		cy = y + radius + cell_h + 1.5*cell_h;
		kx = x + 2*cell_w;
		ky = cy + radius + 1.5*cell_h;
	} else {
		int max_width=0;
		int wo_key_width;

		for (i=0; i<pc->num_slices; i+=1) {
			if (max_width < strlen(pc->labels[i])) {
				max_width = strlen(pc->labels[i]);
			}
		}
		/* dimensions if height less than width, allow for key to right */
		radius = h/2 - cell_h;
		wo_key_width = w-(2+max_width)*cell_w;
		if (2*radius + 2*cell_w > wo_key_width) {
			radius = wo_key_width/2 - cell_w;
		}
		cx = x + radius + cell_w;
		cy = y + radius + 1.5*cell_h; /* space for title */
		kx = cx + radius + 2*cell_w;
		ky = y+2.5*cell_h;
	}

	for (i=0, total_values=0; i<pc->num_slices; i += 1) {
		total_values += pc->values[i];
	}

	/* draw the title and key */
	vsf_color (app_handle, BLACK);
	v_gtext (app_handle, x+2*cell_w, y+cell_h+2, pc->title);

	vst_point (app_handle, AXES_TITLE_FONT, &char_w, &char_h, &cell_w, &cell_h);
	v_gtext (app_handle, kx, ky, "  KEY");
	ky += 1.5*cell_h;

	/* draw the slices */
	bang = 0;
	for (i=0; i < pc->num_slices; i += 1) {
		int eang = bang + 1 + (int)(3600*((float)pc->values[i]/total_values));
		int pxy[4];

		vsf_color (app_handle, pc->colours[i]);
		vsf_interior (app_handle, pc->interior[i]);
		vsf_style (app_handle, pc->style[i]);

		v_pieslice (app_handle, cx, cy, radius, bang, eang);

		bang = eang;

		/* draw the key */
		pxy[0] = kx;
		pxy[1] = ky;
		pxy[2] = kx + 1.5*cell_w-1;
		pxy[3] = ky - cell_h+4; /* leave a small gap between rows */
		v_bar (app_handle, pxy);

		vsf_color (app_handle, BLACK);
		v_gtext (app_handle, kx+2*cell_w, ky, pc->labels[i]);
		ky += cell_h;
	}
}
Exemplo n.º 28
0
void chart_draw_line (struct line_chart * lc, int app_handle,
	int x, int y, int w, int h) {

	int lx, ly, lw, lh; /* dimensions of area in which to draw the line chart */
	int max_y_value, min_y_value, max_value_width;
	int min_x_value, max_x_value;
	int i;
	int dum, key_char_w, key_char_h;
	int kx, ky; /* position of key */

	clear_area (app_handle, x, y, w, h);
	if ((w < 50) || (h < 50)) return; /* too small to draw anything */
	if (lc->lines[0] == NULL) return; /* no line, so don't draw anything */

	max_y_value = find_max (lc->lines[0]->ys, lc->lines[0]->num_points);
	min_y_value = find_min (lc->lines[0]->ys, lc->lines[0]->num_points);
	for (i = 1; i < lc->num_lines; i += 1) {
		int t = find_max (lc->lines[i]->ys, lc->lines[i]->num_points);
		if (t > max_y_value) max_y_value = t;
		t = find_min (lc->lines[i]->ys, lc->lines[i]->num_points);
		if (t < min_y_value) min_y_value = t;
	}
	max_x_value = find_max (lc->lines[0]->xs, lc->lines[0]->num_points);
	min_x_value = find_min (lc->lines[0]->xs, lc->lines[0]->num_points);
	for (i = 1; i < lc->num_lines; i += 1) {
		int t = find_max (lc->lines[i]->xs, lc->lines[i]->num_points);
		if (t > max_x_value) max_x_value = t;
		t = find_min (lc->lines[i]->xs, lc->lines[i]->num_points);
		if (t < min_x_value) min_x_value = t;
	}

	/* Find dimensions for display of chart */
	find_chart_dimensions (app_handle, min_y_value, max_y_value, x, y, w, h,
				&max_value_width, &lx, &ly, &lw, &lh);

	vst_point (app_handle, AXES_TITLE_FONT, &dum, &dum, &key_char_w, &key_char_h);

	/* adjust dimensions to fit in a key */
	if (w > h) {
		/* wide area, so key on right */
		int max_width, i;

		max_width = strlen(lc->lines[0]->label);
		for (i=1; i<lc->num_lines; i+=1) {
			if (strlen(lc->lines[i]->label) > max_width) {
				max_width = strlen(lc->lines[i]->label);
			}
		}

		kx = x + w - key_char_w*(4 + max_width);
		ky = y + 2*key_char_h;
		lw = kx - lx - key_char_w;
	} else {
		/* tall area, so key below */
		int diff_y = key_char_h*(2+2+lc->num_lines);
		kx = x+5*key_char_w;
		ly -= diff_y;
		lh -= diff_y;
		ky = ly + 4*key_char_h; /* remember gap for labels */
	}

	draw_axes_lines (app_handle, lx, ly, lw, lh);
	draw_main_labels (app_handle, lc->title, lc->x_label, lc->y_label,
		lx, ly, lw, lh, max_value_width);
	draw_x_axis_labels (app_handle, min_x_value, max_x_value, lx, ly, lw);
	draw_y_axis_labels (app_handle, min_y_value, max_y_value, lx, ly, lh);

	/* draw points and lines */
	for (i = 0; i < lc->num_lines; i += 1) {
		int p;
		int * pts;
		pts = malloc(sizeof(int)*lc->lines[i]->num_points*2);

		for (p = 0; p < lc->lines[i]->num_points; p += 1) {
			pts[2*p] = lx + rescale (lc->lines[i]->xs[p], min_x_value, max_x_value, lw);
			pts[2*p+1] = ly - rescale (lc->lines[i]->ys[p], min_y_value, max_y_value, lh);
		}

		/* set colour/styles */
		vsl_width (app_handle, 1);
		vsl_color (app_handle, lc->lines[i]->colour);
		vsm_color (app_handle, lc->lines[i]->colour);
	#ifdef PMARKS /* use own pmarker code */
		vsf_color (app_handle, lc->lines[i]->colour);
		my_pmarker (app_handle, lc->lines[i]->point_style, lc->lines[i]->num_points, pts);
	#else /* use builtin pmarker code */
		vsm_type (app_handle, lc->lines[i]->point_style);
		/* call v_pmarker to draw points */
		v_pmarker (app_handle, lc->lines[i]->num_points, pts);
	#endif
		vsl_type (app_handle, lc->lines[i]->line_style);
		/* call v_pline to draw lines */
		v_pline (app_handle, lc->lines[i]->num_points, pts);

		free (pts);
	}

	/* draw key */
	vsf_color (app_handle, BLACK);
	vst_point (app_handle, AXES_TITLE_FONT, &dum, &dum, &dum, &dum);
	v_gtext (app_handle, kx, ky, "  KEY");
	ky += 2*key_char_h;

	for (i = 0; i < lc->num_lines; i += 1) {
		int pxy[4];

		pxy[0]=kx;
		pxy[1]=ky;
		pxy[2]=kx+2.5*key_char_w;
		pxy[3]=pxy[1];

		vsl_color (app_handle, lc->lines[i]->colour);
		vsl_width (app_handle, 1);
		vsm_color (app_handle, lc->lines[i]->colour);
	#ifdef PMARKS /* use own pmarker code */
		vsf_color (app_handle, lc->lines[i]->colour);
		my_pmarker (app_handle, lc->lines[i]->point_style, 2, pxy);
	#else /* use builtin pmarker code */
		vsm_type (app_handle, lc->lines[i]->point_style);
		v_pmarker (app_handle, 2, pxy);
	#endif
		vsl_type (app_handle, lc->lines[i]->line_style);
		v_pline (app_handle, 2, pxy);

		v_gtext (app_handle, kx+3.5*key_char_w, ky, lc->lines[i]->label);
		ky += key_char_h;
	}
}
Exemplo n.º 29
0
void chart_draw_bar (struct bar_chart * bc, int app_handle, int x, int y, int w, int h) {
	int pxy[4];
	int i, curr_x, curr_y;
	int scale_x_num, scale_x_den, scale_y_num, scale_y_den;
	int max_value, max_value_width, bar_chars, offset;
	char str[20]; /* numbers won't be larger than 20 */
	int bx, by, bw, bh; /* dimensions for bar chart */
	int char_w, char_h, cell_w, cell_h;

	clear_area (app_handle, x, y, w, h);
	if ((w < 50) || (h < 50)) return; /* too small to draw anything */

	max_value = find_max (bc->values, bc->num_bars);

	/* Find dimensions for display of bar chart */
	find_chart_dimensions (app_handle, 0, max_value, x, y, w, h, &max_value_width, &bx, &by, &bw, &bh);

	scale_x_num = bw/bc->num_bars;
	scale_x_den = bw%bc->num_bars;
	scale_y_num = bh/max_value;
	scale_y_den = bh%max_value;

	draw_axes_lines (app_handle, bx, by, bw, bh);
	draw_main_labels (app_handle, bc->title, bc->x_label, bc->y_label,
		bx, by, bw, bh, max_value_width);

	vsf_color (app_handle, BLACK);
	vst_point (app_handle, AXES_LABEL_FONT, &char_w, &char_h, &cell_w, &cell_h);
	vsl_width (app_handle, 1);
	bar_chars = scale_x_num / cell_w; /* the number of chars that will fit in a bar */

	for (i = 0; i < bc->num_bars; i += 1) {
		pxy[0] = bx + i*scale_x_num+(i*scale_x_den)/bc->num_bars + scale_x_num/2;
		pxy[1] = by;
		pxy[2] = pxy[0];
		pxy[3] = by+5;

		v_pline (app_handle, 2, pxy);

		if (strlen (bc->labels[i]) < bar_chars) {
			/* label fits, so center and display */
			int offset = cell_w * (bar_chars - strlen (bc->labels[i]))/2;
			v_gtext (app_handle, pxy[0]-scale_x_num/2+cell_w/2+offset, pxy[3]+1.5*cell_h, bc->labels[i]);
		} else {
			/* label will not fit, so take only first part */
			int j;

			for (j=0; j<bar_chars; j+=1) {
				str[j] = bc->labels[i][j];
			}
			str[bar_chars]=0;
			v_gtext (app_handle, pxy[0]-scale_x_num/2+cell_w/2, pxy[3]+1.5*cell_h, str);
		}
	}
	draw_y_axis_labels (app_handle, 0, max_value, bx, by, bh);

	/* draw the bars */
	for (i = 0; i < bc->num_bars; i += 1) {
		vsf_color (app_handle, bc->colours[i]);
		vsf_interior (app_handle, bc->interior[i]);
		vsf_style (app_handle, bc->style[i]);

		pxy[0] = bx + i*scale_x_num + (i*scale_x_den)/bc->num_bars + 1;
		pxy[1] = by-1;
		pxy[2] = bx + (i+1)*scale_x_num+((i+1)*scale_x_den)/bc->num_bars;
		pxy[3] = by - bc->values[i]*scale_y_num-(bc->values[i]*scale_y_den)/max_value;

		v_bar (app_handle, pxy);
	}

}
Exemplo n.º 30
0
void FrameBuffer< pages, columns >::clear(){
	clear_area();
}