#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#define FB "/dev/fb0"
int main()
{
struct fb_var_screeninfo var;
struct fb_fix_screeninfo fix;
__u32 height;
__u32 width;
__u32 bpp;
__u32 length;
char *man, *tmp;
int fd;
int i, j;
int x = 50;
int y = 50;
int flag_x = 1;
int flag_y = 1;
fd = open(FB, O_RDWR);
if(fd < 0) {
perror("open");
return fd;
}
ioctl(fd, FBIOGET_VSCREENINFO, &var);
ioctl(fd, FBIOGET_FSCREENINFO, &fix);
width = var.xres_virtual;
height = var.yres_virtual;
bpp = (var.bits_per_pixel + 7) / 8;
length = fix.line_length / bpp;
printf("%d, %d, %d, %d", width, height, bpp, length);
man = (char *)mmap(NULL,length * height * bpp, PROT_WRITE, MAP_SHARED, fd, 0);
while (1) {
tmp = man;
for (i = 0; i < height; i++) {
for (j = 0; j < length; j++) {
if ((i - x) * (i - x) + (j - y) * (j - y) <= 2500)
*tmp++ = 255;
else
*tmp++ = 0;
*tmp++ = 0;
*tmp++ = 1;
*tmp++ = 0;
}
}
if (x + 50 >= height)
flag_x = 1;
if (x <= 50)
flag_x = -1;
if (y + 50 >= width)
flag_y = 1;
if (y <= 50)
flag_y = -1;
if (flag_x == 1)
x -= 50;
if (flag_x == -1)
x += 50;
if (flag_y == 1)
y -= 50;
if (flag_y == -1)
y += 50;
sleep(1);
}
close(fd);
return 0;
}#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#define FB "/dev/fb0"
int main()
{
struct fb_var_screeninfo var;
struct fb_fix_screeninfo fix;
__u32 height;
__u32 width;
__u32 bpp;
__u32 length;
char *man, *tmp;
int fd;
int i, j;
int x = 50;
int y = 50;
int flag_x = 1;
int flag_y = 1;
fd = open(FB, O_RDWR);
if(fd < 0) {
perror("open");
return fd;
}
ioctl(fd, FBIOGET_VSCREENINFO, &var);
ioctl(fd, FBIOGET_FSCREENINFO, &fix);
width = var.xres_virtual;
height = var.yres_virtual;
bpp = (var.bits_per_pixel + 7) / 8;
length = fix.line_length / bpp;
printf("%d, %d, %d, %d", width, height, bpp, length);
man = (char *)mmap(NULL,length * height * bpp, PROT_WRITE, MAP_SHARED, fd, 0);
while (1) {
tmp = man;
for (i = 0; i < height; i++) {
for (j = 0; j < length; j++) {
if ((i - x) * (i - x) + (j - y) * (j - y) <= 2500)
*tmp++ = 255;
else
*tmp++ = 0;
*tmp++ = 0;
*tmp++ = 1;
*tmp++ = 0;
}
}
if (x + 50 >= height)
flag_x = 1;
if (x <= 50)
flag_x = -1;
if (y + 50 >= width)
flag_y = 1;
if (y <= 50)
flag_y = -1;
if (flag_x == 1)
x -= 50;
if (flag_x == -1)
x += 50;
if (flag_y == 1)
y -= 50;
if (flag_y == -1)
y += 50;
sleep(1);
}
close(fd);
return 0;
}
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#define FB "/dev/fb0"
int main()
{
struct fb_var_screeninfo var;
struct fb_fix_screeninfo fix;
__u32 height;
__u32 width;
__u32 bpp;
__u32 length;
char *man, *tmp;
int fd;
int i, j;
int x = 50;
int y = 50;
int flag_x = 1;
int flag_y = 1;
fd = open(FB, O_RDWR);
if(fd < 0) {
perror("open");
return fd;
}
ioctl(fd, FBIOGET_VSCREENINFO, &var);
ioctl(fd, FBIOGET_FSCREENINFO, &fix);
width = var.xres_virtual;
height = var.yres_virtual;
bpp = (var.bits_per_pixel + 7) / 8;
length = fix.line_length / bpp;
printf("%d, %d, %d, %d", width, height, bpp, length);
man = (char *)mmap(NULL,length * height * bpp, PROT_WRITE, MAP_SHARED, fd, 0);
while (1) {
tmp = man;
for (i = 0; i < height; i++) {
for (j = 0; j < length; j++) {
if ((i - x) * (i - x) + (j - y) * (j - y) <= 2500)
*tmp++ = 255;
else
*tmp++ = 0;
*tmp++ = 0;
*tmp++ = 1;
*tmp++ = 0;
}
}
if (x + 50 >= height)
flag_x = 1;
if (x <= 50)
flag_x = -1;
if (y + 50 >= width)
flag_y = 1;
if (y <= 50)
flag_y = -1;
if (flag_x == 1)
x -= 50;
if (flag_x == -1)
x += 50;
if (flag_y == 1)
y -= 50;
if (flag_y == -1)
y += 50;
sleep(1);
}
close(fd);
return 0;
}#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#define FB "/dev/fb0"
int main()
{
struct fb_var_screeninfo var;
struct fb_fix_screeninfo fix;
__u32 height;
__u32 width;
__u32 bpp;
__u32 length;
char *man, *tmp;
int fd;
int i, j;
int x = 50;
int y = 50;
int flag_x = 1;
int flag_y = 1;
fd = open(FB, O_RDWR);
if(fd < 0) {
perror("open");
return fd;
}
ioctl(fd, FBIOGET_VSCREENINFO, &var);
ioctl(fd, FBIOGET_FSCREENINFO, &fix);
width = var.xres_virtual;
height = var.yres_virtual;
bpp = (var.bits_per_pixel + 7) / 8;
length = fix.line_length / bpp;
printf("%d, %d, %d, %d", width, height, bpp, length);
man = (char *)mmap(NULL,length * height * bpp, PROT_WRITE, MAP_SHARED, fd, 0);
while (1) {
tmp = man;
for (i = 0; i < height; i++) {
for (j = 0; j < length; j++) {
if ((i - x) * (i - x) + (j - y) * (j - y) <= 2500)
*tmp++ = 255;
else
*tmp++ = 0;
*tmp++ = 0;
*tmp++ = 1;
*tmp++ = 0;
}
}
if (x + 50 >= height)
flag_x = 1;
if (x <= 50)
flag_x = -1;
if (y + 50 >= width)
flag_y = 1;
if (y <= 50)
flag_y = -1;
if (flag_x == 1)
x -= 50;
if (flag_x == -1)
x += 50;
if (flag_y == 1)
y -= 50;
if (flag_y == -1)
y += 50;
sleep(1);
}
close(fd);
return 0;
}