Skip to content

Commit

Permalink
PIcture. [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
skaller committed Nov 24, 2017
1 parent 541d36c commit 48ddc3f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
6 changes: 3 additions & 3 deletions doc/tutorial/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
master_doc = 'index'

# General information about the project.
project = u'felix'
project = u'Felix Tutorial'
copyright = u'2017, John Skaller and others'

# The version info for the project you're documenting, acts as replacement for
Expand Down Expand Up @@ -230,7 +230,7 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'felix', u'Felix Documentation',
('index', 'Felix Tutorial', u'Felix Tutorial',
[u'John Skaller'], 1)
]

Expand All @@ -244,7 +244,7 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'felix', u'Felix Documentation',
('index', 'felix-tutorial', u'Felix Tutorial',
u'John Skaller', 'felix', 'One line description of project.',
'Miscellaneous'),
]
Expand Down
6 changes: 3 additions & 3 deletions doc/tutorial/gui02.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ down the screen.

The unit of measurement is approximately the pixel.
I say approximately because on a Mac with a Retina display,
each pixel is often four displayt elements on the screen.
each pixel is often four display elements on the screen.
To confuse the issue, the Mac can do hardware scaling.
You'll just have to experiment!

Expand Down Expand Up @@ -94,7 +94,7 @@ The second argument is an argument to that command, in this
case :code:`lightgrey`, which tells the clearing command what
colour to write on the surface it is clearing.

We have not actually drawn on the window at the point.
We have not actually drawn on the window at this point.
What we have done is packaged up the drawing instructions,
and *scheduled* them for drawing later.

Expand All @@ -108,7 +108,7 @@ Now we have drawn the objects we scheduled to be drawn
on the systems internal representation of the window's
surface but still, nothing appears on the screen!

This is because the window has not be shown yet.
This is because the window has not been shown yet.
We've been drawing on it whilst it was invisible.
So we now make it visible:

Expand Down
Binary file added doc/tutorial/gui03.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 15 additions & 3 deletions doc/tutorial/gui03.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ Putting Stuff in the Window

Now we have created a window, we want to put stuff on it!

.. image:: /gui03.jpg

Here's how:

.. code-block:: felix
include "gui/__init__";
Expand Down Expand Up @@ -39,6 +43,9 @@ Now we have created a window, we want to put stuff on it!
Here, the program is as before, except we now do three basic
ways to draw on a window.

Text
----

First, we want to be able to put ordinary text on the window.
To do that, we have to first create a font to write the text
with:
Expand Down Expand Up @@ -84,13 +91,15 @@ The base point is origin of the first character which is
approximately the left edge of the character, and the
point at which an invisible underline would occur:
in other words, under the main body of the character,
but on top of any descender that letter like `g` have.
but on top of any descender that letter like `g` may have.

The exact location is font dependent. Font rendering
is an arcane art, not an exact science so you will have
to practice to get text to appear where you it has
the correct visual significance.

Picture
-------

Now we are going to put a picture in the window.
The image is a JPEG image, and is supplied for testing
Expand Down Expand Up @@ -130,17 +139,20 @@ The first line loads the image file into memoy using a low
level primitive from SDL2_image. That primitve requires
a C char pointer, not a C++ string, which is what Felix uses,
so we use :code:`cstr` to convert. Then the `surface` function
translates the loaded file into an SDL surface object.
translates the loaded file into an Felix surface object.

In the second line we add the drawable to the window based
on the :code:`blit` function. This copies one surface to another.
We copy the image surface to the window surface at position 20,20
in the window, and use the :code:`get_sdl_surface()` method to
translate the Felix surface object into a lower level SDL surface.

Its all a bit mysterious, so you just have to so some thing
Its all a bit mysterious, so you just have to so some things
by copying the patterns that work.

Lines
-----

Finally, we draw a blue rectangle on top of the picture.
I'm sure you can figure out how that works!

Expand Down

0 comments on commit 48ddc3f

Please sign in to comment.