[CsMain] CS 2.1 Tutorial Testing and Documentation Eval
markettwp <[email protected]> Sat, 09 Aug 2014 08:51:59 -0700
| Newsgroups | gmane.comp.graphics.crystalspace.general |
|---|---|
| Organization | TWP Marketing |
| Message-ID | <[email protected]> |
Using CS 2.1 under Kubuntu 14.04, I have found some mistakes in the doc =
text and code and propose a fix to make the tutorial actually work as =
expected.
When attempting to run Tutorial 2, I find a set of doc instructions less =
than clear:
From: CS/docs/html/manual/Simple-Loading-Material.html
The following text from this doc page is a problem:
...
4.2.2.1 Loading a Material in Memory
...
Then, we edit =91simple.cpp=92 and add the following in =
Simple::Application() and Simple::CreateSprites() (before =91return true=92=
):
bool Simple::Application()
{
...
CreateSprites();
...
return true;
}
...
void Simple::CreateSprites()
{
// Load a texture for our sprite.
iTextureWrapper* txt =3D loader->LoadTexture ("spark",
"/lib/std/spark.png");
if (txt =3D=3D 0)
ReportError("Error loading texture!");
}
...
The first sentence, above, explaining where to place this code is NOT =
correct. The file name should be 'simple1.cpp' and the sentence should =
read something like this:
"Then, we edit =91simple1.cpp=92 and add the following method call in =
Simple::Application() (before =91return true=92) and also add the new =
method: Simple::CreateSprites()."
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D MY FIX FOR THIS PROBLEM =3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
The sprite will NOT display wen using the above code, even after adding =
all of the code specified in the following pages of the tutorial. The =
exact place to insert the call to CreateSprites() in Simple::Application =
is NOT clear, it needs some change in the doc text itself. I don't know =
exactly where the original author intended this method call to be placed...
I was able to place code in simple1.cpp, in the method =
Simple::OnKeyboard (), which will cause the sprite to be displayed upon =
entering the keystroke 's':
...
bool Simple::OnKeyboard (iEvent& ev)
{
// We got a keyboard event.
csKeyEventType eventtype =3D csKeyEventHelper::GetEventType (&ev);
if (eventtype =3D=3D csKeyEventTypeDown)
{
...
// display a sprite
if (code =3D=3D 's')
{
CreateSprites();
}
}
return false;
}
...
I think this approach to displaying the sprite actually makes more sense =
in terms of learning how to use CS.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Next, moving on to the following tutorial page:
CS/docs/html/manual/Simple-Creating-Mesh.html
The page title and first sentence reads as follows:
4.2.2.3 Creating a Mesh from a Factory
To create a mesh just add the following code in Simple::CreateSprites() =
(before =91return true=92 and after the code we just added to load the mesh =
factory):
void Simple::CreateSprites ()
{
...
}
The problem is that the method, Simple::CreateSprites(), is declared as =
type VOID and does NOT return anything, so this sentence should read =
something like this:
"To create a mesh just add the following code in Simple::CreateSprites() =
(after the code we just added to load the mesh factory):"
---------------------------------------------------------------------------=
---
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[email protected]?subject=3Dun=
subscribe