Skip to content

Commit db1e598

Browse files
author
Ben Jackson
committed
Use constants for the LIVE button position.
1 parent 77545de commit db1e598

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎cnping.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ uint8_t pattern[8] = {0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE, 0xEF};
6969

7070
#define PINGCYCLEWIDTH 8192
7171
#define TIMEOUT 4
72+
#define BUTTON_X 34
73+
#define BUTTON_Y 16
7274

7375
double PingSendTimes[PINGCYCLEWIDTH];
7476
double PingRecvTimes[PINGCYCLEWIDTH];
@@ -248,7 +250,7 @@ void HandleButton( int x, int y, int button, int bDown )
248250
{
249251
if( button != 1 || !bDown ) return;
250252
drag_lastx = x;
251-
if( in_scrollback_mode && x >= screenx-34 && y <= 16 ) in_scrollback_mode = 0;
253+
if( in_scrollback_mode && x >= screenx-BUTTON_X && y <= BUTTON_Y ) in_scrollback_mode = 0;
252254
}
253255

254256
void HandleMotion( int x, int y, int mask )
@@ -558,9 +560,9 @@ void DrawFrame( void )
558560
if( in_scrollback_mode )
559561
{
560562
CNFGColor( 0xff0000ff );
561-
CNFGTackRectangle( screenx-34, 2, screenx-2, 16 );
563+
CNFGTackRectangle( screenx-BUTTON_X, 2, screenx-2, BUTTON_Y );
562564
CNFGColor( 0xffffffff );
563-
CNFGPenX = screenx-30; CNFGPenY = 5;
565+
CNFGPenX = screenx-BUTTON_X+4; CNFGPenY = 5;
564566
CNFGDrawText( "LIVE", 2 );
565567
}
566568

0 commit comments

Comments
 (0)