Improve how to redefine macros in 2011/toledo
The new variables in the Makefile, with defaults, are:
FIRE= XK_BackSpace:XK_Tab
FORWARD= XK_Up:XK_w
BACKWARD= XK_Down:XK_s
LEFT= XK_Left:XK_a
RIGHT= XK_Right:XK_d
WIDTH= 512
HEIGHT= 288
An example of how to set some is in the README.md file.
This commit means I can remove an item from the things-todo.md file
which I have now done. Next I can return to 2018.
This commit is contained in:
1 parent
cca76ebe93
commit
a6824fa297
5 files changed
+37
-48
No files matched your search
+11
-2
@@ -59,10 +59,19 @@ CSTD= -std=gnu11
|
||||
#
|
||||
ARCH=
|
||||
|
||||
# Variables to help simplify defining the defines
|
||||
#
|
||||
FIRE= XK_BackSpace:XK_Tab
|
||||
FORWARD= XK_Up:XK_w
|
||||
BACKWARD= XK_Down:XK_s
|
||||
LEFT= XK_Left:XK_a
|
||||
RIGHT= XK_Right:XK_d
|
||||
WIDTH= 512
|
||||
HEIGHT= 288
|
||||
# Defines that are needed to compile
|
||||
#
|
||||
CDEFINE= -DA=XK_Up:XK_w -DB=XK_Left:XK_a -DC=XK_Right:XK_d -DD=XK_Down:XK_s \
|
||||
-DE=XK_BackSpace:XK_Tab "-DQ=XFillRectangle(W,X,Y,"
|
||||
CDEFINE= -DA=${FORWARD} -DB=${LEFT} -DC=${RIGHT} -DD=${BACKWARD} \
|
||||
-DE=${FIRE} "-DQ=XFillRectangle(W,X,Y," -DM=${WIDTH} -DN=${HEIGHT}
|
||||
|
||||
# Include files that are needed to compile
|
||||
#
|
||||
|
||||
+22
-20
@@ -24,40 +24,42 @@ The first alt version, [toledo.alt.c](toledo.alt.c), allows you to reconfigure
|
||||
the controls and the dimensions more easily.
|
||||
|
||||
The second version, [toledo.alt2.c](toledo.alt2.c), should work for Windows but
|
||||
does not allow you to reconfigure the keys or dimensions.
|
||||
does not allow you to reconfigure the keys or dimensions. This is because it
|
||||
cannot be tested by us.
|
||||
|
||||
|
||||
### Alternate build:
|
||||
|
||||
For the one that lets you reconfigure the keys you will want to look at the
|
||||
included header file, [keysym.h](keysym.h), to find the correct macros. Once you
|
||||
have the right names you can define the macros `A`, `B`, `C`, `D` and/or `E`. It
|
||||
will use the default for any you do not specify. For instance, to swap what `A`
|
||||
and `B` are (see below for defaults of all keys):
|
||||
have the right names you can define the macros `FIRE`, `FORWARD`, `BACKWARD`,
|
||||
`LEFT`, `RIGHT`, `WIDTH` and `HEIGHT`. Here are the defaults:
|
||||
|
||||
```
|
||||
FIRE= XK_BackSpace:XK_Tab
|
||||
FORWARD= XK_Up:XK_w
|
||||
BACKWARD= XK_Down:XK_s
|
||||
LEFT= XK_Left:XK_a
|
||||
RIGHT= XK_Right:XK_d
|
||||
WIDTH= 512
|
||||
HEIGHT= 288
|
||||
```
|
||||
|
||||
but you can change them about however you like, even with other keys. For
|
||||
instance to swap `LEFT` and `RIGHT`:
|
||||
|
||||
|
||||
```sh
|
||||
make clobber CDEFINE="-DA=XK_Left:XK_a -DB=XK_Up:XK_w" alt
|
||||
make clobber LEFT=XK_Right:XK_d RIGHT=XK_Left:XK_a alt
|
||||
```
|
||||
|
||||
but you can specify something completely else and you can pick and choose which
|
||||
controls you wish to redefine. You might also wish to change the dimensions of
|
||||
the game, `M` and `N` which have an arbitrarily selected lower limit as well as
|
||||
the default values.
|
||||
the game, `WIDTH` and `HEIGHT` which have an arbitrarily selected lower limit as
|
||||
well as the default values.
|
||||
|
||||
Here are the defaults:
|
||||
|
||||
```c
|
||||
#define A XK_Up:XK_w
|
||||
#define B XK_Left:XK_a
|
||||
#define C XK_Right:XK_d
|
||||
#define D XK_Down:XK_s
|
||||
#define E XK_BackSpace:XK_Tab
|
||||
#define M 512
|
||||
#define N 288
|
||||
```
|
||||
|
||||
Observe that each of the controls are a pair in the form of `player2:player1`.
|
||||
Observe that each of the controls are a pair in the form of `player2:player1`
|
||||
(yes, player 2 comes first!).
|
||||
|
||||
|
||||
## Judges' remarks:
|
||||
|
||||
Executable → Regular
File mode changed.
@@ -3315,6 +3315,9 @@ lets one reconfigure the controls and also the size of the game and another
|
||||
version that should work in Windows, based on the author's remarks and support
|
||||
file, `layer.c`.
|
||||
|
||||
The Makefile was also modified by Cody to make it simpler to redefine the
|
||||
controls, width and height.
|
||||
|
||||
|
||||
## <a name="2011_vik"></a>[2011/vik](/2011/vik/vik.c) ([README.md](/2011/vik/README.md]))
|
||||
|
||||
|
||||
+1
-26
@@ -1,5 +1,5 @@
|
||||
# A todo list of known things to check and/or do
|
||||
*Last updated: Fri 08 Dec 2023 12:46:49 UTC*
|
||||
*Last updated: Tue 12 Dec 2023 14:00:37 UTC*
|
||||
|
||||
This document is primarily for [Cody Boone
|
||||
Ferguson](/winners.html#Cody_Boone_Ferguson) as he (that is I :-) ) wanted a way
|
||||
@@ -169,28 +169,3 @@ the rest of the entries are done, assuming that it's possible.
|
||||
- Although I will have to do this when another issue is opened up I am aware of
|
||||
some issues in 2020/ferguson1/.winner.json. I do not want to forget this,
|
||||
however, so I am noting it here.
|
||||
|
||||
- Finish going through entries (Makefile and README.md files) that have the
|
||||
ability to redefine macros but only in an awkward way like `make clobber
|
||||
CDEFINE="-D.."`. To find entries that were done by me: `git grep -c 'CDEFINE'
|
||||
'*README.md'` but the `2000/thadgavin` is already done. The reference to
|
||||
`CDEFINE` might want to be removed but that can be decided when this is done
|
||||
too. The entries done as of 7 Dec 2023 are:
|
||||
- 2006/sloane
|
||||
- 2006/monge
|
||||
- 2004/jdalbec
|
||||
- 2004/gavare
|
||||
- 2001/kev
|
||||
- 2000/thadgavin
|
||||
- 1998/schweikh3
|
||||
- 1998/banks
|
||||
- 1994/dodsond2
|
||||
- 1993/rince
|
||||
- 1993/plummer
|
||||
- 1993/cmills
|
||||
- 1992/kivinen
|
||||
- 1991/rince
|
||||
- 1985/shapiro
|
||||
- 1985/lycklama
|
||||
... and a couple or few involved updating the thanks file as it helps with
|
||||
the entry itself. Ones not yet done might also have this need.
|
||||
Reference in new issue
Block a user