Browse Source

* src/io.c:

+ Fixed a bug in the mouse coordinates reporting.
tags/v0.99.beta14
Sam Hocevar sam 21 years ago
parent
commit
3df5ed87a8
3 changed files with 12 additions and 13 deletions
  1. +8
    -8
      src/blit.c
  2. +2
    -3
      src/caca.c
  3. +2
    -2
      src/io.c

+ 8
- 8
src/blit.c View File

@@ -101,8 +101,8 @@ void caca_blit(int x1, int y1, int x2, int y2, void *pixels, int w, int h)
int tmp = y2; y2 = y1; y1 = tmp;
}

pitch = (3 * w + 3) / 4 * 4;
//pitch = 4 * w;
//pitch = (3 * w + 3) / 4 * 4;
pitch = 4 * w;

for(y = y1 > 0 ? y1 : 0; y <= y2 && y <= (int)caca_get_height(); y++)
{
@@ -114,12 +114,12 @@ void caca_blit(int x1, int y1, int x2, int y2, void *pixels, int w, int h)
{
int fromx = w * (x - x1) / (x2 - x1 + 1);
int fromy = h * (y - y1) / (y2 - y1 + 1);
int r = ((unsigned char *)pixels)[3 * fromx + pitch * fromy];
int g = ((unsigned char *)pixels)[3 * fromx + 1 + pitch * fromy];
int b = ((unsigned char *)pixels)[3 * fromx + 2 + pitch * fromy];
//int b = ((unsigned char *)pixels)[4 * fromx + pitch * fromy];
//int g = ((unsigned char *)pixels)[4 * fromx + 1 + pitch * fromy];
//int r = ((unsigned char *)pixels)[4 * fromx + 2 + pitch * fromy];
//int r = ((unsigned char *)pixels)[3 * fromx + pitch * fromy];
//int g = ((unsigned char *)pixels)[3 * fromx + 1 + pitch * fromy];
//int b = ((unsigned char *)pixels)[3 * fromx + 2 + pitch * fromy];
int b = ((unsigned char *)pixels)[4 * fromx + pitch * fromy];
int g = ((unsigned char *)pixels)[4 * fromx + 1 + pitch * fromy];
int r = ((unsigned char *)pixels)[4 * fromx + 2 + pitch * fromy];
int hue, sat, val;

int min = r, max = r, delta;


+ 2
- 3
src/caca.c View File

@@ -97,8 +97,6 @@ int caca_init(void)

SLang_init_tty(-1, 0, 1);

SLkp_define_keysym("\e[M", 1001);

if(SLsmg_init_smg() == -1)
{
SLsig_unblock_signals();
@@ -109,7 +107,8 @@ int caca_init(void)

SLsmg_cls();
SLtt_set_cursor_visibility(0);
SLtt_set_mouse_mode (1, 0);
SLkp_define_keysym("\e[M", 1001);
SLtt_set_mouse_mode(1, 0);
SLsmg_refresh();

for(i = 0; i < 16; i++)


+ 2
- 2
src/io.c View File

@@ -102,8 +102,8 @@ int caca_get_event(void)

key[5] = _read_key();

event |= (int)(key[3] - ' ') << 8;
event |= (int)(key[4] - ' ') << 4;
event |= (int)(key[3] - ' ') << 16;
event |= (int)(key[4] - ' ') << 8;
event |= (int)(key[5] - ' ') << 0;

return event;


Loading…
Cancel
Save