本文整理汇总了C++中set_xy函数的典型用法代码示例。如果您正苦于以下问题:C++ set_xy函数的具体用法?C++ set_xy怎么用?C++ set_xy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_xy函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: get_xy
/**
* \brief Updates the position.
*/
void RelativeMovement::update() {
if (entity_followed == nullptr) {
finished = true;
return;
}
if (entity_followed->is_being_removed()) {
finished = true;
entity_followed = nullptr;
}
else {
Point next = entity_followed->get_xy() + entity_offset;
Point dnext = next - get_xy();
if (!are_obstacles_ignored()) {
if (!finished && (dnext.x != 0 || dnext.y != 0)) {
if (!test_collision_with_obstacles(dnext)) {
set_xy(next);
}
else {
finished = true;
notify_obstacle_reached();
}
}
}
else {
set_xy(next);
}
}
}
开发者ID:Codex-NG,项目名称:solarus,代码行数:37,代码来源:RelativeMovement.cpp
示例2: RefreshOneLine
/*刷新一行屏幕*/
void RefreshOneLine(u8 x_start , u8 x_end , u8 y)
{
u8 *pLCD;
set_xy(x_start,y*2);
for(pLCD = &LCDbuf[y*2][x_start] ; pLCD<&LCDbuf[y*2][64];)
{
WriteData(*pLCD++);
}
set_xy(x_start,y*2+1);
for(pLCD = &LCDbuf[y*2+1][x_start] ; pLCD<&LCDbuf[y*2+1][64];)
{
WriteData(*pLCD++);
}
set_xy(64,y*2);
for(pLCD = &LCDbuf[y*2][64] ; pLCD<&LCDbuf[y*2][x_end];)
{
WriteData(*pLCD++);
}
set_xy(64,y*2+1);
for(pLCD = &LCDbuf[y*2+1][64] ; pLCD<&LCDbuf[y*2+1][x_end];)
{
WriteData(*pLCD++);
}
memset(LCDbuf[y*2] , 0 ,128);
memset(LCDbuf[y*2+1] , 0 ,128);
}
开发者ID:eseawind,项目名称:touchCabinet,代码行数:28,代码来源:Display.c
示例3: set_xy
/***********************************************************
* 函数名称:
* 功能描述: OLED显示单个字符
* 参数列表:
* 返回结果:
* 备 注:在指定位置显示一个字符,包括部分字符
***********************************************************/
void OLED_SSD1306::show_char(uint8_t x, uint8_t y, uint8_t chr)
{
unsigned char c = 0, i = 0;
c = chr - ' '; //得到偏移后的值
if(x > Max_Column - 1)
{
x = 0;
y = y + 2;
}
if(SIZE == 16)
{
set_xy(x, y);
for(i = 0; i < 8; i++)
write_data(font8x16[c * 16 + i]);
set_xy(x, y + 1);
for(i = 0; i < 8; i++)
write_data(font8x16[c * 16 + i + 8]);
}
else
{
set_xy(x, y + 1);
for(i = 0; i < 6; i++)
write_data(font6x8[c][i]);
}
}
开发者ID:0x1abin,项目名称:ebox_stm32,代码行数:32,代码来源:OLED_ssd1306.cpp
示例4: add_body_force_xy
void add_body_force_xy(xy_t p0, xy_t p1, double mass, xy_t *acc) // adds the force from p1's mass to p0's acceleration
{
double dbb2, dbb;
double fmag;
dbb2 = hypot_xy2(p0, p1);
dbb = sqrt(dbb2);
fmag = mass / dbb2;
*acc = add_xy( *acc, div_xy( mul_xy(set_xy(fmag), sub_xy(p1, p0)) , set_xy(dbb)) );
}
开发者ID:Photosounder,项目名称:rouziclib,代码行数:10,代码来源:physics.c
示例5: MapEntity
/**
* \brief Creates a boomerang.
* \param hero the hero
* \param max_distance maximum distance of the movement in pixels
* \param speed speed of the movement in pixels per second
* \param angle the angle of the boomerang trajectory in radians
* \param sprite_name animation set id representing the boomerang
*/
Boomerang::Boomerang(
Hero& hero,
int max_distance,
int speed,
double angle,
const std::string& sprite_name):
MapEntity("", 0, hero.get_layer(), 0, 0, 0, 0),
hero(hero),
has_to_go_back(false),
going_back(false),
speed(speed) {
// initialize the entity
create_sprite(sprite_name);
set_size(16, 16);
set_origin(8, 8);
int hero_x = hero.get_top_left_x();
int hero_y = hero.get_top_left_y();
switch (hero.get_animation_direction()) {
case 0:
set_xy(hero_x + 24, hero_y + 8);
break;
case 1:
set_xy(hero_x + 8, hero_y - 8);
break;
case 2:
set_xy(hero_x - 8, hero_y + 8);
break;
case 3:
set_xy(hero_x + 8, hero_y + 24);
break;
}
initial_coords.set_xy(get_xy());
StraightMovement* movement = new StraightMovement(false, false);
movement->set_speed(speed);
movement->set_angle(angle);
movement->set_max_distance(max_distance);
set_movement(movement);
next_sound_date = System::now();
}
开发者ID:bgalok,项目名称:solarus,代码行数:57,代码来源:Boomerang.cpp
示例6: Entity
/**
* \brief Creates a boomerang.
* \param hero the hero
* \param max_distance maximum distance of the movement in pixels
* \param speed speed of the movement in pixels per second
* \param angle the angle of the boomerang trajectory in radians
* \param sprite_name animation set id representing the boomerang
*/
Boomerang::Boomerang(
const HeroPtr& hero,
int max_distance,
int speed,
double angle,
const std::string& sprite_name
):
Entity("", 0, hero->get_layer(), Point(0, 0), Size(0, 0)),
hero(hero),
has_to_go_back(false),
going_back(false),
speed(speed) {
// initialize the entity
create_sprite(sprite_name);
set_size(16, 16);
set_origin(8, 8);
int hero_x = hero->get_top_left_x();
int hero_y = hero->get_top_left_y();
switch (hero->get_animation_direction()) {
case 0:
set_xy(hero_x + 24, hero_y + 8);
break;
case 1:
set_xy(hero_x + 8, hero_y - 8);
break;
case 2:
set_xy(hero_x - 8, hero_y + 8);
break;
case 3:
set_xy(hero_x + 8, hero_y + 24);
break;
}
std::shared_ptr<StraightMovement> movement =
std::make_shared<StraightMovement>(false, false);
movement->set_speed(speed);
movement->set_angle(angle);
movement->set_max_distance(max_distance);
set_movement(movement);
next_sound_date = System::now();
}
开发者ID:Codex-NG,项目名称:solarus,代码行数:57,代码来源:Boomerang.cpp
示例7: Entity
/**
* \brief Creates an arrow.
* \param hero The hero.
*/
Arrow::Arrow(const Hero& hero):
Entity("", 0, hero.get_layer(), Point(0, 0), Size(0, 0)),
hero(hero) {
// initialize the entity
int direction = hero.get_animation_direction();
create_sprite("entities/arrow", true);
get_sprite().set_current_direction(direction);
set_drawn_in_y_order(true);
if (direction % 2 == 0) {
// Horizontal.
set_size(16, 8);
set_origin(8, 4);
}
else {
// Vertical.
set_size(8, 16);
set_origin(4, 8);
}
set_xy(hero.get_center_point());
notify_position_changed();
std::string path = " ";
path[0] = '0' + (direction * 2);
set_movement(std::make_shared<PathMovement>(
path, 192, true, false, false
));
disappear_date = System::now() + 10000;
stop_now = false;
entity_reached = nullptr;
}
开发者ID:Codex-NG,项目名称:solarus,代码行数:38,代码来源:Arrow.cpp
示例8: MapEntity
/**
* \brief Creates an arrow.
* \param hero The hero.
*/
Arrow::Arrow(const Hero& hero):
MapEntity("", 0, hero.get_layer(), 0, 0, 0, 0),
hero(hero) {
// initialize the entity
int direction = hero.get_animation_direction();
create_sprite("entities/arrow", true);
get_sprite().set_current_direction(direction);
set_drawn_in_y_order(true);
if (direction % 2 == 0) {
// Horizontal.
set_size(16, 8);
set_origin(8, 4);
}
else {
// Vertical.
set_size(8, 16);
set_origin(4, 8);
}
set_xy(hero.get_center_point());
set_optimization_distance(0); // Make the arrow continue outside the screen until disappear_date.
std::string path = " ";
path[0] = '0' + (direction * 2);
Movement* movement = new PathMovement(path, 192, true, false, false);
set_movement(movement);
disappear_date = System::now() + 10000;
stop_now = false;
entity_reached = NULL;
}
开发者ID:Arseth,项目名称:solarus,代码行数:37,代码来源:Arrow.cpp
示例9: Entity
/**
* \brief Creates a carried item (i.e. an item carried by the hero).
* \param hero the hero who is lifting the item to be created
* \param original_entity the entity that will be replaced by this carried item
* (its coordinates, size and origin will be copied)
* \param animation_set_id name of the animation set for the sprite to create
* \param destruction_sound_id Name of the sound to play when this item is destroyed
* (or an empty string).
* \param damage_on_enemies damage received by an enemy if the item is thrown on him
* (possibly 0)
* \param explosion_date date of the explosion if the item should explode,
* or 0 if the item does not explode
*/
CarriedItem::CarriedItem(
Hero& hero,
const Entity& original_entity,
const std::string& animation_set_id,
const std::string& destruction_sound_id,
int damage_on_enemies,
uint32_t explosion_date
):
Entity("", 0, hero.get_layer(), Point(0, 0), Size(0, 0)),
hero(hero),
is_lifting(true),
is_throwing(false),
is_breaking(false),
break_one_layer_above(false),
destruction_sound_id(destruction_sound_id),
damage_on_enemies(damage_on_enemies),
shadow_sprite(nullptr),
throwing_direction(0),
next_down_date(0),
item_height(0),
y_increment(0),
explosion_date(explosion_date) {
// align correctly the item with the hero
int direction = hero.get_animation_direction();
if (direction % 2 == 0) {
set_xy(original_entity.get_x(), hero.get_y());
}
else {
set_xy(hero.get_x(), original_entity.get_y());
}
set_origin(original_entity.get_origin());
set_size(original_entity.get_size());
set_drawn_in_y_order(true);
// create the lift movement and the sprite
std::shared_ptr<PixelMovement> movement = std::make_shared<PixelMovement>(
lifting_trajectories[direction], 100, false, true
);
create_sprite(animation_set_id);
get_sprite().set_current_animation("stopped");
set_movement(movement);
// create the shadow (not visible yet)
shadow_sprite = std::make_shared<Sprite>("entities/shadow");
shadow_sprite->set_current_animation("big");
}
开发者ID:Codex-NG,项目名称:solarus,代码行数:60,代码来源:CarriedItem.cpp
示例10: main
void main()
{
unsigned image_in = input("image_in");
unsigned image_out = output("image_out");
unsigned image[SIZE];
unsigned new_image[SIZE];
int x, y, pixel;
while(1){
/* read in image */
for(y=0; y<HEIGHT; y++){
for(x=0; x<WIDTH; x++){
set_xy(image, x, y, fgetc(image_in));
}
report(y);
}
/* apply edge detect */
for(y=0; y<HEIGHT; y++){
for(x=0; x<WIDTH; x++){
pixel = get_xy(image, x, y ) << 2;
pixel -= get_xy(image, x-1, y+1);
pixel -= get_xy(image, x+1, y-1);
pixel -= get_xy(image, x-1, y-1);
pixel -= get_xy(image, x+1, y+1);
set_xy(new_image, x, y, pixel);
}
report(y);
}
/* write out image */
for(y=0; y<HEIGHT; y++){
for(x=0; x<WIDTH; x++){
fputc(get_xy(new_image, x, y), image_out);
}
report(y);
}
}
}
开发者ID:dawsonjon,项目名称:Chips-2.0,代码行数:45,代码来源:edge_detect.c
示例11: MapEntity
/**
* @brief Creates a carried item (i.e. an item carried by the hero).
* @param hero the hero who is lifting the item to be created
* @param original_entity the entity that will be replaced by this carried item
* (its coordinates, size and origin will be copied)
* @param animation_set_id name of the animation set for the sprite to create
* @param destruction_sound_id name of the sound to play when this item is destroyed
* (or an empty string)
* @param damage_on_enemies damage received by an enemy if the item is thrown on him
* (possibly 0)
* @param explosion_date date of the explosion if the item should explode,
* or 0 if the item does not explode
*/
CarriedItem::CarriedItem(Hero& hero, MapEntity& original_entity,
const std::string& animation_set_id,
const std::string& destruction_sound_id,
int damage_on_enemies, uint32_t explosion_date):
MapEntity(),
hero(hero),
is_lifting(true),
is_throwing(false),
is_breaking(false),
break_on_intermediate_layer(false) {
// put the item on the hero's layer
set_layer(hero.get_layer());
// align correctly the item with the hero
int direction = hero.get_animation_direction();
if (direction % 2 == 0) {
set_xy(original_entity.get_x(), hero.get_y());
}
else {
set_xy(hero.get_x(), original_entity.get_y());
}
set_origin(original_entity.get_origin());
set_size(original_entity.get_size());
// create the lift movement and the sprite
PixelMovement *movement = new PixelMovement(lifting_trajectories[direction], 100, false, true);
create_sprite(animation_set_id);
get_sprite().set_current_animation("stopped");
set_movement(movement);
// create the breaking sound
this->destruction_sound_id = destruction_sound_id;
// create the shadow (not visible yet)
this->shadow_sprite = new Sprite("entities/shadow");
this->shadow_sprite->set_current_animation("big");
// damage on enemies
this->damage_on_enemies = damage_on_enemies;
// explosion
this->explosion_date = explosion_date;
}
开发者ID:xor-mind,项目名称:solarus,代码行数:58,代码来源:CarriedItem.cpp
示例12: set_xy
/*-----------------------------------------------------------------------
LCD_write_english_String : 英文字符串显示函数
输入参数:*s :英文字符串指针;
X、Y : 显示字符串的位置,x 0-83 ,y 0-5
-----------------------------------------------------------------------*/
void NOKIA5110::disp_string(unsigned char X,unsigned char Y,const char *s)
{
set_xy(X,Y);
while (*s)
{
disp_char(*s);
s++;
}
}
开发者ID:Xcping2013,项目名称:ebox_stm32,代码行数:15,代码来源:Nokia5110.cpp
示例13: select_tty
int select_tty(int tty_index)
{
int ret =0;
if ( 0 <= cur_tty_index && cur_tty_index < TTY_NUM)
cur_tty_index = tty_index;
else
ret = -1;
//s32_print_int(tty_table[cur_tty_index].console->vm_start, (u8*)(0xb8000+160*1), 16);
int org_x, org_y;
get_xy(tty_table[cur_tty_index].console, &org_x, &org_y);
set_xy(tty_table[cur_tty_index].console, 0, 0);
s32_console_print_str(tty_table[cur_tty_index].console, "simple os tty ");
switch (cur_tty_index)
{
case 0:
s32_console_print_char(tty_table[cur_tty_index].console, '1');
break;
case 1:
s32_console_print_char(tty_table[cur_tty_index].console, '2');
break;
case 2:
s32_console_print_char(tty_table[cur_tty_index].console, '3');
break;
default:
break;
}
s32_console_print_str(tty_table[cur_tty_index].console, "\r\nfake login: ");
s32_console_print_str(tty_table[cur_tty_index].console, "\r\n\r\n");
set_xy(tty_table[cur_tty_index].console, org_x, org_y);
u16 cur_console_vm_start = (tty_table[cur_tty_index].console->vm_start-0xb8000)/2;
set_video_start_addr(cur_console_vm_start);
//set_cursor(cur_console_vm_start + tty_table[cur_tty_index].console->cur_x + tty_table[cur_tty_index].console->cur_y*80);
set_cursor(cur_console_vm_start + org_x + org_y*80);
return ret;
}
开发者ID:CYQSARA,项目名称:simple_os,代码行数:42,代码来源:tty.c
示例14: clear_movement
/**
* @brief Resets the block at its initial position.
*/
void Block::reset() {
if (get_movement() != NULL) {
// the block was being pushed or pulled by the hero
clear_movement();
when_can_move = System::now() + moving_delay;
}
set_xy(initial_position);
last_position.set_xy(initial_position);
this->maximum_moves = initial_maximum_moves;
}
开发者ID:Aerospyke,项目名称:solarus,代码行数:15,代码来源:Block.cpp
示例15: clear_movement
/**
* \brief Resets the block at its initial position.
*/
void Block::reset() {
if (get_movement() != nullptr) {
// the block was being pushed or pulled by the hero
clear_movement();
when_can_move = System::now() + moving_delay;
}
last_position = initial_position;
this->maximum_moves = initial_maximum_moves;
set_xy(initial_position);
notify_position_changed();
}
开发者ID:Maxs1789,项目名称:solarus,代码行数:16,代码来源:Block.cpp
示例16: va_start
void NOKIA5110::printf(uint8_t row,uint8_t col,const char *fmt,...)
{
char buf[16];
u8 i = 0;
va_list va_params;
va_start(va_params,fmt);
vsprintf(buf,fmt,va_params);
va_end(va_params);
set_xy(row,col);
while(buf[i] != '\0')
{
disp_char(buf[i++]);
}
}
开发者ID:Xcping2013,项目名称:ebox_stm32,代码行数:14,代码来源:Nokia5110.cpp
示例17: RefreshLCD
/*刷新屏幕*/
void RefreshLCD(void)
{
u8 *pLCD;
u8 i;
for(i=0;i<8;i++)//刷新左半屏
{
set_xy(0,i);
for(pLCD = &LCDbuf[i][0] ; pLCD<&LCDbuf[i][64];)
{
WriteData(*pLCD++);
}
}
for(i=0;i<8;i++) //刷新右半屏
{
set_xy(64,i);
for(pLCD = &LCDbuf[i][64] ; pLCD<=&LCDbuf[i][127];)
{
WriteData(*pLCD++);
}
}
memset(LCDbuf , 0 , 1024);//刷屏后清映射区
}
开发者ID:eseawind,项目名称:touchCabinet,代码行数:25,代码来源:Display.c
示例18: calc_screen_limits
void calc_screen_limits(zoom_t *zc)
{
int x, y;
if (3*zc->fb->w > 3*zc->fb->h) // if widescreen (more than 4:3 aka 12:9)
zc->scrscale = (double) zc->fb->h / 18.; // for 1920x1080 srcscale would be 60
else
zc->scrscale = (double) zc->fb->w / 18.;
zc->scrscale_unzoomed = zc->scrscale;
zc->limit_u = mul_xy(xy(zc->fb->w, zc->fb->h), set_xy(0.5/zc->scrscale));
zc->scrscale *= zc->zoomscale;
zc->iscrscale = 1. / zc->scrscale;
zc->drawlim_u = set_xy(zc->iscrscale * GAUSSRAD_HQ * zc->drawing_thickness);
zc->corners.p0 = sub_xy(zc->offset_u, mul_xy(xy(zc->fb->w, zc->fb->h), set_xy(0.5*zc->iscrscale)));
zc->corners.p1 = add_xy(zc->offset_u, mul_xy(xy(zc->fb->w, zc->fb->h), set_xy(0.5*zc->iscrscale)));
zc->corners_dl.p0 = sub_xy(zc->corners.p0, zc->drawlim_u);
zc->corners_dl.p1 = add_xy(zc->corners.p1, zc->drawlim_u);
zc->fb->window_dl.p0 = set_xy(-GAUSSRAD_HQ * zc->drawing_thickness); // drawing limit in pixels
zc->fb->window_dl.p1 = sub_xy( xy(zc->fb->w-1, zc->fb->h-1), zc->fb->window_dl.p0 );
}
开发者ID:Photosounder,项目名称:rouziclib,代码行数:24,代码来源:zoom.c
示例19: set_xy
void Snake::render_tick()
{
byte x = _head_x;
byte y = _head_y;
byte dir;
// Draw head
set_xy(x, y, 1);
// Delete tail
for (int i=0; i < _snake_len; i++)
{
dir = ~(get_element(i)) & 3;
next_pos((direction)dir, &x, &y);
if (i == _snake_len - 1) {
set_xy(x, y, 0);
}
}
// Draw food
if (_food_x > 0 && _food_y > 0)
set_xy(_food_x, _food_y, 1);
}
开发者ID:ArdaXi,项目名称:Mk2-Firmware,代码行数:24,代码来源:SnakeApp.cpp
示例20: LCD_write_chi
/*-----------------------------------------------------------------------
LCD_write_chinese_string: 在LCD上显示汉字
输入参数:X、Y :显示汉字的起始X、Y坐标;
ch_with :汉字点阵的宽度
num :显示汉字的个数;
line :汉字点阵数组中的起始行数
row :汉字显示的行间距
测试:
LCD_write_chi(0,0,12,7,0,0);
LCD_write_chi(0,2,12,7,0,0);
LCD_write_chi(0,4,12,7,0,0);
-----------------------------------------------------------------------*/
void NOKIA5110::write_chinese_string(unsigned char X, unsigned char Y,
unsigned char ch_with,unsigned char num,
unsigned char line,unsigned char row)
{
unsigned char i,n;
set_xy(X,Y); //设置初始位置
for (i=0;i<num;)
{
for (n=0; n<ch_with*2; n++) //写一个汉字
{
if (n==ch_with) //写汉字的下半部分
{
if (i==0) set_xy(X,Y+1);
else
set_xy((X+(ch_with+row)*i),Y+1);
}
write_data(write_chinese[line+i][n]);
}
i++;
set_xy((X+(ch_with+row)*i),Y);
}
}
开发者ID:Xcping2013,项目名称:ebox_stm32,代码行数:37,代码来源:Nokia5110.cpp
注:本文中的set_xy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论