Juce Tutorial - beginnings


#1

I’ve started writing the part of my tutorial site that deals with actually getting into programming with Juce now. I’ve not got time to put the HTML together yet, so i’m just doing it as a PDF for now. I’ll keep it updated as i write more, but for now I thought I’d post the first two chapters to get some feedback. I’ve not properly proof-read it yet or anything :hihi:

Here’s the first two chapters as PDF, and the two source archives (one for each chapter).

Tutorial PDF
Chapter 1 files
Chapter 2 files

The next chapter will cover ButtonListeners and ChangeListeners, and will describe how to use multiple inheritance to give your components the properties you need.

The following chapter will cover basic painting operations (simple shapes and string literals, introducing Colours along the way), so that the coder can begin to output things.

Then, I will begin to unveil the core classes, once the coder knows how to put stuff onto the screen. That means things like Strings, Arrays, Files and Xml will be explained. These will probably be each given chapters, which will also be sections accessible on my site as specific guides.

There will be a section on debugging too, once the coder is aware of the things they can do. Once I’ve reached that point, i should have a fairly thorough guide on “the stuff in Juce that you simply need to know”, which should get anyone started. it should be possible for the coder to experiment with what they’ve learned, and the rest of the site will be sections dedicated to specific classes, such as ListBox, etc…


#2

nice. very good for newcomers.

small typo there

“that we have to delete each one by hand in the constructor

when we hire new programmers I’ll get em to read this!

keep up the good work oh champion of juce.

:wink:


#3

excellent! I’ll have a read-through as soon as I get chance.


#4

I’ve updated it, with the first section of Chapter 3 complete (covering message handling via the ButtonListener class).

same link as before for the pdf

This also has a source archive,
Chapter 3 files


#5

Brilliant. I’m sure this will help tremendously for people starting out with juce.


#6

Same link again, now have finished chapter 3 (responding to buttons and changeBroadcasters). it’s been ammended from the one at my last post, and now includeds some simple ‘tasks’ (only two very basic ones for now).

if you read it, let me know if i’ve done something stupid, like klf pointed out :hihi:


#7

Yeah, it looks like this is going to be really useful when it’s finished :). I didn’t spot any obvious mistakes, from the brief skim I had of it.

  • Niall.

#8

there are a few mistakes in the source code i provided :hihi: wh00ps, gotta fix that. hopefully have a few more chapters over the next few days.


#9

added an introduction to explain why the tutorial is structured the way it is :slight_smile:


#10

Cool Stuff Haydxn. Can’t wait till I have the time to really go through this.
Ben


#11

This is just brilliant and I appreciate every single step in this herculean effort… i read the entire stuff and I find it edited very well… keep up

shanks


#12

haydxn,

Thanks for this tutorial. I really need it. :smiley: I’m trying your tutorial using newly released MS Visual C++ 2005 Express. I got the “hello” program and jucedemo to compile successfully, but I can’t get your tutorial files to compile. When I try to build StartingPoint, I get the following error messages. Would you be able to tell what my problem might be?

------ Build started: Project: StartingPoint, Configuration: Debug Win32 ------
Linking…
LIBCMTD.lib(invarg.obj) : error LNK2005: __invoke_watson already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(setlocal.obj) : error LNK2005: __configthreadlocale already defined in MSVCRTD.lib(MSVCR80D.dll)
LIBCMTD.lib(tidtable.obj) : error LNK2005: __encode_pointer already defined in MSVCRTD.lib(MSVCR80D.dll)


LINK : warning LNK4098: defaultlib ‘LIBCMTD’ conflicts with use of other libs; use /NODEFAULTLIB:library
E:\Projects\Visual C++\juce tutorial\StartingPoint\StartingPoint\Debug\StartingPoint.exe : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at "file://e:\Projects\Visual C++\juce tutorial\StartingPoint\StartingPoint\Debug\BuildLog.htm"
StartingPoint - 43 error(s), 2 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


#13

don’t you worry, this is an easy one to fix!

the reason you’re having this problem NOW and not with the other examples is because they were using specially prepared project files. There is just one setting you need to change -

With the project loaded, go to the PROJECT menu at the top of the screen, and select the bottom menu item (Properties). In the window that appears, follow this path in the left hand tree panel:

Configuration properties
->C/C++
->Code Generation

In the right hand panel, you’ll see a line “Runtime Library”, with a bold setting. Depending on which build mode you’re in (Release or Debug) it will say Multi-threaded DLL or Multi-threaded Debug DLL. The ‘DLL’ bit on the end is what is causing the problem! Change it to the non-dll equivalent!

You’ll want to change it for both build types - look at the top-left widget on the window - “Configuration” - it’ll say Active(Debug) or Active(Release). When you’ve changed the Runtime Library option, change the configuration to ‘the other’ type (either debug or release) - it’ll ask if you want to save your change, so say yes! Then do the same change on this configuration.

Click OK, and try to build again.

[this is something that i plan to put into an appendix of the tutorial, as it’s windows only! i think i did put a comment in there tho warning you that you might face some problems at this exact point… :hihi:]


#14

by the way (and this isn’t related to your problem), please re-download the tutorial files (the zips) because there is a tiny little bug in the ApplicationStartup.cpp file!

You don’t have to redownload it of course, you can make the ammendment yourself…

I had a really stupid error in there, a relic from when a Juce feature changed and i misconstrued how to keep up to date…

In Application Startup, it looks like this…

66   ~MainDialog()
67   {
68      JUCEApplication::quit();
69   }
70
71   void closeButtonPressed ()
72   {
73      delete this;
74   }

… which is wrong, and very silly. This is because juce decreed that a DialogWindow must have a closeButtonPressed() function implemented, so i just added one in. However, i didn’t know quite what to put in, and a delete would cause the destructor to be called… so i thought that’d do… silly me… what it SHOULD look like is this:

66   ~MainDialog()
67   {
68   }
69
70   void closeButtonPressed ()
71   {
72      JUCEApplication::quit();
73   }

even with very little juce knowledge, you can probably see how absolutely brain-stupid i was being (i did feel dirty putting “delete this” at the time, i’m sure).

Sorry about that! It would only cause an error when you close during a debug, but it’s still a stupid thing. :oops: :oops: :oops:


#15

You’re a genius, haydxn! Now I can build your tutorial files. This is getting fun. I hope you can continue to expand the tutorial, so a real newbie like me can have some fun, too. Thanks!


#16

thanks :smiley: let me know how you get on, i’ve yet to hear from anyone making it thru all the current chapters :hihi: it’ll be pretty comprehensive when it’s done


#17

Haydxn,

The tutorial’s great, and I followed your advice for the compile error with the Multi-threaded DLL, which killed 30 errors, but I can’t seem to figure out the deal with these:

[color=green]LINK : warning LNK4067: ambiguous entry point; selected 'mainCRTStartup’
ApplicationStartup.obj : error LNK2001: unresolved external symbol “public: virtual void __thiscall juce::JUCEApplication::unhandledException(class std::exception const *)” (?unhandledException@JUCEApplication@juce@@UAEXPBVexception@std@@@Z)
ApplicationStartup.obj : error LNK2001: unresolved external symbol “public: __thiscall juce::String::String(wchar_t const * const)” (??0String@juce@@QAE@QB_W@Z)[/color]

I’m possibley just being a dufus, but that is my nature. Any ideas?


#18

Read through your tutorial recently, looks like it would be good for someone getting into it. Nice job thus far. :slight_smile:


#19

yikes, sorry i can’t seem to reproduce that here :S what compiler are you using?

have you tried cleaning and rebuilding Juce? Also, have you made sure that my silly bug isn’t still in ApplicationStartup.cpp? (a few posts back)… that wouldn’t cause it to fail linking though, although it does cause the program to break at that unhandledException function.

I’m sorry I can’t be more helpful there, perhaps someone else here recognises this link error?


#20

Stripped down all my code and started again and found (I think) my mistake. I forgot to untick the “precompile header” option in app. creation. Dissabled that and it’s on with the show.

I’ll keep you posted on how helpful a real Juce amateur (seriously it’s tragic) finds your tutorial.