QTfrontend/selectWeapon.cpp
changeset 2467 be6690c337fb
parent 2377 f3fab2b09e0c
child 2471 1cfc9f897616
equal deleted inserted replaced
2466:ab6dfb227d1d 2467:be6690c337fb
    27 #include <QBitmap>
    27 #include <QBitmap>
    28 #include <QLineEdit>
    28 #include <QLineEdit>
    29 #include <QSettings>
    29 #include <QSettings>
    30 #include <QMessageBox>
    30 #include <QMessageBox>
    31 #include <QTabWidget>
    31 #include <QTabWidget>
       
    32 #include <math.h>
    32 
    33 
    33 QImage getAmmoImage(int num)
    34 QImage getAmmoImage(int num)
    34 {
    35 {
    35 	static QImage ammo(":Ammos.png");
    36 	static QImage ammo(":Ammos.png");
    36 	return ammo.copy(0, num*32, 32, 32);
    37     int x = floor((num * 32) / ammo.height()) * 32;
       
    38     if(x) x--;
       
    39 	return ammo.copy(x, num*32, 32, 32);
    37 }
    40 }
    38 
    41 
    39 SelWeaponItem::SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QWidget* parent) :
    42 SelWeaponItem::SelWeaponItem(bool allowInfinite, int iconNum, int wNum, QWidget* parent) :
    40 	QWidget(parent)
    43 	QWidget(parent)
    41 {
    44 {