# Some useful building blocks Apps can be composed of a wide variety of building blocks that you can use in your functions, including a small number of functions that get automatically called for you as appropriate. ## Variables you can read * `App.screen` * `width` and `height` -- integer dimensions for the app window in pixels. * `flags` -- some properties of the app window. See [`flags` in `love.graphics.getMode`](https://love2d.org/wiki/love.window.getMode) for details. ## Functions that get automatically called * `App.initialize_globals()` -- called before running each test and also before the app starts up. As the name suggests, use this to initialize all your global variables to something consistent. I also find it useful to be able to see all my global variables in one place, and avoid defining top-level variables anywhere else (unless they're constants and never going to be modified). * `App.initialize(arg)` -- called when app starts up after `App.initialize_globals`. Provides in `arg` an array of words typed in if you ran it from a terminal window. (Based on [LÖVE](https://love2d.org/wiki/love.load).) * `App.quit()` -- called before the app shuts down. (Based on [LÖVE](https://love2d.org/wiki/love.quit).) * `App.focus(start?)` -- called when the app starts or stops receiving keypresses. `start?` will be `true` when app starts receiving keypresses and `false` when keypresses move to another window. (Based on [LÖVE](https://love2d.org/wiki/love.focus).) * `App.resize(w,h)` -- called when you resize the app window. Provides new window dimensions in `w` and `h`. Don't bother updating `App.screen.width` and `App.screen.height`, that will happen automatically before calling `App.resize`. (Based on [LÖVE](https://love2d.org/wiki/love.resize)) * `App.filedropped(file)` -- called when a file icon is dragged and dropped on the app window. Provides in `file` an object representing the file that was dropped, that will respond to the following messages: * `file:getFilename()` returning a string name * `file:read()` returning the entire file contents in a single string (Based on [LÖVE](https://love2d.org/wiki/love.filedropped).) * `App.draw()` -- called to draw on the window, around 30 times a second. (Based on [LÖVE](https://love2d.org/wiki/love.draw).) * `App.update(dt)` -- called after every call to `App.draw`. Make changes to your app's variables here rather than in `App.draw`. Provides in `dt` the time since the previous call to `App.update`, which can be useful for things like smooth animations. (Based on [LÖVE](https://love2d.org/wiki/love.update).) * `App.mousepressed(x,y, mouse_button)` -- called when you press down on a mouse button. Provides in `x` and `y` the point on the screen at which the click occurred, and in `mouse_button` an integer id of the mouse button pressed. `1` is the primary mouse button (the left button on a right-handed mouse), `2` is the secondary button (the right button on a right-handed mouse), and `3` is the middle button. Further buttons are mouse-dependent. (Based on [LÖVE](https://love2d.org/wiki/love.mousepressed).) * `App.mousereleased(x,y, mouse_button)` -- called when you release a mouse button. Provides the same arguments as `App.mousepressed()` above. (Based on [LÖVE](https://love2d.org/wiki/love.mousereleased).) * `App.wheelmoved(dx,dy)` -- called when you use the scroll wheel on a mouse that has it. Provides in `dx` and `dy` an indication of how fast the wheel is being scrolled. Positive values for `dx` indicate movement to the right. Positive values for `dy` indicate upward movement. (Based on [LÖVE](https://love2d.org/wiki/love.wheelmoved).) * `App.keychord_press(chord, key)` -- called when you press a key-combination. Provides in `key` a string name for the key most recently pressed ([valid values](https://love2d.org/wiki/KeyConstant)). Provides in `chord` a string representation of the current key combination, consisting of the key with the following prefixes: * `C-` if one of the `ctrl` keys is pressed, * `M-` if one of the `alt` keys is pressed, * `S-` if one of the `shift` keys is pressed, and * `s-` if the `windows`/`cmd`/`super` key is pressed. * `App.textinput(t)` -- called when you press a key combination that yields (roughly) a printable character. For example, `shift` and `a` pressed together will call `App.textinput` with `A`. (Based on [LÖVE](https://love2d.org/wiki/love.textinput).) * `App.keyreleased(key)` -- called when you press a key on the keyboard. Provides in `key` a string name for the key ([valid values](https://love2d.org/wiki/KeyConstant)). (Based on [LÖVE](https://love2d.org/wiki/love.keyreleased), including other variants.) ## Functions you can call
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>Democracy: The US (Unfinished)</title>
<link rel="stylesheet" href="/plain.css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<meta charset="utf-8" />
</head>
<body class="indent">
<h1>Democracy: The US Constitution (Unfinished)</h1>
<p>
When people talk about democracies, it's common to think of the US Constitution as the ``defining point of democracy''. While the US is the first modern democracy, its laws is far from perfect. In fact, it may be one of the worst of modern time! I will briefly go through the following.
</p>
<ul>
<li><a href="#corruption">Corruption</a></li>
<li><a href="#electoral-college">The electoral college</a></li>
<li><a href="#senate">The senate</a></li>
</ul>
<h2 id="#corruption">Corruption</h2>
<p><a href="https://www.cambridge.org/core/services/aop-cambridge-core/content/view/62327F513959D0A304D4893B382B992B/S1537592714001595a.pdf/testing-theories-of-american-politics-elites-interest-groups-and-average-citizens.pdf">A study shows that ``Multivariate analysis indicates that economic elites and organized groups representing business interests have substantial independent impacts on U.S. government policy, while average citizens and mass-based interest groups have little or no independent influence.''</a></p>
<p>
A near-ideal democracy would have a roughly linear positive correlation between the fraction of voters who support a policy and the possibility of the policy being passed in the legislature. But in the US, the line is flat at about 30%. A representative democracy wouldn't have a perfect correlation, because the general public is unable to be informed on all topics; fluctuations are normal. But <em>a flat line</em> means that the opinions of the people don't matter at all. This does not make sense in any type of democracy.
</p>
<p>
According to the study, the influence of economic elites and business interest groups on politics is rather high with a rough positive correlation as opposed to the flatline for the general public, making the US an oligarchy rather than a democracy. Mass-based interest groups have discernable impact on policies, but are still trivial compared with economic elites and businesses. About three billion dollars are spent yearly by large ``politically active'' businesses to bribe politicians to pass policies for their interest. While businesses should have a say in legislation, it is unacceptable that they have superior dominance over public opinion.
</p>
<h2 id="senate">The Senate</h2>
<p>
The Senate of the USA consists of 100 members, with 2 from each state. Two senators from California represent 39 million people while the two from Wyoming represent 500 thousand people. The founding fathers never could have imagined such a huge a difference between the population of states.
</p>
<p>
Some people believe that the Senate helps against populism as opposed to the House. Although the number of Senators for each state do indeed not correspond to the population, this has no correlation whatsoever with preventing populism and doesn't serve an obvious purpose. It only ``helps'' by giving completely unproportional voting powers to people based on their location, period.
</p>
<p>
The Senate also suffers from the fillibuster. Passing a bill in the Senate has a few steps: Firstly the Senators must <em>agree to vote</<