Ignore:
Timestamp:
Apr 20, 2011, 12:39:27 AM (11 years ago)
Author:
Sam Hocevar
Message:

imlib: use vec2i for image::size and unroll all necessary changes
everywhere else in the code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/game.cpp

    r507 r512  
    1818#   include <SDL.h>
    1919#endif
     20
     21#include "common.h"
    2022
    2123#include "sdlport/joy.h"
     
    469471        int dx = 20, dy = 5;
    470472        image *jim = cache.img(joy_picts[but * 9+(y + 1)*3 + x + 1]);
    471         joy_win->screen->bar(dx, dy, dx + jim->width()+6, dy + jim->height()+6, wm->black());
     473        joy_win->screen->bar(dx, dy, dx + jim->Size().x+6, dy + jim->Size().y+6, wm->black());
    472474        jim->put_image(joy_win->screen, dx + 3, dy + 3);
    473475
     
    624626    int xs, ys;
    625627    if(mousex < xmargin &&  dev_cont->ok_to_scroll()) xs = -18;
    626     else if(mousex>(screen->width()-xmargin) &&  dev_cont->ok_to_scroll()) xs = 18;
     628    else if(mousex>(screen->Size().x-xmargin) &&  dev_cont->ok_to_scroll()) xs = 18;
    627629    else if(wm->key_pressed(JK_LEFT) && !last_input && !dev_cont->need_arrows())
    628630      xs = -18;
     
    633635
    634636    if(mousey < ymargin && dev_cont->ok_to_scroll()) ys = -18;
    635     else if(mousey>(screen->height()-ymargin) &&  dev_cont->ok_to_scroll()) ys = 18;
     637    else if(mousey>(screen->Size().y-ymargin) &&  dev_cont->ok_to_scroll()) ys = 18;
    636638    else if(wm->key_pressed(JK_UP) && !last_input)
    637639      ys = -18;
     
    671673
    672674    uint8_t *sl = (uint8_t *)screen->scan_line(y1) + x1;
    673     int step = screen->width() - (x2 - x1 + 1);
     675    int step = screen->Size().x - (x2 - x1 + 1);
    674676
    675677    for(int y = y1; y <= y2; y++)
     
    711713        screen->set_clip(v->cx1, v->cy1, v->cx2, v->cy2);
    712714      image *tit = cache.img(title_screen);
    713       tit->put_image(screen, screen->width()/2 - tit->width()/2,
    714                     screen->height()/2 - tit->height()/2);
     715      tit->put_image(screen, screen->Size().x/2 - tit->Size().x/2,
     716                    screen->Size().y/2 - tit->Size().y/2);
    715717      if(state == SCENE_STATE)
    716718        screen->set_clip(cx1, cy1, cx2, cy2);
     
    753755    v->cx1 = 0;
    754756    v->cy1 = 0;
    755     v->cx2 = small_render->width()-1;
    756     v->cy2 = small_render->height()-1;
     757    v->cx2 = small_render->Size().x-1;
     758    v->cy2 = small_render->Size().y-1;
    757759
    758760    old_screen = screen;
     
    883885    screen->get_clip(ncx1, ncy1, ncx2, ncy2);
    884886
    885     int scr_w = screen->width();
     887    int scr_w = screen->Size().x;
    886888    if(dev & MAP_MODE)
    887889    {
     
    10741076    dev_cont->dev_draw(v);
    10751077    if(cache.in_use())
    1076     cache.img(vmm_image)->put_image(screen, v->cx1, v->cy2 - cache.img(vmm_image)->height()+1);
     1078    cache.img(vmm_image)->put_image(screen, v->cx1, v->cy2 - cache.img(vmm_image)->Size().y+1);
    10771079
    10781080    if(dev & DRAW_LIGHTS)
     
    11641166  {
    11651167    screen->clear();
    1166     im->put_image(screen, (xres + 1)/2 - im->width()/2, (yres + 1)/2 - im->height()/2);
     1168    im->put_image(screen, (xres + 1)/2 - im->Size().x/2, (yres + 1)/2 - im->Size().y/2);
    11671169  }
    11681170
     
    12791281        pal->load();
    12801282
    1281         int dx = (xres + 1) / 2 - gray->width() / 2, dy = (yres + 1) / 2 - gray->height() / 2;
     1283        int dx = (xres + 1) / 2 - gray->Size().x / 2, dy = (yres + 1) / 2 - gray->Size().y / 2;
    12821284        gray->put_image(screen, dx, dy);
    12831285        smoke[0]->put_image(screen, dx + 24, dy + 5);
     
    15091511    {
    15101512      image *tit = cache.img(title_screen);
    1511       tit->put_image(screen, screen->width()/2 - tit->width()/2,
    1512                     screen->height()/2 - tit->height()/2);
     1513      tit->put_image(screen, screen->Size().x/2 - tit->Size().x/2,
     1514                    screen->Size().y/2 - tit->Size().y/2);
    15131515    }
    15141516    set_state(MENU_STATE);   // then go to menu state so windows will turn off
     
    15861588    {
    15871589      for(view *f = first_view; f; f = f->next)
    1588         cache.img(pause_image)->put_image(screen, (f->cx1 + f->cx2)/2 - cache.img(pause_image)->width()/2,
     1590        cache.img(pause_image)->put_image(screen, (f->cx1 + f->cx2)/2 - cache.img(pause_image)->Size().x/2,
    15891591                   f->cy1 + 5, 1);
    15901592    }
     
    21522154    {
    21532155        char const *helpstr = "ARROW KEYS CHANGE TEXT SPEED";
    2154         wm->font()->put_string(screen, screen->width()/2-(wm->font()->width()*strlen(helpstr))/2 + 1,
    2155             screen->height()-wm->font()->height()-5 + 1, helpstr, wm->dark_color());
    2156         wm->font()->put_string(screen, screen->width()/2-(wm->font()->width()*strlen(helpstr))/2,
    2157             screen->height()-wm->font()->height()-5, helpstr, wm->bright_color());
     2156        wm->font()->put_string(screen, screen->Size().x/2-(wm->font()->width()*strlen(helpstr))/2 + 1,
     2157            screen->Size().y-wm->font()->height()-5 + 1, helpstr, wm->dark_color());
     2158        wm->font()->put_string(screen, screen->Size().x/2-(wm->font()->width()*strlen(helpstr))/2,
     2159            screen->Size().y-wm->font()->height()-5, helpstr, wm->bright_color());
    21582160    }
    21592161/*    else
    21602162    {
    21612163        char *helpstr="PRESS h FOR HELP";
    2162         wm->font()->put_string(screen, screen->width()-wm->font()->width()*strlen(helpstr)-5,
    2163             screen->height()-wm->font()->height()-5, helpstr);
     2164        wm->font()->put_string(screen, screen->Size().x-wm->font()->width()*strlen(helpstr)-5,
     2165            screen->Size().y-wm->font()->height()-5, helpstr);
    21642166    }*/
    21652167/*    int dc = cache.img(window_colors)->pixel(0, 2);
    21662168    int mc = cache.img(window_colors)->pixel(1, 2);
    21672169    int bc = cache.img(window_colors)->pixel(2, 2);
    2168     screen->line(0, 0, screen->width()-1, 0, dc);
    2169     screen->line(0, 0, 0, screen->height()-1, dc);
    2170     screen->line(0, screen->height()-1, screen->width()-1, screen->height()-1, bc);
    2171     screen->line(screen->width()-1, 0, screen->width()-1, screen->height()-1, bc); */
     2170    screen->line(0, 0, screen->Size().x-1, 0, dc);
     2171    screen->line(0, 0, 0, screen->Size().y-1, dc);
     2172    screen->line(0, screen->Size().y-1, screen->Size().x-1, screen->Size().y-1, bc);
     2173    screen->line(screen->Size().x-1, 0, screen->Size().x-1, screen->Size().y-1, bc); */
    21722174
    21732175    for(view *f = first_view; f; f = f->next)
Note: See TracChangeset for help on using the changeset viewer.