├── .gitignore ├── COPYING ├── README.md ├── builddir ├── meson-logs │ └── meson-log.txt └── meson-private │ └── meson.lock ├── data ├── icons │ ├── hicolor │ │ ├── scalable │ │ │ └── apps │ │ │ │ ├── lv.martinsz.millionaire.Devel.svg │ │ │ │ └── lv.martinsz.millionaire.svg │ │ └── symbolic │ │ │ └── apps │ │ │ └── lv.martinsz.millionaire-symbolic.svg │ └── meson.build ├── lv.martinsz.millionaire.appdata.xml.in ├── lv.martinsz.millionaire.desktop.in ├── lv.martinsz.millionaire.gschema.xml ├── meson.build └── resources │ ├── img │ ├── answer-a-default.png │ ├── answer-a-green.png │ ├── answer-a-red.png │ ├── answer-a-yellow.png │ ├── answer-b-default.png │ ├── answer-b-green.png │ ├── answer-b-red.png │ ├── answer-b-yellow.png │ ├── answer-c-default.png │ ├── answer-c-green.png │ ├── answer-c-red.png │ ├── answer-c-yellow.png │ ├── answer-d-default.png │ ├── answer-d-green.png │ ├── answer-d-red.png │ ├── answer-d-yellow.png │ ├── bg-sparks.png │ ├── bg.png │ ├── btn-50-50.png │ ├── btn-audience.png │ ├── btn-call.png │ ├── info-box-highlighted.png │ ├── info-box.png │ └── lifeline-answer.png │ ├── meson.build │ ├── millionaire.gresource.xml │ ├── screenshots │ ├── screenshot.jpg │ ├── screenshot1.png │ └── screenshot2.png │ ├── style.css │ └── ui │ └── millionaire-window.blp ├── lv.martinsz.millionaire.json ├── meson.build ├── po ├── LINGUAS ├── POTFILES └── meson.build ├── screenshot.jpg ├── src ├── include │ ├── millionaire-application.h │ ├── millionaire-questions.h │ └── millionaire-window.h ├── main.c ├── meson.build ├── millionaire-application.c ├── millionaire-questions.c └── millionaire-window.c └── subprojects └── blueprint-compiler.wrap /.gitignore: -------------------------------------------------------------------------------- 1 | /subprojects/blueprint-compiler 2 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | Who Wants To Be a Millionaire 3 |

4 | 5 | # Who Wants To Be a Millionaire 6 | 7 | I am open to pull requests if anyone wants to improve on this game. 8 | 9 | This is a simple version of the popular game made using C / GTK 4 / Libadwaita. There are only 10 hard-coded questions and they are not in a random order. There also is no time limit. 10 | 11 | The codebase could be much improved by moving the main game logic into its own GObject class - a millionaire-gameplay an object that represents the game state, and give millionaire-window a property of type MillionaireGameplay making it into a model/view split, where Gameplay is responsible only for the game logic and Window is responsible only for displaying the game state in the UI. As a bonus, it gives the ability to use property bindings, like label: bind gameplay.money. 12 | 13 | The game also uses GTK Fixed widget and a fixed window size. This could also be improved by moving to a more responsive layout like GTK Grid. 14 | 15 | **Screenshot**: 16 | 17 | -------------------------------------------------------------------------------- /builddir/meson-logs/meson-log.txt: -------------------------------------------------------------------------------- 1 | Build started at 2022-11-10T21:29:57.463165 2 | Main binary: /usr/bin/python3 3 | Build Options: -Dbuildtype=debug 4 | Python system: Linux 5 | The Meson build system 6 | Version: 0.53.2 7 | Source dir: /home/martins/Programming/millionaire 8 | Build dir: /home/martins/Programming/millionaire/builddir 9 | Build type: native build 10 | 11 | meson.build:1:0: ERROR: Meson version is 0.53.2 but project requires >= 0.59.0 12 | -------------------------------------------------------------------------------- /builddir/meson-private/meson.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/builddir/meson-private/meson.lock -------------------------------------------------------------------------------- /data/icons/hicolor/scalable/apps/lv.martinsz.millionaire.Devel.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /data/icons/hicolor/scalable/apps/lv.martinsz.millionaire.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /data/icons/hicolor/symbolic/apps/lv.martinsz.millionaire-symbolic.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /data/icons/meson.build: -------------------------------------------------------------------------------- 1 | application_id = 'lv.martinsz.millionaire' 2 | 3 | scalable_dir = join_paths('hicolor', 'scalable', 'apps') 4 | install_data( 5 | join_paths(scalable_dir, ('@0@.svg').format(application_id)), 6 | install_dir: join_paths(get_option('datadir'), 'icons', scalable_dir) 7 | ) 8 | 9 | symbolic_dir = join_paths('hicolor', 'symbolic', 'apps') 10 | install_data( 11 | join_paths(symbolic_dir, ('@0@-symbolic.svg').format(application_id)), 12 | install_dir: join_paths(get_option('datadir'), 'icons', symbolic_dir) 13 | ) 14 | -------------------------------------------------------------------------------- /data/lv.martinsz.millionaire.appdata.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | lv.martinsz.millionaire 4 | Who Wants To Be a Millionaire 5 | Answer all questions to win $1 million. 6 | Martins Zeltins 7 | 8 | Martins Zeltins 9 | 10 | lv.martinsz.millionaire.desktop 11 | martins.zeltins@gmail.com 12 | CC0-1.0 13 | GPL-2.0-or-later 14 | 15 |

Test your knowledge to see if you can answer all questions and win $1 million. Have fun!

16 |
17 | 18 | 1298 19 | 20 | 21 | 22 | 23 | Screenshot of the game 24 | https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/master/data/resources/screenshots/screenshot1.png 25 | 26 | 27 | Multiple lifelines 28 | https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/master/data/resources/screenshots/screenshot2.png 29 | 30 | 31 | Winning the game 32 | https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/master/data/resources/screenshots/screenshot.jpg 33 | 34 | 35 | https://github.com/martinszeltins/who-wants-to-be-a-millionaire/ 36 | https://github.com/martinszeltins/who-wants-to-be-a-millionaire/issues 37 | https://github.com/martinszeltins/who-wants-to-be-a-millionaire/ 38 | 39 | 40 | 41 |

The very first release of Who Wants To Be a Millionaire.

42 |
43 |
44 |
45 |
46 | -------------------------------------------------------------------------------- /data/lv.martinsz.millionaire.desktop.in: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=Who Wants To Be a Millionaire 3 | Exec=millionaire 4 | Icon=lv.martinsz.millionaire 5 | Terminal=false 6 | Type=Application 7 | Categories=Game; 8 | Keywords=Millionaire;Game;GNOME;GTK; 9 | StartupNotify=true 10 | -------------------------------------------------------------------------------- /data/lv.martinsz.millionaire.gschema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /data/meson.build: -------------------------------------------------------------------------------- 1 | desktop_file = i18n.merge_file( 2 | input: 'lv.martinsz.millionaire.desktop.in', 3 | output: 'lv.martinsz.millionaire.desktop', 4 | type: 'desktop', 5 | po_dir: '../po', 6 | install: true, 7 | install_dir: join_paths(get_option('datadir'), 'applications') 8 | ) 9 | 10 | desktop_utils = find_program('desktop-file-validate', required: false) 11 | if desktop_utils.found() 12 | test('Validate desktop file', desktop_utils, args: [desktop_file]) 13 | endif 14 | 15 | appstream_file = i18n.merge_file( 16 | input: 'lv.martinsz.millionaire.appdata.xml.in', 17 | output: 'lv.martinsz.millionaire.appdata.xml', 18 | po_dir: '../po', 19 | install: true, 20 | install_dir: join_paths(get_option('datadir'), 'appdata') 21 | ) 22 | 23 | appstream_util = find_program('appstream-util', required: false) 24 | if appstream_util.found() 25 | test('Validate appstream file', appstream_util, args: ['validate', appstream_file]) 26 | endif 27 | 28 | install_data('lv.martinsz.millionaire.gschema.xml', 29 | install_dir: join_paths(get_option('datadir'), 'glib-2.0/schemas') 30 | ) 31 | 32 | compile_schemas = find_program('glib-compile-schemas', required: false) 33 | if compile_schemas.found() 34 | test('Validate schema file', 35 | compile_schemas, 36 | args: ['--strict', '--dry-run', meson.current_source_dir()]) 37 | endif 38 | 39 | subdir('icons') 40 | subdir('resources') 41 | -------------------------------------------------------------------------------- /data/resources/img/answer-a-default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-a-default.png -------------------------------------------------------------------------------- /data/resources/img/answer-a-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-a-green.png -------------------------------------------------------------------------------- /data/resources/img/answer-a-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-a-red.png -------------------------------------------------------------------------------- /data/resources/img/answer-a-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-a-yellow.png -------------------------------------------------------------------------------- /data/resources/img/answer-b-default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-b-default.png -------------------------------------------------------------------------------- /data/resources/img/answer-b-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-b-green.png -------------------------------------------------------------------------------- /data/resources/img/answer-b-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-b-red.png -------------------------------------------------------------------------------- /data/resources/img/answer-b-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-b-yellow.png -------------------------------------------------------------------------------- /data/resources/img/answer-c-default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-c-default.png -------------------------------------------------------------------------------- /data/resources/img/answer-c-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-c-green.png -------------------------------------------------------------------------------- /data/resources/img/answer-c-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-c-red.png -------------------------------------------------------------------------------- /data/resources/img/answer-c-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-c-yellow.png -------------------------------------------------------------------------------- /data/resources/img/answer-d-default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-d-default.png -------------------------------------------------------------------------------- /data/resources/img/answer-d-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-d-green.png -------------------------------------------------------------------------------- /data/resources/img/answer-d-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-d-red.png -------------------------------------------------------------------------------- /data/resources/img/answer-d-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/answer-d-yellow.png -------------------------------------------------------------------------------- /data/resources/img/bg-sparks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/bg-sparks.png -------------------------------------------------------------------------------- /data/resources/img/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/bg.png -------------------------------------------------------------------------------- /data/resources/img/btn-50-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/btn-50-50.png -------------------------------------------------------------------------------- /data/resources/img/btn-audience.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/btn-audience.png -------------------------------------------------------------------------------- /data/resources/img/btn-call.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/btn-call.png -------------------------------------------------------------------------------- /data/resources/img/info-box-highlighted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/info-box-highlighted.png -------------------------------------------------------------------------------- /data/resources/img/info-box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/info-box.png -------------------------------------------------------------------------------- /data/resources/img/lifeline-answer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/img/lifeline-answer.png -------------------------------------------------------------------------------- /data/resources/meson.build: -------------------------------------------------------------------------------- 1 | # Generate UI files from blueprint files. 2 | blueprints = custom_target('blueprints', 3 | input: files( 4 | 'ui/millionaire-window.blp', 5 | ), 6 | output: '.', 7 | command: [find_program('blueprint-compiler'), 'batch-compile', '@OUTPUT@', '@CURRENT_SOURCE_DIR@', '@INPUT@'], 8 | ) 9 | 10 | millionaire_resources += gnome.compile_resources('millionaire-resources', 11 | 'millionaire.gresource.xml', 12 | dependencies: blueprints, 13 | c_name: 'millionaire', 14 | ) 15 | -------------------------------------------------------------------------------- /data/resources/millionaire.gresource.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ui/millionaire-window.ui 5 | img/answer-a-default.png 6 | img/answer-a-green.png 7 | img/answer-a-red.png 8 | img/answer-a-yellow.png 9 | img/bg.png 10 | style.css 11 | img/btn-call.png 12 | img/info-box.png 13 | img/bg-sparks.png 14 | img/btn-50-50.png 15 | img/answer-c-red.png 16 | img/answer-b-red.png 17 | img/answer-d-red.png 18 | img/btn-audience.png 19 | img/answer-b-green.png 20 | img/answer-c-green.png 21 | img/answer-d-green.png 22 | img/lifeline-answer.png 23 | img/answer-c-yellow.png 24 | img/answer-b-yellow.png 25 | img/answer-d-yellow.png 26 | img/answer-d-default.png 27 | img/answer-c-default.png 28 | img/answer-b-default.png 29 | img/info-box-highlighted.png 30 | 31 | 32 | -------------------------------------------------------------------------------- /data/resources/screenshots/screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/screenshots/screenshot.jpg -------------------------------------------------------------------------------- /data/resources/screenshots/screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/screenshots/screenshot1.png -------------------------------------------------------------------------------- /data/resources/screenshots/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/data/resources/screenshots/screenshot2.png -------------------------------------------------------------------------------- /data/resources/style.css: -------------------------------------------------------------------------------- 1 | window { 2 | background-color: #000000; 3 | background-image: url("img/bg.png"); 4 | background-repeat: no-repeat; 5 | } 6 | 7 | .bg-sparks { 8 | background-image: url("img/bg-sparks.png"); 9 | } 10 | 11 | .lbl-info { 12 | background-image: url("img/info-box.png"); 13 | min-width: 1005px; 14 | min-height: 98px; 15 | padding: 0; 16 | font-size: 30px; 17 | } 18 | 19 | .lbl-info.highlight { 20 | background-image: url("img/info-box-highlighted.png"); 21 | } 22 | 23 | .lbl-lifeline-answer { 24 | background-image: url("img/lifeline-answer.png"); 25 | min-width: 337px; 26 | min-height: 157px; 27 | padding: 0; 28 | font-size: 20px; 29 | } 30 | 31 | /* Lifeline buttons */ 32 | .btn-lifeline { 33 | background-color: transparent; 34 | min-width: 101px; 35 | min-height: 61px; 36 | padding: 0; 37 | background-repeat: no-repeat; 38 | } 39 | 40 | .btn-lifeline:hover { 41 | filter: brightness(1.1); 42 | } 43 | 44 | .btn-lifeline:hover:active { 45 | filter: brightness(0.9); 46 | } 47 | 48 | .btn-lifeline-fifty-fifty { 49 | background-image: url("img/btn-50-50.png"); 50 | } 51 | 52 | .btn-lifeline-call { 53 | background-image: url("img/btn-call.png"); 54 | } 55 | 56 | .btn-lifeline-audience { 57 | background-image: url("img/btn-audience.png"); 58 | } 59 | 60 | /* Money */ 61 | .lbl-money { 62 | font-size: 40px; 63 | font-weight: bold; 64 | min-width: 210px; 65 | } 66 | 67 | /* Question */ 68 | .question { 69 | font-size: 24px; 70 | min-height: 90px; 71 | min-width: 1100px; 72 | } 73 | 74 | /* Answer buttons */ 75 | .btn-answer { 76 | background-color: transparent; 77 | min-width: 592px; 78 | min-height: 60px; 79 | padding: 0px; 80 | } 81 | 82 | .btn-answer:hover:active:not(.btn-answer-pulse) { 83 | filter: brightness(0.9); 84 | } 85 | 86 | .btn-answer label { 87 | font-size: 20px; 88 | padding-left: 90px; 89 | opacity: 0.85; 90 | background-repeat: no-repeat; 91 | color: white; 92 | } 93 | 94 | .btn-answer-a { 95 | background-image: url("img/answer-a-default.png"); 96 | } 97 | 98 | .btn-answer-a:hover:not(.btn-answer-a-correct):not(.btn-answer-a-incorrect), 99 | .btn-answer-a.btn-answer-pulse { 100 | background-image: url("img/answer-a-yellow.png"); 101 | } 102 | 103 | .btn-answer-b { 104 | background-image: url("img/answer-b-default.png"); 105 | } 106 | 107 | .btn-answer-b:hover:not(.btn-answer-b-correct):not(.btn-answer-b-incorrect), 108 | .btn-answer-b.btn-answer-pulse { 109 | background-image: url("img/answer-b-yellow.png"); 110 | } 111 | 112 | .btn-answer-c { 113 | background-image: url("img/answer-c-default.png"); 114 | } 115 | 116 | .btn-answer-c:hover:not(.btn-answer-c-correct):not(.btn-answer-c-incorrect), 117 | .btn-answer-c.btn-answer-pulse { 118 | background-image: url("img/answer-c-yellow.png"); 119 | } 120 | 121 | .btn-answer-d { 122 | background-image: url("img/answer-d-default.png"); 123 | } 124 | 125 | .btn-answer-d:hover:not(.btn-answer-d-correct):not(.btn-answer-d-incorrect), 126 | .btn-answer-d.btn-answer-pulse { 127 | background-image: url("img/answer-d-yellow.png"); 128 | } 129 | 130 | .btn-answer-a-correct { 131 | background-image: url("img/answer-a-green.png"); 132 | } 133 | 134 | .btn-answer-b-correct { 135 | background-image: url("img/answer-b-green.png"); 136 | } 137 | 138 | .btn-answer-c-correct { 139 | background-image: url("img/answer-c-green.png"); 140 | } 141 | 142 | .btn-answer-d-correct { 143 | background-image: url("img/answer-d-green.png"); 144 | } 145 | 146 | .btn-answer-a-incorrect { 147 | background-image: url("img/answer-a-red.png"); 148 | } 149 | 150 | .btn-answer-b-incorrect { 151 | background-image: url("img/answer-b-red.png"); 152 | } 153 | 154 | .btn-answer-c-incorrect { 155 | background-image: url("img/answer-c-red.png"); 156 | } 157 | 158 | .btn-answer-d-incorrect { 159 | background-image: url("img/answer-d-red.png"); 160 | } 161 | 162 | .btn-answer-pulse { 163 | animation-name: answer-pulse; 164 | animation-duration: 0.9s; 165 | animation-iteration-count: infinite; 166 | } 167 | 168 | @keyframes answer-pulse { 169 | 0% { 170 | filter: brightness(1); 171 | } 172 | 173 | 50% { 174 | filter: brightness(0.7); 175 | } 176 | 177 | 100% { 178 | filter: brightness(1); 179 | } 180 | } 181 | -------------------------------------------------------------------------------- /data/resources/ui/millionaire-window.blp: -------------------------------------------------------------------------------- 1 | using Gtk 4.0; 2 | using Adw 1; 3 | 4 | template MillionaireWindow : Adw.ApplicationWindow { 5 | default-width: 1298; 6 | default-height: 720; 7 | title: "Who Wants to Be a Millionaire?"; 8 | icon-name: "lv.martinsz.millionaire"; 9 | 10 | Box { 11 | orientation: vertical; 12 | 13 | HeaderBar { } 14 | 15 | Fixed { 16 | Label lbl_money { 17 | label: "$1,000,000"; 18 | xalign: 1; 19 | styles ["lbl-money"] 20 | 21 | layout { 22 | transform: "translate(1020, 45)"; 23 | } 24 | } 25 | 26 | Label lbl_lifeline_answer { 27 | label: "It's definitely a heart murmur.\n Just kidding, I think derma\n means skin."; 28 | justify: center; 29 | visible: false; 30 | styles ["lbl-lifeline-answer"] 31 | 32 | layout { 33 | transform: "translate(82, 127)"; 34 | } 35 | } 36 | 37 | Label lbl_info { 38 | label: "Congratulations! You have won $1 million, don't spend it all at once."; 39 | justify: center; 40 | visible: false; 41 | styles ["lbl-info"] 42 | 43 | layout { 44 | transform: "translate(150, 200)"; 45 | } 46 | } 47 | 48 | Button btn_fifty_fifty { 49 | can-focus: false; 50 | 51 | styles ["btn-lifeline", "btn-lifeline-fifty-fifty"] 52 | 53 | layout { 54 | transform: "translate(80, 40)"; 55 | } 56 | } 57 | 58 | Button btn_call { 59 | can-focus: false; 60 | 61 | styles ["btn-lifeline", "btn-lifeline-call"] 62 | 63 | layout { 64 | transform: "translate(200, 40)"; 65 | } 66 | } 67 | 68 | Button btn_audience { 69 | can-focus: false; 70 | 71 | styles ["btn-lifeline", "btn-lifeline-audience"] 72 | 73 | layout { 74 | transform: "translate(320, 40)"; 75 | } 76 | } 77 | 78 | Label lbl_question { 79 | label: "What name is given to the revolving belt machinery in an airport that delivers checked luggage \n from the plane to baggage reclaim?"; 80 | justify: center; 81 | styles ["question"] 82 | 83 | layout { 84 | transform: "translate(100, 424)"; 85 | } 86 | } 87 | 88 | Button btn_answer_a { 89 | can-focus: false; 90 | 91 | Label lbl_answer_a { 92 | halign: start; 93 | label: "This will be the first answer - A"; 94 | } 95 | 96 | styles ["btn-answer", "btn-answer-a"] 97 | 98 | layout { 99 | transform: "translate(62, 526)"; 100 | } 101 | } 102 | 103 | Button btn_answer_b { 104 | can-focus: false; 105 | 106 | Label lbl_answer_b { 107 | halign: start; 108 | label: "This will be the second answer - B"; 109 | } 110 | 111 | styles ["btn-answer", "btn-answer-b"] 112 | 113 | layout { 114 | transform: "translate(654, 526)"; 115 | } 116 | } 117 | 118 | Button btn_answer_c { 119 | can-focus: false; 120 | 121 | Label lbl_answer_c { 122 | halign: start; 123 | label: "This will be the third answer - C"; 124 | } 125 | 126 | styles ["btn-answer", "btn-answer-c"] 127 | 128 | layout { 129 | transform: "translate(62, 594)"; 130 | } 131 | } 132 | 133 | Button btn_answer_d { 134 | can-focus: false; 135 | 136 | Label lbl_answer_d { 137 | halign: start; 138 | label: "This will be the fourth answer - D"; 139 | } 140 | 141 | styles ["btn-answer", "btn-answer-d"] 142 | 143 | layout { 144 | transform: "translate(654, 594)"; 145 | } 146 | } 147 | } 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /lv.martinsz.millionaire.json: -------------------------------------------------------------------------------- 1 | { 2 | "app-id" : "lv.martinsz.millionaire", 3 | "runtime" : "org.gnome.Platform", 4 | "runtime-version" : "46", 5 | "sdk" : "org.gnome.Sdk", 6 | "command" : "millionaire", 7 | "finish-args" : [ 8 | "--share=network", 9 | "--share=ipc", 10 | "--socket=fallback-x11", 11 | "--device=dri", 12 | "--socket=wayland" 13 | ], 14 | "modules" : [ 15 | { 16 | "name" : "blueprint", 17 | "buildsystem" : "meson", 18 | "cleanup": [ "*" ], 19 | "sources" : [ 20 | { 21 | "type" : "git", 22 | "url" : "https://gitlab.gnome.org/jwestman/blueprint-compiler.git", 23 | "tag" : "v0.4.0" 24 | } 25 | ] 26 | }, 27 | { 28 | "name" : "millionaire", 29 | "buildsystem" : "meson", 30 | "sources" : [ 31 | { 32 | "type" : "git", 33 | "url" : "https://github.com/martinszeltins/who-wants-to-be-a-millionaire", 34 | "tag" : "v1.0.2", 35 | "commit" : "032e0762f0cb3d2e1bf09d27af18999c71d40d56" 36 | } 37 | ] 38 | } 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /meson.build: -------------------------------------------------------------------------------- 1 | project('millionaire', 'c', 2 | version: '0.1.0', 3 | meson_version: '>= 0.59.0', 4 | default_options: [ 'warning_level=2', 'werror=false', 'c_std=gnu11', ], 5 | ) 6 | 7 | millionaire_resources = [] 8 | i18n = import('i18n') 9 | gnome = import('gnome') 10 | cc = meson.get_compiler('c') 11 | 12 | config_h = configuration_data() 13 | config_h.set_quoted('PACKAGE_VERSION', meson.project_version()) 14 | config_h.set_quoted('GETTEXT_PACKAGE', 'millionaire') 15 | config_h.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) 16 | configure_file(output: 'config.h', configuration: config_h) 17 | add_project_arguments(['-I' + meson.project_build_root()], language: 'c') 18 | 19 | project_c_args = [] 20 | test_c_args = [ 21 | '-Wcast-align', 22 | '-Wdeclaration-after-statement', 23 | '-Werror=address', 24 | '-Werror=array-bounds', 25 | '-Werror=empty-body', 26 | '-Werror=implicit', 27 | '-Werror=implicit-function-declaration', 28 | '-Werror=incompatible-pointer-types', 29 | '-Werror=init-self', 30 | '-Werror=int-conversion', 31 | '-Werror=int-to-pointer-cast', 32 | '-Werror=main', 33 | '-Werror=misleading-indentation', 34 | '-Werror=missing-braces', 35 | '-Werror=missing-include-dirs', 36 | '-Werror=nonnull', 37 | '-Werror=overflow', 38 | '-Werror=parenthesis', 39 | '-Werror=pointer-arith', 40 | '-Werror=pointer-to-int-cast', 41 | '-Werror=redundant-decls', 42 | '-Werror=return-type', 43 | '-Werror=sequence-point', 44 | '-Werror=shadow', 45 | '-Werror=strict-prototypes', 46 | '-Werror=trigraphs', 47 | '-Werror=undef', 48 | '-Werror=write-strings', 49 | '-Wformat-nonliteral', 50 | '-Wignored-qualifiers', 51 | '-Wimplicit-function-declaration', 52 | '-Wlogical-op', 53 | '-Wmissing-declarations', 54 | '-Wmissing-format-attribute', 55 | '-Wmissing-include-dirs', 56 | '-Wmissing-noreturn', 57 | '-Wnested-externs', 58 | '-Wno-cast-function-type', 59 | '-Wno-dangling-pointer', 60 | '-Wno-missing-field-initializers', 61 | '-Wno-sign-compare', 62 | '-Wno-unused-parameter', 63 | '-Wold-style-definition', 64 | '-Wpointer-arith', 65 | '-Wredundant-decls', 66 | '-Wstrict-prototypes', 67 | '-Wswitch-default', 68 | '-Wswitch-enum', 69 | '-Wundef', 70 | '-Wuninitialized', 71 | '-Wunused', 72 | '-fno-strict-aliasing', 73 | ['-Werror=format-security', '-Werror=format=2'], 74 | ] 75 | if get_option('buildtype') != 'plain' 76 | test_c_args += '-fstack-protector-strong' 77 | endif 78 | foreach arg: test_c_args 79 | if cc.has_multi_arguments(arg) 80 | project_c_args += arg 81 | endif 82 | endforeach 83 | add_project_arguments(project_c_args, language: 'c') 84 | 85 | subdir('data') 86 | subdir('src') 87 | subdir('po') 88 | 89 | gnome.post_install( 90 | glib_compile_schemas: true, 91 | gtk_update_icon_cache: true, 92 | update_desktop_database: true, 93 | ) 94 | -------------------------------------------------------------------------------- /po/LINGUAS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/po/LINGUAS -------------------------------------------------------------------------------- /po/POTFILES: -------------------------------------------------------------------------------- 1 | data/lv.martinsz.millionaire.desktop.in 2 | data/lv.martinsz.millionaire.appdata.xml.in 3 | data/lv.martinsz.millionaire.gschema.xml 4 | src/main.c 5 | src/millionaire-window.c 6 | src/millionaire-window.ui 7 | -------------------------------------------------------------------------------- /po/meson.build: -------------------------------------------------------------------------------- 1 | i18n.gettext('millionaire', preset: 'glib') 2 | -------------------------------------------------------------------------------- /screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/martinszeltins/who-wants-to-be-a-millionaire/26fd16b73a6482ab3f41cb7bc078d7248b13bf8e/screenshot.jpg -------------------------------------------------------------------------------- /src/include/millionaire-application.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | G_BEGIN_DECLS 6 | 7 | #define MILLIONAIRE_TYPE_APPLICATION (millionaire_application_get_type()) 8 | 9 | G_DECLARE_FINAL_TYPE (MillionaireApplication, millionaire_application, MILLIONAIRE, APPLICATION, AdwApplication) 10 | 11 | MillionaireApplication * millionaire_application_new (const char * application_id, GApplicationFlags flags); 12 | void millionaire_application_add_css_stylesheet (void); 13 | void millionaire_application_force_dark_scheme (void); 14 | 15 | G_END_DECLS 16 | -------------------------------------------------------------------------------- /src/include/millionaire-questions.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "include/millionaire-window.h" 4 | 5 | G_BEGIN_DECLS 6 | 7 | struct question * millionaire_questions_get(void); 8 | 9 | G_END_DECLS 10 | -------------------------------------------------------------------------------- /src/include/millionaire-window.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | G_BEGIN_DECLS 6 | 7 | #define MILLIONAIRE_TYPE_WINDOW (millionaire_window_get_type()) 8 | 9 | G_DECLARE_FINAL_TYPE (MillionaireWindow, millionaire_window, MILLIONAIRE, WINDOW, AdwApplicationWindow) 10 | 11 | /* Questions and their associated answers, money and lifelines */ 12 | struct question { 13 | gchar question[255]; 14 | gchar answers[4][255]; 15 | gchar correct_answer[1]; 16 | gchar money_earned_if_answered[255]; 17 | gchar lifeline_fifty_fifty_hide[2][1]; 18 | gchar lifeline_call_answer[255]; 19 | gchar lifeline_audience_answer[255]; 20 | }; 21 | 22 | void millionaire_window_create_and_show (GApplication * app); 23 | void millionaire_window_gameplay_start (MillionaireWindow * window); 24 | void millionaire_window_gameplay_answer (GtkWidget * widget, gpointer data); 25 | gboolean millionaire_window_gameplay_answer_check(gpointer user_data); 26 | gboolean millionaire_window_gameplay_answer_correct(gpointer user_data); 27 | gboolean millionaire_window_gameplay_answer_incorrect(gpointer user_data); 28 | void millionaire_window_gameplay_lifeline_call(GtkWidget * widget, MillionaireWindow * window); 29 | void millionaire_window_gameplay_lifeline_audience(GtkWidget * widget, MillionaireWindow * window); 30 | void millionaire_window_gameplay_lifeline_fifty_fifty(GtkWidget * widget, MillionaireWindow * window); 31 | gboolean millionaire_window_gameplay_win_game(gpointer user_data); 32 | 33 | G_END_DECLS 34 | -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | #include "include/millionaire-application.h" 2 | 3 | int main (int argc, char * argv[]) 4 | { 5 | g_autoptr(MillionaireApplication) app = NULL; 6 | 7 | app = millionaire_application_new ("lv.martinsz.millionaire", G_APPLICATION_DEFAULT_FLAGS); 8 | g_application_run (G_APPLICATION (app), argc, argv); 9 | } 10 | -------------------------------------------------------------------------------- /src/meson.build: -------------------------------------------------------------------------------- 1 | millionaire_deps = [ 2 | dependency('gtk4'), 3 | dependency('libadwaita-1'), 4 | ] 5 | 6 | millionaire_sources = millionaire_resources 7 | millionaire_sources += [ 8 | 'main.c', 9 | 'millionaire-window.c', 10 | 'millionaire-questions.c', 11 | 'millionaire-application.c', 12 | ] 13 | 14 | exec = executable('millionaire', 15 | millionaire_sources, 16 | dependencies: millionaire_deps, 17 | install: true, 18 | ) 19 | -------------------------------------------------------------------------------- /src/millionaire-application.c: -------------------------------------------------------------------------------- 1 | #include "include/millionaire-window.h" 2 | #include "include/millionaire-application.h" 3 | 4 | struct _MillionaireApplication 5 | { 6 | AdwApplication parent_instance; 7 | }; 8 | 9 | G_DEFINE_TYPE (MillionaireApplication, millionaire_application, ADW_TYPE_APPLICATION) 10 | 11 | MillionaireApplication * millionaire_application_new (const char * application_id, GApplicationFlags flags) 12 | { 13 | return g_object_new (MILLIONAIRE_TYPE_APPLICATION, "application-id", application_id, "flags", flags, NULL); 14 | } 15 | 16 | static void millionaire_application_activate (GApplication * app) 17 | { 18 | millionaire_application_force_dark_scheme(); 19 | millionaire_application_add_css_stylesheet(); 20 | millionaire_window_create_and_show(app); 21 | } 22 | 23 | static void millionaire_application_class_init (MillionaireApplicationClass * klass) 24 | { 25 | GApplicationClass * app_class = G_APPLICATION_CLASS (klass); 26 | 27 | app_class->activate = millionaire_application_activate; 28 | } 29 | 30 | static void millionaire_application_quit_action (GSimpleAction * action, GVariant * parameter, gpointer user_data) 31 | { 32 | MillionaireApplication * self = user_data; 33 | 34 | g_application_quit (G_APPLICATION (self)); 35 | } 36 | 37 | static void millionaire_application_init (MillionaireApplication * self) 38 | { 39 | static const GActionEntry app_actions[] = { 40 | { "quit", millionaire_application_quit_action }, 41 | }; 42 | 43 | g_action_map_add_action_entries (G_ACTION_MAP (self), app_actions, G_N_ELEMENTS (app_actions), self); 44 | gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.quit", (const char *[]) { "q", NULL }); 45 | } 46 | 47 | void millionaire_application_add_css_stylesheet () 48 | { 49 | GtkCssProvider * css_provider = gtk_css_provider_new (); 50 | 51 | gtk_css_provider_load_from_resource (css_provider, "/lv/martinsz/millionaire/style.css"); 52 | gtk_style_context_add_provider_for_display(gdk_display_get_default(), GTK_STYLE_PROVIDER(css_provider), GTK_STYLE_PROVIDER_PRIORITY_USER); 53 | } 54 | 55 | void millionaire_application_force_dark_scheme () 56 | { 57 | AdwStyleManager * style_manager = adw_style_manager_get_default (); 58 | adw_style_manager_set_color_scheme (style_manager, ADW_COLOR_SCHEME_FORCE_DARK); 59 | } 60 | -------------------------------------------------------------------------------- /src/millionaire-questions.c: -------------------------------------------------------------------------------- 1 | #include "include/millionaire-questions.h" 2 | 3 | struct question * millionaire_questions_get() 4 | { 5 | struct question * questions = malloc(10 * sizeof(struct question)); 6 | 7 | strcpy(questions[0].question, "Which of these names is not in the title of a Shakespeare play?"); 8 | strcpy(questions[0].answers[0], "Hamlet"); 9 | strcpy(questions[0].answers[1], "Romeo"); 10 | strcpy(questions[0].answers[2], "Macbeth"); 11 | strcpy(questions[0].answers[3], "Darren"); 12 | strcpy(questions[0].correct_answer, "D"); 13 | strcpy(questions[0].money_earned_if_answered, "$100,000"); 14 | strcpy(questions[0].lifeline_fifty_fifty_hide[0], "A"); 15 | strcpy(questions[0].lifeline_fifty_fifty_hide[1], "B"); 16 | strcpy(questions[0].lifeline_call_answer, "I know that Hamlet and Romeo\n are but Darren looks like\n it could be the one that is not."); 17 | strcpy(questions[0].lifeline_audience_answer, "The audience has voted:\nA: 2%\nB: 7%\nC: 38%\nD: 53%"); 18 | 19 | strcpy(questions[1].question, "What sort of animal is Walt Disney's Dumbo?"); 20 | strcpy(questions[1].answers[0], "Deer"); 21 | strcpy(questions[1].answers[1], "Rabbit"); 22 | strcpy(questions[1].answers[2], "Elephant"); 23 | strcpy(questions[1].answers[3], "Donkey"); 24 | strcpy(questions[1].correct_answer, "C"); 25 | strcpy(questions[1].money_earned_if_answered, "$200,000"); 26 | strcpy(questions[1].lifeline_fifty_fifty_hide[0], "A"); 27 | strcpy(questions[1].lifeline_fifty_fifty_hide[1], "D"); 28 | strcpy(questions[1].lifeline_call_answer, "Dumbo was the Elephant,\n wasn't it?"); 29 | strcpy(questions[1].lifeline_audience_answer, "The audience has voted:\nA: 7%\nB: 3%\nC: 80%\nD: 10%"); 30 | 31 | strcpy(questions[2].question, "What does the word loquacious mean?"); 32 | strcpy(questions[2].answers[0], "Angry"); 33 | strcpy(questions[2].answers[1], "Chatty"); 34 | strcpy(questions[2].answers[2], "Beautiful"); 35 | strcpy(questions[2].answers[3], "Shy"); 36 | strcpy(questions[2].correct_answer, "B"); 37 | strcpy(questions[2].money_earned_if_answered, "$300,000"); 38 | strcpy(questions[2].lifeline_fifty_fifty_hide[0], "C"); 39 | strcpy(questions[2].lifeline_fifty_fifty_hide[1], "D"); 40 | strcpy(questions[2].lifeline_call_answer, "Hmm, I don't know... But\n if I had to guess I would\n say chatty."); 41 | strcpy(questions[2].lifeline_audience_answer, "The audience has voted:\nA: 3%\nB: 87%\nC: 4%\nD: 6%"); 42 | 43 | strcpy(questions[3].question, "The Ancient Incan Ruins Of Machu Picchu Are In Which Country?"); 44 | strcpy(questions[3].answers[0], "Peru"); 45 | strcpy(questions[3].answers[1], "Argentina"); 46 | strcpy(questions[3].answers[2], "Chile"); 47 | strcpy(questions[3].answers[3], "Mexico"); 48 | strcpy(questions[3].correct_answer, "A"); 49 | strcpy(questions[3].money_earned_if_answered, "$400,000"); 50 | strcpy(questions[3].lifeline_fifty_fifty_hide[0], "C"); 51 | strcpy(questions[3].lifeline_fifty_fifty_hide[1], "D"); 52 | strcpy(questions[3].lifeline_call_answer, "I saw this on Discovery channel\n - it's in Peru."); 53 | strcpy(questions[3].lifeline_audience_answer, "The audience has voted:\nA: 51%\nB: 30%\nC: 13%\nD: 21%"); 54 | 55 | strcpy(questions[4].question, "Construction of which of these famous landmarks was completed first?"); 56 | strcpy(questions[4].answers[0], "Empire State Building"); 57 | strcpy(questions[4].answers[1], "Royal Albert Hall"); 58 | strcpy(questions[4].answers[2], "Eiffel Tower"); 59 | strcpy(questions[4].answers[3], "Big Ben Clock Tower"); 60 | strcpy(questions[4].correct_answer, "D"); 61 | strcpy(questions[4].money_earned_if_answered, "$500,000"); 62 | strcpy(questions[4].lifeline_fifty_fifty_hide[0], "A"); 63 | strcpy(questions[4].lifeline_fifty_fifty_hide[1], "B"); 64 | strcpy(questions[4].lifeline_call_answer, "To be honest, I really don't know.\n My wild guess is the Eiffel Tower."); 65 | strcpy(questions[4].lifeline_audience_answer, "The audience has voted:\nA: 9%\nB: 7%\nC: 24%\nD: 62%"); 66 | 67 | strcpy(questions[5].question, "What is the Celsius equivalent of 77 degrees Fahrenheit?"); 68 | strcpy(questions[5].answers[0], "15"); 69 | strcpy(questions[5].answers[1], "20"); 70 | strcpy(questions[5].answers[2], "25"); 71 | strcpy(questions[5].answers[3], "30"); 72 | strcpy(questions[5].correct_answer, "C"); 73 | strcpy(questions[5].money_earned_if_answered, "$600,000"); 74 | strcpy(questions[5].lifeline_fifty_fifty_hide[0], "D"); 75 | strcpy(questions[5].lifeline_fifty_fifty_hide[1], "B"); 76 | strcpy(questions[5].lifeline_call_answer, "I think that 100 F is about 30 in\n celsius. So I will say 15."); 77 | strcpy(questions[5].lifeline_audience_answer, "The audience has voted:\nA: 11%\nB: 21%\nC: 59%\nD: 9%"); 78 | 79 | strcpy(questions[6].question, "The word \"aristocracy\" literally means power in the hands of whom?"); 80 | strcpy(questions[6].answers[0], "The few"); 81 | strcpy(questions[6].answers[1], "The best"); 82 | strcpy(questions[6].answers[2], "The barons"); 83 | strcpy(questions[6].answers[3], "The rich"); 84 | strcpy(questions[6].correct_answer, "A"); 85 | strcpy(questions[6].money_earned_if_answered, "$700,000"); 86 | strcpy(questions[6].lifeline_fifty_fifty_hide[0], "B"); 87 | strcpy(questions[6].lifeline_fifty_fifty_hide[1], "C"); 88 | strcpy(questions[6].lifeline_call_answer, "I know it's not the best. I think\n it's the few or the rich."); 89 | strcpy(questions[6].lifeline_audience_answer, "The audience has voted:\nA: 85%\nB: 3%\nC: 27%\nD: 16%"); 90 | 91 | strcpy(questions[7].question, "A sports team playing in its own arena is said to have what type of advantage?"); 92 | strcpy(questions[7].answers[0], "Homecoming"); 93 | strcpy(questions[7].answers[1], "Home depot"); 94 | strcpy(questions[7].answers[2], "Home court"); 95 | strcpy(questions[7].answers[3], "Home sweet home"); 96 | strcpy(questions[7].correct_answer, "C"); 97 | strcpy(questions[7].money_earned_if_answered, "$800,000"); 98 | strcpy(questions[7].lifeline_fifty_fifty_hide[0], "D"); 99 | strcpy(questions[7].lifeline_fifty_fifty_hide[1], "A"); 100 | strcpy(questions[7].lifeline_call_answer, "I'm pretty sure it's home court."); 101 | strcpy(questions[7].lifeline_audience_answer, "The audience has voted:\nA: 1%\nB: 0%\nC: 99%\nD: 0%"); 102 | 103 | strcpy(questions[8].question, "In which of these games do players use a paddle to hit the ball?"); 104 | strcpy(questions[8].answers[0], "Ping-Pong"); 105 | strcpy(questions[8].answers[1], "Water polo"); 106 | strcpy(questions[8].answers[2], "Shuffleboard"); 107 | strcpy(questions[8].answers[3], "Football"); 108 | strcpy(questions[8].correct_answer, "A"); 109 | strcpy(questions[8].money_earned_if_answered, "$900,000"); 110 | strcpy(questions[8].lifeline_fifty_fifty_hide[0], "B"); 111 | strcpy(questions[8].lifeline_fifty_fifty_hide[1], "D"); 112 | strcpy(questions[8].lifeline_call_answer, "I don't know what Shuffleboard\n is but that would be my answer."); 113 | strcpy(questions[8].lifeline_audience_answer, "The audience has voted:\nA: 90%\nB: 2%\nC: 3%\nD: 5%"); 114 | 115 | strcpy(questions[9].question, "A dermatologist is best suited to treat which of these medical conditions?"); 116 | strcpy(questions[9].answers[0], "Headache"); 117 | strcpy(questions[9].answers[1], "Cavity"); 118 | strcpy(questions[9].answers[2], "Heart murmur"); 119 | strcpy(questions[9].answers[3], "Skin rash"); 120 | strcpy(questions[9].correct_answer, "D"); 121 | strcpy(questions[9].money_earned_if_answered, "$1,000,000"); 122 | strcpy(questions[9].lifeline_fifty_fifty_hide[0], "C"); 123 | strcpy(questions[9].lifeline_fifty_fifty_hide[1], "A"); 124 | strcpy(questions[9].lifeline_call_answer, "It's definitely a heart murmur.\n Just kidding, I think derma\n means skin."); 125 | strcpy(questions[9].lifeline_audience_answer, "The audience has voted:\nA: 19%\nB: 28%\nC: 14%\nD: 58%"); 126 | 127 | return questions; 128 | } 129 | -------------------------------------------------------------------------------- /src/millionaire-window.c: -------------------------------------------------------------------------------- 1 | #include "include/millionaire-window.h" 2 | #include "include/millionaire-questions.h" 3 | 4 | struct _MillionaireWindow 5 | { 6 | AdwApplicationWindow parent_instance; 7 | guint timer; 8 | guint timer_value; 9 | int current_question; 10 | struct question questions[10]; 11 | gboolean game_locked; 12 | GtkLabel * lbl_money; 13 | GtkButton * btn_fifty_fifty; 14 | GtkButton * btn_call; 15 | GtkButton * btn_audience; 16 | GtkLabel * lbl_question; 17 | GtkButton * btn_answer_a; 18 | GtkButton * btn_answer_b; 19 | GtkButton * btn_answer_c; 20 | GtkButton * btn_answer_d; 21 | GtkLabel * lbl_answer_a; 22 | GtkLabel * lbl_answer_b; 23 | GtkLabel * lbl_answer_c; 24 | GtkLabel * lbl_answer_d; 25 | GtkLabel * lbl_lifeline_answer; 26 | GtkLabel * lbl_info; 27 | }; 28 | 29 | struct ParamBtnAnswer { 30 | MillionaireWindow * window; 31 | GtkWidget * widget; 32 | gchar answer[1]; 33 | }; 34 | 35 | GApplication * app_instance; 36 | 37 | G_DEFINE_FINAL_TYPE (MillionaireWindow, millionaire_window, ADW_TYPE_APPLICATION_WINDOW) 38 | 39 | static void millionaire_window_class_init (MillionaireWindowClass * klass) 40 | { 41 | GtkWidgetClass * widget_class = GTK_WIDGET_CLASS (klass); 42 | 43 | gtk_widget_class_set_template_from_resource (widget_class, "/lv/martinsz/millionaire/ui/millionaire-window.ui"); 44 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, lbl_money); 45 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, btn_fifty_fifty); 46 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, btn_call); 47 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, btn_audience); 48 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, lbl_question); 49 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, btn_answer_a); 50 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, btn_answer_b); 51 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, btn_answer_c); 52 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, btn_answer_d); 53 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, lbl_answer_a); 54 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, lbl_answer_b); 55 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, lbl_answer_c); 56 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, lbl_answer_d); 57 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, lbl_lifeline_answer); 58 | gtk_widget_class_bind_template_child (widget_class, MillionaireWindow, lbl_info); 59 | } 60 | 61 | static void millionaire_window_init (MillionaireWindow * self) 62 | { 63 | gtk_widget_init_template (GTK_WIDGET (self)); 64 | 65 | // Answer A clicked 66 | struct ParamBtnAnswer * param_answer_a = malloc(sizeof(struct ParamBtnAnswer)); 67 | param_answer_a->window = self; 68 | param_answer_a->widget = GTK_WIDGET(self->btn_answer_a); 69 | strcpy(param_answer_a->answer, "A"); 70 | g_signal_connect(self->btn_answer_a, "clicked", G_CALLBACK(millionaire_window_gameplay_answer), param_answer_a); 71 | 72 | // Answer B clicked 73 | struct ParamBtnAnswer * param_answer_b = malloc(sizeof(struct ParamBtnAnswer)); 74 | param_answer_b->window = self; 75 | param_answer_b->widget = GTK_WIDGET(self->btn_answer_b); 76 | strcpy(param_answer_b->answer, "B"); 77 | g_signal_connect(self->btn_answer_b, "clicked", G_CALLBACK(millionaire_window_gameplay_answer), param_answer_b); 78 | 79 | // Answer C clicked 80 | struct ParamBtnAnswer * param_answer_c = malloc(sizeof(struct ParamBtnAnswer)); 81 | param_answer_c->window = self; 82 | param_answer_c->widget = GTK_WIDGET(self->btn_answer_c); 83 | strcpy(param_answer_c->answer, "C"); 84 | g_signal_connect(self->btn_answer_c, "clicked", G_CALLBACK(millionaire_window_gameplay_answer), param_answer_c); 85 | 86 | // Answer D clicked 87 | struct ParamBtnAnswer * param_answer_d = malloc(sizeof(struct ParamBtnAnswer)); 88 | param_answer_d->window = self; 89 | param_answer_d->widget = GTK_WIDGET(self->btn_answer_d); 90 | strcpy(param_answer_d->answer, "D"); 91 | g_signal_connect(self->btn_answer_d, "clicked", G_CALLBACK(millionaire_window_gameplay_answer), param_answer_d); 92 | 93 | // Lifeline - Call 94 | g_signal_connect(self->btn_call, "clicked", G_CALLBACK(millionaire_window_gameplay_lifeline_call), self); 95 | 96 | // Lifeline - Audience 97 | g_signal_connect(self->btn_audience, "clicked", G_CALLBACK(millionaire_window_gameplay_lifeline_audience), self); 98 | 99 | // Lifeline - 50 / 50 100 | g_signal_connect(self->btn_fifty_fifty, "clicked", G_CALLBACK(millionaire_window_gameplay_lifeline_fifty_fifty), self); 101 | 102 | millionaire_window_gameplay_start(self); 103 | } 104 | 105 | void millionaire_window_create_and_show (GApplication * app) 106 | { 107 | GtkWindow * window; 108 | 109 | app_instance = app; 110 | window = gtk_application_get_active_window (GTK_APPLICATION (app)); 111 | 112 | if (window == NULL) { 113 | window = g_object_new (MILLIONAIRE_TYPE_WINDOW, "application", app, NULL); 114 | } 115 | 116 | gtk_window_set_resizable(window, FALSE); 117 | gtk_window_present (window); 118 | } 119 | 120 | void millionaire_window_gameplay_start(MillionaireWindow * self) 121 | { 122 | self->timer = 0; 123 | self->current_question = 0; 124 | self->game_locked = FALSE; 125 | 126 | struct question * questions = millionaire_questions_get(); 127 | 128 | for (int i = 0; i < 10; i++) { 129 | self->questions[i] = questions[i]; 130 | } 131 | 132 | gtk_widget_set_visible(GTK_WIDGET(self->btn_fifty_fifty), TRUE); 133 | gtk_widget_set_visible(GTK_WIDGET(self->btn_call), TRUE); 134 | gtk_widget_set_visible(GTK_WIDGET(self->btn_audience), TRUE); 135 | 136 | gtk_label_set_text(self->lbl_money, "$0"); 137 | 138 | gtk_label_set_text(self->lbl_question, self->questions[self->current_question].question); 139 | gtk_label_set_text(self->lbl_answer_a, self->questions[self->current_question].answers[0]); 140 | gtk_label_set_text(self->lbl_answer_b, self->questions[self->current_question].answers[1]); 141 | gtk_label_set_text(self->lbl_answer_c, self->questions[self->current_question].answers[2]); 142 | gtk_label_set_text(self->lbl_answer_d, self->questions[self->current_question].answers[3]); 143 | } 144 | 145 | void millionaire_window_gameplay_answer(GtkWidget * widget, gpointer data) 146 | { 147 | struct ParamBtnAnswer * param_btn_answer = (struct ParamBtnAnswer *) data; 148 | 149 | MillionaireWindow * window = MILLIONAIRE_WINDOW(param_btn_answer->window); 150 | 151 | if (window->game_locked == TRUE) return; 152 | 153 | window->game_locked = TRUE; 154 | 155 | GtkStyleContext * context = gtk_widget_get_style_context(widget); 156 | gtk_style_context_add_class(context, "btn-answer-pulse"); 157 | 158 | window->timer = g_timeout_add(1500, millionaire_window_gameplay_answer_check, param_btn_answer); 159 | } 160 | 161 | gboolean millionaire_window_gameplay_answer_check(gpointer user_data) 162 | { 163 | struct ParamBtnAnswer * param_btn_answer = (struct ParamBtnAnswer *) user_data; 164 | 165 | MillionaireWindow * window = MILLIONAIRE_WINDOW(param_btn_answer->window); 166 | GtkStyleContext * context = gtk_widget_get_style_context(param_btn_answer->widget); 167 | 168 | // Stop the timer 169 | g_source_remove(window->timer); 170 | window->timer = 0; 171 | 172 | gtk_style_context_remove_class(context, "btn-answer-pulse"); 173 | 174 | if (param_btn_answer->answer[0] == window->questions[window->current_question].correct_answer[0]) { 175 | if (param_btn_answer->answer[0] == 'A') { 176 | gtk_style_context_add_class(context, "btn-answer-a-correct"); 177 | } else if (param_btn_answer->answer[0] == 'B') { 178 | gtk_style_context_add_class(context, "btn-answer-b-correct"); 179 | } else if (param_btn_answer->answer[0] == 'C') { 180 | gtk_style_context_add_class(context, "btn-answer-c-correct"); 181 | } else if (param_btn_answer->answer[0] == 'D') { 182 | g_print("Correct D"); 183 | gtk_style_context_add_class(context, "btn-answer-d-correct"); 184 | } 185 | 186 | window->timer = g_timeout_add(1000, millionaire_window_gameplay_answer_correct, user_data); 187 | } else { 188 | if (param_btn_answer->answer[0] == 'A') { 189 | gtk_style_context_add_class(context, "btn-answer-a-incorrect"); 190 | } else if (param_btn_answer->answer[0] == 'B') { 191 | gtk_style_context_add_class(context, "btn-answer-b-incorrect"); 192 | } else if (param_btn_answer->answer[0] == 'C') { 193 | gtk_style_context_add_class(context, "btn-answer-c-incorrect"); 194 | } else if (param_btn_answer->answer[0] == 'D') { 195 | gtk_style_context_add_class(context, "btn-answer-d-incorrect"); 196 | } 197 | 198 | window->timer = g_timeout_add(1000, millionaire_window_gameplay_answer_incorrect, user_data); 199 | } 200 | 201 | return TRUE; 202 | } 203 | 204 | gboolean millionaire_window_gameplay_answer_correct(gpointer user_data) 205 | { 206 | struct ParamBtnAnswer * param_btn_answer = (struct ParamBtnAnswer *) user_data; 207 | 208 | MillionaireWindow * window = MILLIONAIRE_WINDOW(param_btn_answer->window); 209 | GtkStyleContext * context_btn_answer_a = gtk_widget_get_style_context(GTK_WIDGET(window->btn_answer_a)); 210 | GtkStyleContext * context_btn_answer_b = gtk_widget_get_style_context(GTK_WIDGET(window->btn_answer_b)); 211 | GtkStyleContext * context_btn_answer_c = gtk_widget_get_style_context(GTK_WIDGET(window->btn_answer_c)); 212 | GtkStyleContext * context_btn_answer_d = gtk_widget_get_style_context(GTK_WIDGET(window->btn_answer_d)); 213 | 214 | // Stop the timer 215 | g_source_remove(window->timer); 216 | window->timer = 0; 217 | 218 | gtk_label_set_text(window->lbl_money, window->questions[window->current_question].money_earned_if_answered); 219 | 220 | if (window->current_question == 9) { 221 | return millionaire_window_gameplay_win_game(user_data); 222 | } 223 | 224 | window->current_question++; 225 | window->game_locked = FALSE; 226 | 227 | gtk_label_set_text(window->lbl_question, window->questions[window->current_question].question); 228 | gtk_label_set_text(window->lbl_answer_a, window->questions[window->current_question].answers[0]); 229 | gtk_label_set_text(window->lbl_answer_b, window->questions[window->current_question].answers[1]); 230 | gtk_label_set_text(window->lbl_answer_c, window->questions[window->current_question].answers[2]); 231 | gtk_label_set_text(window->lbl_answer_d, window->questions[window->current_question].answers[3]); 232 | 233 | gtk_style_context_remove_class(context_btn_answer_a, "btn-answer-a-correct"); 234 | gtk_style_context_remove_class(context_btn_answer_a, "btn-answer-a-incorrect"); 235 | gtk_style_context_remove_class(context_btn_answer_b, "btn-answer-b-correct"); 236 | gtk_style_context_remove_class(context_btn_answer_b, "btn-answer-b-incorrect"); 237 | gtk_style_context_remove_class(context_btn_answer_c, "btn-answer-c-correct"); 238 | gtk_style_context_remove_class(context_btn_answer_c, "btn-answer-c-incorrect"); 239 | gtk_style_context_remove_class(context_btn_answer_d, "btn-answer-d-correct"); 240 | gtk_style_context_remove_class(context_btn_answer_d, "btn-answer-d-incorrect"); 241 | 242 | gtk_widget_set_visible(GTK_WIDGET(window->lbl_lifeline_answer), FALSE); 243 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_a), TRUE); 244 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_b), TRUE); 245 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_c), TRUE); 246 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_d), TRUE); 247 | 248 | return TRUE; 249 | } 250 | 251 | gboolean millionaire_window_gameplay_answer_incorrect(gpointer user_data) 252 | { 253 | struct ParamBtnAnswer * param_btn_answer = (struct ParamBtnAnswer *) user_data; 254 | 255 | MillionaireWindow * window = MILLIONAIRE_WINDOW(param_btn_answer->window); 256 | GtkStyleContext * context_btn_answer_a = gtk_widget_get_style_context(GTK_WIDGET(window->btn_answer_a)); 257 | GtkStyleContext * context_btn_answer_b = gtk_widget_get_style_context(GTK_WIDGET(window->btn_answer_b)); 258 | GtkStyleContext * context_btn_answer_c = gtk_widget_get_style_context(GTK_WIDGET(window->btn_answer_c)); 259 | GtkStyleContext * context_btn_answer_d = gtk_widget_get_style_context(GTK_WIDGET(window->btn_answer_d)); 260 | 261 | // Stop the timer 262 | g_source_remove(window->timer); 263 | window->timer = 0; 264 | 265 | window->current_question = 0; 266 | window->game_locked = FALSE; 267 | 268 | gtk_label_set_text(window->lbl_money, "$0"); 269 | gtk_label_set_text(window->lbl_question, window->questions[window->current_question].question); 270 | gtk_label_set_text(window->lbl_answer_a, window->questions[window->current_question].answers[0]); 271 | gtk_label_set_text(window->lbl_answer_b, window->questions[window->current_question].answers[1]); 272 | gtk_label_set_text(window->lbl_answer_c, window->questions[window->current_question].answers[2]); 273 | gtk_label_set_text(window->lbl_answer_d, window->questions[window->current_question].answers[3]); 274 | 275 | gtk_style_context_remove_class(context_btn_answer_a, "btn-answer-a-correct"); 276 | gtk_style_context_remove_class(context_btn_answer_a, "btn-answer-a-incorrect"); 277 | gtk_style_context_remove_class(context_btn_answer_b, "btn-answer-b-correct"); 278 | gtk_style_context_remove_class(context_btn_answer_b, "btn-answer-b-incorrect"); 279 | gtk_style_context_remove_class(context_btn_answer_c, "btn-answer-c-correct"); 280 | gtk_style_context_remove_class(context_btn_answer_c, "btn-answer-c-incorrect"); 281 | gtk_style_context_remove_class(context_btn_answer_d, "btn-answer-d-correct"); 282 | gtk_style_context_remove_class(context_btn_answer_d, "btn-answer-d-incorrect"); 283 | 284 | gtk_widget_set_visible(GTK_WIDGET(window->lbl_lifeline_answer), FALSE); 285 | 286 | gtk_widget_set_visible(GTK_WIDGET(window->btn_call), TRUE); 287 | gtk_widget_set_visible(GTK_WIDGET(window->btn_fifty_fifty), TRUE); 288 | gtk_widget_set_visible(GTK_WIDGET(window->btn_audience), TRUE); 289 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_a), TRUE); 290 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_b), TRUE); 291 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_c), TRUE); 292 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_d), TRUE); 293 | 294 | return TRUE; 295 | } 296 | 297 | void millionaire_window_gameplay_lifeline_call(GtkWidget * widget, MillionaireWindow * window) 298 | { 299 | if (window->game_locked == TRUE) return; 300 | 301 | gtk_label_set_text(window->lbl_lifeline_answer, window->questions[window->current_question].lifeline_call_answer); 302 | 303 | gtk_widget_set_visible(widget, FALSE); 304 | gtk_widget_set_visible(GTK_WIDGET(window->lbl_lifeline_answer), TRUE); 305 | } 306 | 307 | void millionaire_window_gameplay_lifeline_audience(GtkWidget * widget, MillionaireWindow * window) 308 | { 309 | if (window->game_locked == TRUE) return; 310 | 311 | gtk_label_set_text(window->lbl_lifeline_answer, window->questions[window->current_question].lifeline_audience_answer); 312 | 313 | gtk_widget_set_visible(widget, FALSE); 314 | gtk_widget_set_visible(GTK_WIDGET(window->lbl_lifeline_answer), TRUE); 315 | } 316 | 317 | void millionaire_window_gameplay_lifeline_fifty_fifty(GtkWidget * widget, MillionaireWindow * window) 318 | { 319 | if (window->game_locked == TRUE) return; 320 | 321 | // Hide the first answer 322 | if (window->questions[window->current_question].lifeline_fifty_fifty_hide[0][0] == 'A') { 323 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_a), FALSE); 324 | } else if (window->questions[window->current_question].lifeline_fifty_fifty_hide[0][0] == 'B') { 325 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_b), FALSE); 326 | } else if (window->questions[window->current_question].lifeline_fifty_fifty_hide[0][0] == 'C') { 327 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_c), FALSE); 328 | } else if (window->questions[window->current_question].lifeline_fifty_fifty_hide[0][0] == 'D') { 329 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_d), FALSE); 330 | } 331 | 332 | // Hide the second answer 333 | if (window->questions[window->current_question].lifeline_fifty_fifty_hide[1][0] == 'A') { 334 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_a), FALSE); 335 | } else if (window->questions[window->current_question].lifeline_fifty_fifty_hide[1][0] == 'B') { 336 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_b), FALSE); 337 | } else if (window->questions[window->current_question].lifeline_fifty_fifty_hide[1][0] == 'C') { 338 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_c), FALSE); 339 | } else if (window->questions[window->current_question].lifeline_fifty_fifty_hide[1][0] == 'D') { 340 | gtk_widget_set_visible(GTK_WIDGET(window->btn_answer_d), FALSE); 341 | } 342 | 343 | // Hide the lifeline itself 344 | gtk_widget_set_visible(widget, FALSE); 345 | } 346 | 347 | gboolean millionaire_window_gameplay_win_game(gpointer user_data) 348 | { 349 | g_print("win"); 350 | 351 | struct ParamBtnAnswer * param_btn_answer = (struct ParamBtnAnswer *) user_data; 352 | 353 | MillionaireWindow * window = MILLIONAIRE_WINDOW(param_btn_answer->window); 354 | 355 | GtkStyleContext * context_window = gtk_widget_get_style_context(GTK_WIDGET(window)); 356 | GtkStyleContext * context_lbl_info = gtk_widget_get_style_context(GTK_WIDGET(window->lbl_info)); 357 | gtk_style_context_add_class(context_window, "bg-sparks"); 358 | gtk_style_context_add_class(context_lbl_info, "highlight"); 359 | 360 | gtk_label_set_text(window->lbl_info, "Congratulations! You have won $1 million, don't spend it all at once."); 361 | gtk_widget_set_visible(GTK_WIDGET(window->lbl_info), TRUE); 362 | 363 | return TRUE; 364 | } 365 | -------------------------------------------------------------------------------- /subprojects/blueprint-compiler.wrap: -------------------------------------------------------------------------------- 1 | [wrap-git] 2 | directory = blueprint-compiler 3 | url = https://gitlab.gnome.org/jwestman/blueprint-compiler.git 4 | revision = main 5 | depth = 1 6 | 7 | [provide] 8 | program_names = blueprint-compiler 9 | --------------------------------------------------------------------------------