本文整理汇总了C++中screen_init函数的典型用法代码示例。如果您正苦于以下问题:C++ screen_init函数的具体用法?C++ screen_init怎么用?C++ screen_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了screen_init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: command
int command(int keycode, t_box *box)
{
if (box->id != 0)
return (command2(keycode, box));
if (keycode == KEY_ESC)
exit(0);
else if (keycode == KEY_PAD1)
screen_init(box, 1);
else if (keycode == KEY_PAD2)
screen_init(box, 2);
else if (keycode == KEY_PAD4)
screen_init(box, 4);
else if (keycode == KEY_PAD3)
screen_init(box, 3);
else if (keycode == KEY_PAD5)
screen_init(box, 5);
else if (keycode == KEY_PAD6)
screen_init(box, 6);
else if (keycode == KEY_PAD7)
screen_init(box, 7);
else if (keycode == KEY_PAD8)
screen_init(box, 8);
else if (keycode == KEY_PAD9)
screen_init(box, 9);
else if (keycode == KEY_CLEAR)
screen_init(box, 10);
return (1);
}
示例2: cl_display
void* cl_display(void* args) {
printf("Pret a afficher...\n");
Params* p = (Params*)args;
int sockfd = p->sock;
screen_init(p->p_screen,p->p_game);
int continuer = 1;
p->p_screen->curpos = 0;
SDL_EnableUNICODE(1);
while (continuer)
{
SDL_Event event;
SDL_PollEvent(&event);
SDL_WaitEvent(&event);
switch(event.type)
{
case SDL_QUIT:
continuer = 0;
break;
case SDL_KEYDOWN:
p->p_screen->curpos = gereTouche(&(event.key), p->p_screen->chaine, p->p_screen->curpos);
break;
}
if(p->p_screen->curpos==-1){
struct Command c = split_command(p->p_screen->chaine);
int num_cmd = command_num(c.name);
pthread_mutex_lock(&mutex_stock);
if(num_cmd==17 && command_treatment(p->p_game,&c)==2){
continuer = 0;
break;
}
if(num_cmd==16 || num_cmd==18 || num_cmd==22)
command_treatment(p->p_game,&c);
if(num_cmd != 14 || num_cmd==-1 || (num_cmd==14 && command_treatment(p->p_game,&c)==0)){
p->p_game->last_command = &c;
send(sockfd,p->p_screen->chaine,strlen(p->p_screen->chaine),0);
}
pthread_mutex_unlock(&mutex_stock);
}
if(p->p_screen->curpos==-1 || p->p_screen->curpos==-2){
p->p_screen->curpos = 0;
int j = 0;
while(j < 100){
p->p_screen->chaine[j++] = '\0';
}
}
pthread_mutex_lock(&mutex_stock);
screen_init(p->p_screen,p->p_game);
pthread_mutex_unlock(&mutex_stock);
}
SDL_EnableUNICODE(0);
pthread_cancel(pth_recv);
free(p->p_screen);
free(p->p_game);
SDL_Quit();
pthread_cancel(pth_display);
exit(0);
return NULL;
}
示例3: new_highscore_loop
void new_highscore_loop() {
uint64_t ascii = readKeyCode();
screen_t scr_score;
screen_init(&scr_score, 20, 10, 45, 2);
// screen_clear(&scr_score, 0x00);
if(ascii) {
switch(ascii) {
case KEY_CODE_AU:
++*new_highscore.name_p;
break;
case KEY_CODE_AD:
--*new_highscore.name_p;
break;
case KEY_CODE_ENT:
++new_highscore.name_p;
// Name entered
if(!*new_highscore.name_p) {
highscore_init();
return;
}
break;
}
}
writef(&scr_score,
"Your score: %c%u%c%n"
"Your name: %c%s",
0x2F, new_highscore.score->score, 0x07, 0xC7, new_highscore.score->name
);
}
示例4: modules_init
void modules_init() {
screen_init();
status("initializing keyboard");
keyboard_init();
statusDone();
}
示例5: graph_init
/**
* @brief 初始化窗口管理器图形相关
*
* @param framebuffer_path framebuffer设备路径
* @param top_margin 配置项 屏幕上方留白的像素
* @param down_margin 配置项 屏幕下方留白的像素
* @param left_margin 配置项 屏幕左方留白的像素
* @param right_margin 配置项 屏幕右方留白的像素
*
* @return 成功返回0 否则返回-1
**/
static si_t graph_init(char* framebuffer_path, si_t top_margin, si_t down_margin, si_t left_margin, si_t right_margin)
{
struct graphics_device* gd_ptr = NULL;
/* 初始化屏幕 */
screen_init(framebuffer_path);
/* 设置颜色的限制 */
screen_color_limit();
/**
* 初始化窗口管理器的图形设备
**/
global_wm.gd_handler = engine_graphics_device_init(0, 0, global_screen.width, global_screen.height, 0,0,0,0,0);
if(0 == global_wm.gd_handler)
{
EGUI_PRINT_ERROR("failed to init window manager graph device.");
return -1;
}
gd_ptr = (struct graphics_device*)global_wm.gd_handler;
gd_ptr->screen.memory_addr = global_screen.memory_addr;
gd_ptr->screen.buffer_addr = NULL;
gd_ptr->screen.video_access_mode = VIDEO_ACCESS_MODE_DIRECT;
/**
* 初始化窗口区域
**/
rectangle_set(&global_wm.work_area,
0 + left_margin, 0 + top_margin, global_screen.width - left_margin - right_margin, global_screen.height - top_margin - down_margin);
/** 绘制桌面 **/
engine_set_color(global_wm.gd_handler, global_wm.backcolor.r, global_wm.backcolor.g, global_wm.backcolor.b, global_wm.backcolor.a);
engine_fill_rectangle(global_wm.gd_handler, global_wm.work_area.x, global_wm.work_area.y, global_wm.work_area.width, global_wm.work_area.height);
return 0;
}
示例6: badge_setup
//__attribute__((constructor))
int32_t badge_setup(void)
{
printf("Start\n");
touch_start(TPCount, TPPins, TPDischarge);
if(!eei2cLockFlag)
{
printf("1\n");
eei2cLock = locknew();
lockclr(eei2cLock);
eei2cLockFlag = 1;
printf("1\n");
}
init_MMA7660FC();
printf("1\n");
if(!st_eeInitFlag) ee_init();
printf("1\n");
cpcog = light_start();
printf("1\n");
cogIRcom = ircom_start(IR_IN, IR_OUT, 2400, 38500);
printf("1\n");
screen_init(OLED_CS, OLED_DC, OLED_DAT, OLED_CLK, OLED_RST, SSD1306_SWITCHCAPVCC, TYPE_128X64);
printf("1\n");
screen_auto(ON);
printf("1\n");
clear();
printf("1\n");
text_size(LARGE);
printf("Return\n");
return 0;
}
示例7: engine2d_win_init
void
engine2d_win_init(struct STARTUP_INFO* startup) {
STARTUP = startup;
G = create_game();
screen_init(startup->width, startup->height, startup->scale);
lua_State *L = engine2d_game_lua(G->game);
lua_pushcfunction(L, traceback);
int tb = lua_gettop(L);
int err = luaL_loadstring(L, startscript);
if (err) {
const char *msg = lua_tostring(L,-1);
fault("%s", msg);
}
lua_pushstring(L, startup->folder);
lua_pushstring(L, startup->script);
push_startup_info(L, startup);
err = lua_pcall(L, 3, 0, tb);
if (err) {
const char *msg = lua_tostring(L,-1);
fault("%s", msg);
}
lua_pop(L,1);
engine2d_game_logicframe(LOGIC_FRAME);
engine2d_game_start(G->game);
}
示例8: main
int
main(int argc, char **argv) {
if(argc != 2)
errx(EXIT_FAILURE, "no input files");
pthread_mutex_init(&mutex_update_image, NULL);
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_t inotify_thread;
if(pthread_create(&inotify_thread, &attr, monitor_file, argv[1]))
err(EXIT_FAILURE, "pthread_create");
font_init();
screen_init();
update_image(argv[1]);
for(;;) {
handle_events();
draw();
}
SDL_Quit();
return EXIT_SUCCESS;
}
示例9: main
int main(int argc, char* argv[])
{
screen_init();
struct recordjar rj;
rj_load("tasks.rj", &rj);
struct load_state state;
state.name = 0;
state.sub = 0;
state.uid = 0;
if(rj.size > 0)
rj_mapfold(init, &state, &rj);
line = 0;
curs_set(0);
task_show(TASK_THIS, &rj);
int c = ' ';
while(c != 'q')
{
c = getch();
if(c == KEY_UP) task_show(TASK_PREV, &rj);
else if(c == KEY_DOWN) task_show(TASK_NEXT, &rj);
}
rj_free(&rj);
endwin();
return 0;
}
示例10: ejoy2d_win_init
void
ejoy2d_win_init(int argc, char *argv[]) {
G = create_game();
lua_State *L = ejoy2d_game_lua(G->game);
lua_pushcfunction(L, traceback);
int tb = lua_gettop(L);
int err = luaL_loadstring(L, startscript);
if (err) {
const char *msg = lua_tostring(L,-1);
fault("%s", msg);
}
lua_pushstring(L, "./");
lua_pushstring(L, "examples/ex03.lua");
err = lua_pcall(L, 2, 0, tb);
if (err) {
const char *msg = lua_tostring(L,-1);
fault("%s", msg);
}
lua_pop(L,1);
screen_init(WIDTH,HEIGHT,1.0f);
ejoy2d_game_start(G->game);
}
示例11: pixel_start
void pixel_start(int w, int h, const char *start) {
lua_State *L = luaL_newstate();
luaL_checkversion(L);
lua_atpanic(L, _panic);
luaL_openlibs(L);
luaX_loader(L);
pixel_init(L);
pixel_log("version:%d\n", shader_version());
memset(&P, 0, sizeof P);
P.L = L;
P.fps = PIXEL_FPS;
P.w = w;
P.h = h;
P.s = 1.0f;
screen_init(P.w, P.h, P.s);
lua_pushcfunction(L, traceback);
int tb = lua_gettop(L);
if (LUA_OK != luaL_loadstring(L, start_script)) {
pixel_log("%s\n", lua_tostring(L, -1));
}
lua_pushstring(L, start);
if (LUA_OK != lua_pcall(L, 1, 0, tb)) {
pixel_log("lua_init:%s\n", lua_tostring(L, -1));
}
lua_pop(L, 1);
lua_getfield(L, LUA_REGISTRYINDEX, PIXEL_INIT);
lua_call(L, 0, 0);
assert(lua_gettop(L) == 0);
lua_pushcfunction(L, traceback);
lua_getfield(L, LUA_REGISTRYINDEX, PIXEL_UPDATE);
lua_getfield(L, LUA_REGISTRYINDEX, PIXEL_FRAME);
}
示例12: kloader_cmain
void kloader_cmain(struct mem_map_entry mem_map[], uint32_t mem_entry_count)
{
screen_init();
screen_cursor_hide();
terminal_init();
KINFO("Welcome to Nox (Bootloader mode)");
mem_mgr_init(mem_map, mem_entry_count);
ata_init();
fs_init();
struct fat_part_info* part_info = fs_get_system_part();
struct fat_dir_entry kernel;
if(!fat_get_dir_entry(part_info, "KERNEL ELF", &kernel)) {
KPANIC("Failed to locate KERNEL.ELF");
while(1);
}
intptr_t kernel_entry_point;
if(!elf_load_trusted("KERNEL ELF", &kernel_entry_point)) {
KWARN("Failed to load elf!");
}
kernel_entry cmain = (kernel_entry)(kernel_entry_point);
cmain(mem_map, mem_entry_count);
KINFO("Bootloader done");
while(1);
}
示例13: main
int main(int argc, const char* argv[]) {
gfxInitDefault();
Result setCpuTimeRes = APT_SetAppCpuTimeLimit(30);
if(R_FAILED(setCpuTimeRes)) {
util_panic("Failed to set syscore CPU time limit: %08lX", setCpuTimeRes);
return 1;
}
romfsInit();
cfguInit();
acInit();
ptmuInit();
httpcInit(0);
amInit();
AM_InitializeExternalTitleDatabase(false);
soc_buffer = memalign(0x1000, 0x100000);
if(soc_buffer != NULL) {
socInit(soc_buffer, 0x100000);
}
screen_init();
ui_init();
mainmenu_open();
while(aptMainLoop() && ui_update());
cleanup();
return 0;
}
示例14: render_sample_triangle
void render_sample_triangle() {
screen_init(&display, WIDTH, HEIGHT);
bmp.w = WIDTH;
bmp.h = HEIGHT;
bmp.data = (color_t*)malloc(bmp.w*bmp.h*sizeof(int));
int i;
for(i=0; i<bmp.w*bmp.h; i++) {
bmp.data[i] = 0xFF0000;
}
for(i=0; i<5; i++)
screen_update(display, &bmp);
triangle2d_t tri = triangle2d_init(
point2d_init(100, 100, 10, 0xFF0000),
point2d_init(500, 100, 100, 0x00FF00),
point2d_init(300, 500, 5, 0x0000FF) );
ALLEGRO_EVENT_QUEUE *event_queue = NULL;
event_queue = al_create_event_queue();
al_register_event_source(event_queue, al_get_display_event_source(display));
while(true) {
rasterize(&bmp, &tri, 1);
screen_update(display, &bmp);
ALLEGRO_EVENT ev;
al_wait_for_event(event_queue, &ev);
if(ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE) {
break;
}
}
}
示例15: ejoy2d_win_resize
void
ejoy2d_win_resize(int w, int h) {
if (G && G->game) {
screen_init(w,h,1.0f);
ejoy2d_game_resize(G->game, w, h);
}
}