Commit graph

71 commits

Author SHA1 Message Date
Basile Clement
55a2f75d16
Make cards rounded (#4765)
* Make cards rounded

Magic cards have rounded corners, and playing cards tend to have rounded
corners as well, but Cockatrice currently displays rectangular cards.

This can cause visual glitches when using image scans where the border
does not extend in the corner, and for this reason Cockatrice always
draws a (rectangular) border around the card to try and make it look a
bit better.

In this patch I take a different approach: rather than try to make
rounded pegs, er, cards, go into a square hole, the hole is now rounded.
More precisely, the AbstractCardItem now has a rounded rectangular shape
(with a corner of 5% of the width of the card, identical to that of
modern M:TG physical cards).

As a side effect, the card drawing gets a bit simplified by getting rid
of transformPainter() when drawing the card outline and using the
QPainter::drawPixmap overloads that takes a target QRectF instead.  This
means we no longer have to bother about card rotation when painting
since that's taken care of by the Graphics View framework (which
transformPainter() undoes).

* format

* Also give PileZone rounded corners

* Forgot untap status + bits of CardDragItem

* fix deckviewcard calculations

* Rounded CardInfoPicture
2023-03-07 01:41:08 +01:00
ebbit1q
6981cca2ae
use qt round for better cross platform consistency (#4518)
* use qt round for better cross platform consistency

* remove unnecessary casts
2022-01-08 16:01:15 -05:00
Danny Piper
689f65b38a
Fix for poor performance with large decks (#4347)
* Fix for #4284

-> The menus have the update menu thing emitted when they get triggered.
| -> works surprising well https://youtu.be/KOOmhxvHA2c is a demo on a 10000ish card deck

* changed my comment to make sense

* fix to the issues that @ebbit1q found

what caued them idk

* Revert "fix to the issues that @ebbit1q found"

This reverts commit 20b1ad9f7a675fd3b0d1be7452f71160ce06de71.

* actual fix for the issues @ebbit1q found

* its dirty but works

* fix cards in zoneviews not having a menu

* deleted isempty check as it is updated after the check

* key binds should work now

-> menus updated on zone change/attach/retranslate UI if selected

* clangify

* remove updateCardMenu from carditem entirely

updateCardMenu is done by the player and having it in carditem led to it
often being run multiple times, I've opted to instead run it in the
player and remove the signal entirely

the new logic updates the cardMenu every time a card is set as the
activeCard in the game tab

additionally a cardmenu can change while selected if the selected card:
moves zone, is flipped, or is attached (it receives the unattach action)

this is done in the player instead now, checking if the card is the
activeCard

this however exposes a flaw in the selection management where if you
unselect a card the activeCard is set to nullptr, this was an existing
bug and causes the action on selected cards to suddenly disappear, even
if there are other cards selected!

* revert null test of aCardMenu

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
2021-09-14 16:35:47 -04:00
Joel Bethke
56a51c7834
ui: Fix Qt depreaction warnings (#4195) 2020-11-29 02:33:13 -05:00
olegshtch
44297dcd1c
Fix release tests (#4063) 2020-08-13 10:18:01 -04:00
ctrlaltca
f4adf79ad9 Message log: remove all workarounds; fix #3553 (#3760)
* Remove workarounds in messagelog
2019-07-07 22:27:50 -04:00
ctrlaltca
95d6efcdbf
Dont create dummy card infos for unkown cards (#3708) 2019-05-05 22:37:48 +02:00
Rob Blanckaert
477faafb84 Adjust fontsize up on highdpi displays (#3610) 2019-03-04 01:32:09 -05:00
Rob Blanckaert
45b16ba78d
macOS: Fix qt5.12 scale issues and dark mode (#3588)
* Maybe fix QT 5.12 scale.

* Use Palette colors
2019-02-24 10:05:09 -08:00
Rob Blanckaert
e68305d7bf - CardItems have dummy CardInfos if they arent in the database (#3589)
- If a CardInfo has no sets, add a dummy one to try to download it by non-set specific templates.
2019-02-23 19:52:38 -05:00
Vafthrudnir
11ad677fe8 Sending card name to chat on shift+click (#3106) 2018-02-13 02:50:37 -05:00
ctrlaltca
517420cccb Replace CardInfo* and Carset* with smart pointers (#3053)
* Replace CardInfo* and Carset* with smart pointers

* fixes to help memory & c++11 stuff
2018-02-02 12:52:47 -05:00
ctrlaltca
b29bd9e070
Clang-format (#3028)
* 1/3 Add .clang-format file and travis compilation check

* 2/3 Run clang-format

* 3/3 Fix compilation problems due to include reordering

* 3bis/3 AfterControlStatement: false
2018-01-27 10:41:32 +01:00
ctrlaltca
3f3839d70a fix deck card backs (#2645) 2017-04-25 11:32:00 -04:00
ctrlaltca
8ad448a23c fix #2600 (#2638) 2017-04-25 00:29:32 -04:00
Zach H
a2a7561613 allow max font size to be defined by user (#2488) 2017-03-19 14:13:20 -04:00
Name Temporarily Hidden
c0e7d0c7c7 Removed font-size cap for on-card text (fixes bug: #2368) (#2427) 2017-02-26 23:20:54 -05:00
Fabio Bas
df393638ed Small Fix 2016-03-18 21:18:48 +01:00
Fabio Bas
1e3fb6c6e1 Rework "paths" settings loading and card database loading
* main.cpp: removed path checking and db loading
 * card database: merge card loading methods into a single one
 * settings cache: take care of returning safe paths for decks,
replays, etc..
 * main window: if db loading fails (eg. first run), propose to run
oracle

NSIS: propose to run cockatrice instead of oracle

Rework card database loading

 * Move carddatabase-related method out of deckeditor tab
 * Load cards in another thread and render them progressively
 * Optimize database reload after enabled sets change

Fix deck editor column width

 * removed the noCard hack.
 * getCard() no more creates cards instead of just returning existing
ones
 * Fix the “edit tokens” dialog.
 * PictureLoader: avoid trying to download twice the same card
 * PictureLoader: correct return of card background
 * AbstractCardItem: avoid recalculating card color at every paint

Use a different file to save custom tokens

Misc required improvements

 * Use nullptr;
 * Refactor CardInfoWidget to use CardInfoPicture and CardInfoText
instead of duplicating code;
 * Added CardInfo::getColorChar()
 * Fixed some potential crashes
 * removed dead code related to CardInfoWidget
 * Don't require a restart after adding a new custom sets file
 * Bump CMake requirements to 3.1
2016-03-15 22:27:55 +01:00
Fabio Bas
4d7795ca3a Split pictuloader out of carddatabase 2015-12-26 16:40:17 +01:00
Zach
d5adec53a2 Revert "Reimplemented PictureLoader as a singleton" 2015-09-23 03:17:33 -04:00
Fabio Bas
f6c7f3355f Reimplemented PictureLoader as a singleton
* Removed remaining picture handling from card database and cardinfo
 * removed the “noCard object” hack
2015-09-22 23:09:53 +02:00
Matt Lowe
c260a8a1d4 Fixed image centering 2015-07-06 20:34:38 +02:00
Fabio Bas
0a366d7564 Fix #67
Workaround the two remaining issues, mostly fixing the “load deck”
screen in tab_game:
 * Only preload up to the first 300 cards of a deck;
 * don’t even bother trying to load card images if they’ll be shown
with width <= 10

Trying a 17k cards deck like the one proposed in #67 is still a no go,
mostly due to the cpu time used to create all the objects. Anyway, i
tested decks up to 8k cards and they works fine now (if you like to
wait while trice is loading them)..
2015-04-04 14:03:22 +02:00
poixen
cd9f4e9856 Merge pull request #845 from poixen/card_boarder
Updated card borders
2015-03-26 17:48:44 +01:00
Matt Lowe
441cb4447a Added optional card scaling setting
+ Users can now enable/disable the mouse over card scaling.
2015-03-18 13:37:06 +01:00
Matt Lowe
c05f75438b Updated card borders
+ refactored code
+ improved card border lines (black)
+ cards no longer have curved edges, this prevents card image corners
showing behind.
+ tapped cards now have better border lines
2015-03-18 13:11:30 +01:00
Jeffrey Oliver
08166f7d24 Use !isSelected() 2015-02-13 21:48:37 -08:00
Jeffrey Oliver
180108e6f9 ctrl-click to add a card to a selection. 2015-02-12 22:44:17 -08:00
Fabio Bas
f88621fd97 Use QPixmapCache for card images
Drop CardInfo’s own pixmap caches; use QPixmapCache instead.
Use QPixmap references instead of pointers.
Being stored in QPixmapCache, all card images are now subjected to
QPixmapCache’s size limit
2014-12-24 16:18:55 +01:00
Matt Lowe
62b7890e59 Cards Scale with mouse over action
Cards now scale up by 10% when mouse over.
2014-11-12 23:26:24 +01:00
Mark Morschhäuser
80da61dcbb Fix MSVC++ compile error caused by missing round() in math.h 2014-03-11 16:10:55 +01:00
Mark Morschhäuser
49227ad44c Fixed VC "'*/' found outside of comment" warning. 2014-03-11 15:04:26 +01:00
Matt Kelly
1bc48a7849 Convert rest of source to 4-space indent 2014-02-11 11:14:19 -05:00
Max-Wilhelm Bruker
ae19d3dc4b fixed game list update bug, minor optimizations, restrict client protocol output to QT_DEBUG mode 2012-04-06 17:52:23 +02:00
Max-Wilhelm Bruker
c835a827b0 AlwaysRevealTopCard done, issue #31 fixed 2012-04-01 11:45:01 +02:00
Max-Wilhelm Bruker
5ff1fd8ec6 added peeking at facedown cards, fixing issue #7 2012-03-24 18:52:08 +01:00
Max-Wilhelm Bruker
632e9bbff3 improved banning and deck hashing 2011-11-01 22:44:51 +01:00
Max-Wilhelm Bruker
46fdae43cd visual improvements: card hover effect, independent scaling of ZoneViewWidget 2011-07-20 21:25:43 +02:00
Max-Wilhelm Bruker
0120d2a019 cardInfoPopup fix; chatView fix 2011-06-28 02:37:49 +02:00
Max-Wilhelm Bruker
15ca28bf37 hopefully fixed CardInfoPopup freeze 2011-05-30 15:54:33 +02:00
Max-Wilhelm Bruker
64c3c0984e minor performance improvements, removed explicit font size setting 2011-03-07 18:50:06 +01:00
Max-Wilhelm Bruker
7a7b686e67 fixed crash that occurs when reloading the card database while deck editor or game is running 2011-02-28 18:20:27 +01:00
Max-Wilhelm Bruker
d4f600393f minor visual change, server crash fix, multiplayer leave/concede fixes 2011-02-15 22:50:16 +01:00
Max-Wilhelm Bruker
78e5068e39 converted phases toolbar to graphics item 2011-02-12 21:09:33 +01:00
Max-Wilhelm Bruker
4a34c52c8c optionally display card names on cards even if they have a picture 2011-02-11 18:54:55 +01:00
Max-Wilhelm Bruker
dcf54ae2de fixed card hover event in sideboard screen 2011-01-26 02:43:29 +01:00
Max-Wilhelm Bruker
6e567d5b2f crash fix 2010-12-01 14:56:50 +01:00
Max-Wilhelm Bruker
0fdc01f6dd GameScene::event() optimization 2010-11-10 18:27:07 +01:00
Max-Wilhelm Bruker
c8779032c8 minor hover bug fix 2010-11-10 02:04:40 +01:00