52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
snprintf(buf,32,"%5d",level_version);
draw_text(0,16,"V",0xF0,0xF7);
draw_text(16,16,buf,0xF0,0xFF);
snprintf(buf,32,"%5d",level_code);
draw_text(0,24,"C",0xF0,0xF7);
draw_text(16,24,buf,0xF0,0xFF);
}
x=x>=left_margin?(x-left_margin)/picture_size+1:0;
y=y/picture_size+1;
if(x>0 && y>0 && x<=pfwidth && y<=pfheight) snprintf(buf,8,"(%2d,%2d)",x,y);
else strcpy(buf," ");
draw_text(0,32,buf,0xF0,0xF3);
SDL_UnlockSurface(screen);
SDL_Flip(screen);
}
static void show_mouse_xy(SDL_Event*ev) {
char buf[32];
int x,y;
x=(ev->motion.x-left_margin)/picture_size+1;
y=ev->motion.y/picture_size+1;
if(ev->motion.x<left_margin) x=0;
if(x>0 && y>0 && x<=pfwidth && y<=pfheight) snprintf(buf,8,"(%2d,%2d)",x,y);
else strcpy(buf," ");
SDL_LockSurface(screen);
draw_text(0,32,buf,0xF0,0xF3);
SDL_UnlockSurface(screen);
SDL_Flip(screen);
}
static void set_caption(void) {
const char*r;
char*s;
|
>
>
>
|
|
|
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
snprintf(buf,32,"%5d",level_version);
draw_text(0,16,"V",0xF0,0xF7);
draw_text(16,16,buf,0xF0,0xFF);
snprintf(buf,32,"%5d",level_code);
draw_text(0,24,"C",0xF0,0xF7);
draw_text(16,24,buf,0xF0,0xFF);
}
snprintf(buf,8,"%2dx%2d",pfwidth,pfheight);
draw_text(8,32,buf,0xF0,0xFD);
draw_text(24,32,"x",0xF0,0xF5);
x=x>=left_margin?(x-left_margin)/picture_size+1:0;
y=y/picture_size+1;
if(x>0 && y>0 && x<=pfwidth && y<=pfheight) snprintf(buf,8,"(%2d,%2d)",x,y);
else strcpy(buf," ");
draw_text(0,40,buf,0xF0,0xF3);
SDL_UnlockSurface(screen);
SDL_Flip(screen);
}
static void show_mouse_xy(SDL_Event*ev) {
char buf[32];
int x,y;
x=(ev->motion.x-left_margin)/picture_size+1;
y=ev->motion.y/picture_size+1;
if(ev->motion.x<left_margin) x=0;
if(x>0 && y>0 && x<=pfwidth && y<=pfheight) snprintf(buf,8,"(%2d,%2d)",x,y);
else strcpy(buf," ");
SDL_LockSurface(screen);
draw_text(0,40,buf,0xF0,0xF3);
SDL_UnlockSurface(screen);
SDL_Flip(screen);
}
static void set_caption(void) {
const char*r;
char*s;
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
break;
case SDL_MOUSEMOTION:
set_cursor(ev.motion.x<left_margin?XC_arrow:XC_tcross);
show_mouse_xy(&ev);
break;
case SDL_MOUSEBUTTONDOWN:
// fallthrough
case SDL_KEYDOWN:
i=exec_key_binding(&ev,1,0,0,editor_command,0);
if(i==-1) exit(0);
if(i==-2) {
main_options['e']=0;
return;
}
redraw_editor();
break;
}
}
}
|
>
|
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
break;
case SDL_MOUSEMOTION:
set_cursor(ev.motion.x<left_margin?XC_arrow:XC_tcross);
show_mouse_xy(&ev);
break;
case SDL_MOUSEBUTTONDOWN:
if(ev.button.x<left_margin) break;
// fallthrough
case SDL_KEYDOWN:
i=exec_key_binding(&ev,1,0,0,editor_command,0);
if(i==-1) exit(0);
if(i==-2) {
main_options['e']=0;
return;
}
redraw_editor();
break;
}
}
}
|