GUI: Added support for double buffering on the vector display for smoother motion
This commit is contained in:
parent
2c07ced789
commit
fba8c1f2f4
17
gui.c
17
gui.c
@ -598,8 +598,10 @@ int update_general_terminal_output(struct simdata_t *simdata){
|
||||
|
||||
term_curs_x=0;
|
||||
term_curs_y=0;
|
||||
uint8_t* vector_frame_buffer=malloc((height*4)*(width*2));
|
||||
memset(vector_frame_buffer,0,(height*4)*(width*2));
|
||||
uint8_t* vector_working_frame_buffer=malloc((height*4)*(width*2));
|
||||
uint8_t* vector_display_frame_buffer=malloc((height*4)*(width*2));
|
||||
memset(vector_working_frame_buffer,0,(height*4)*(width*2));
|
||||
memset(vector_display_frame_buffer,0,(height*4)*(width*2));
|
||||
|
||||
int vector=0;
|
||||
int vstate=0;
|
||||
@ -615,7 +617,9 @@ int update_general_terminal_output(struct simdata_t *simdata){
|
||||
if(c==0x00000001)
|
||||
vector=0;
|
||||
else if(c==0x00000002)
|
||||
memset(vector_frame_buffer,0,(height*4)*(width*2));
|
||||
memset(vector_working_frame_buffer,0,(height*4)*(width*2));
|
||||
else if(c==0x00000003)
|
||||
memcpy(vector_display_frame_buffer,vector_working_frame_buffer,(height*4)*(width*2));
|
||||
else
|
||||
vstate++;
|
||||
break;
|
||||
@ -641,7 +645,7 @@ int update_general_terminal_output(struct simdata_t *simdata){
|
||||
xoff=(vfb_width-vfb_height)/2;
|
||||
else
|
||||
yoff=(vfb_height-vfb_width)/2;
|
||||
braille_frame_buffer_line(vector_frame_buffer,vfb_width,vfb_height,xoff+(x0+1)*(min_dim/2),yoff+(y0+1)*(min_dim/2),xoff+(x1+1)*(min_dim/2),yoff+(y1+1)*(min_dim/2));
|
||||
braille_frame_buffer_line(vector_working_frame_buffer,vfb_width,vfb_height,xoff+(x0+1)*(min_dim/2),yoff+(y0+1)*(min_dim/2),xoff+(x1+1)*(min_dim/2),yoff+(y1+1)*(min_dim/2));
|
||||
vstate=0;
|
||||
break;
|
||||
}
|
||||
@ -690,10 +694,11 @@ int update_general_terminal_output(struct simdata_t *simdata){
|
||||
mvwchgat(general_terminal_output,term_curs_y+1,term_curs_x+1, 1, A_REVERSE, 0, NULL);
|
||||
mvwprintw(general_terminal_output,0,width/2-7,"[ TERM OUTPUT ]");
|
||||
}else{
|
||||
print_braille_frame_buffer(general_terminal_output,vector_frame_buffer,(width-2)*2,(height-2)*4);
|
||||
print_braille_frame_buffer(general_terminal_output,vector_display_frame_buffer,(width-2)*2,(height-2)*4);
|
||||
mvwprintw(general_terminal_output,0,width/2-9,"[ VECTOR DISPLAY ]");
|
||||
}
|
||||
free(vector_frame_buffer);
|
||||
free(vector_working_frame_buffer);
|
||||
free(vector_display_frame_buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -6,6 +6,23 @@ MOV $0xFFFF,%R1l
|
||||
MOV $0xFFFF,%R1h
|
||||
MOV %R1,(%R4)
|
||||
CALL $RENDER
|
||||
MOV $>DATA_START,%R0l
|
||||
MOV $<DATA_START,%R0h
|
||||
MOV (%R0),%R1
|
||||
MOV $0x3f4c,%R4h #0.8
|
||||
MOV $0xcccd,%R4l
|
||||
FADD %R4,%R1
|
||||
MOV %R1,(%R0)
|
||||
CALL $RENDER
|
||||
MOV $>DATA_START,%R0l
|
||||
MOV $<DATA_START,%R0h
|
||||
MOV (%R0),%R1
|
||||
MOV $0x3f4c,%R4h #0.8
|
||||
MOV $0xcccd,%R4l
|
||||
FADD %R4,%R1
|
||||
MOV %R1,(%R0)
|
||||
CALL $RENDER
|
||||
HALT
|
||||
|
||||
:RENDER
|
||||
MOV $>DATA_START,%R0l
|
||||
@ -16,6 +33,11 @@ MOV $0x0001,%R6l
|
||||
MOV $0x0000,%R6h
|
||||
MOV $0x0004,%R5l
|
||||
MOV $0x0000,%R5h
|
||||
MOV $0xFFFC,%R4l
|
||||
MOV $0x00FF,%R4h
|
||||
MOV $0x0002,%R1l
|
||||
MOV $0x0000,%R1h #Clear the frame
|
||||
MOV %R1,(%R4)
|
||||
:RENDER_LOOP
|
||||
MOV $0xFFFF,%R1l
|
||||
MOV $0xFFFF,%R1h
|
||||
@ -71,7 +93,10 @@ MOV %R2,(%R4)
|
||||
|
||||
SUB %R6,%R7
|
||||
JMP,NZ $RENDER_LOOP
|
||||
HALT
|
||||
MOV $0x0003,%R1l
|
||||
MOV $0x0000,%R1h #Display the frame
|
||||
MOV %R1,(%R4)
|
||||
RET
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user