C and OSLib help + Any guides on C sprite programming?
andrew k (267) 76 posts |
Hello i am trying to compile the wimp example at http://www.sfryatt.eclipse.co.uk/temp/wimp.html but i am receiving the error below. I can compile the basic OSLIb hello world C file and run the compiled file but i’m assuming i need to be passing in more flags to the compile for more complicated uses of OSLib. Also if anyone knows of some tutorials with C and drawing sprites i would be grateful. I have just this week bought my copy of the DDE so i am very new to RISC OS programming and C but i have chosen C over BASIC as i have a lot of experience with C# and .Net so at least the syntax of C is similar. I also want to learn C as it’s a more transferable skill compared BASIC. *cc Wimp.c -o wimpobject |
Rick Murray (539) 13840 posts |
It is the link stage that is failing. Tell cc to compile only, then call link as a separate stage and tell it where to find the OSLib library code. |
David Pitt (102) 743 posts |
That command line seems to missing a few bits, in particular a pointers to the libraries to be linked to. *cc wimp.c -IOSLib: -LC:o.stubs,OSLib:o.OSLib32 Hope that helps, it worked here. |
Steve Fryatt (216) 2105 posts |
David’s answer looks about right. I’m surprised the original example keeps coming up, as it was originally stuck online to be referred to in a csa.programmer post on usenet, IIRC. I’ve got a much more comprehensive beginner’s guide to working with OSLib and Norcroft, which was intended to be a guide to using my libraries (which are based on OSLib) to write software. The project stalled when I ran out of time around the autumn, but I’ll see if I can get the first few chapters up on my website since they could be useful in isolation. |
andrew k (267) 76 posts |
Thank you all i have now compiled the Wimp.c example :) That would be great Steve if you find the time. I’m sure anything like this could be useful to people like me trying to get into RISC OS programming as there is always an initial inertia to picking up new platforms and libraries. Right i’m off to read A Dab Hand’s Guide to C before i try understand OSLib any further. |
Chris Mahoney (1684) 2165 posts |
Since you’re new to this I must ask: Are you aware of the Toolbox? The Style Guide encourages its use and personally I find its graphical window “designer” (ResEd) much easier than declaring windows through code. |
andrew k (267) 76 posts |
Hi Chris, i have briefly come across it yes. One of things areas i wanted to learn was games development and OSLib looks to have sprite API’s which i will need does the Toolbox have this? or is it really just writing wimp based desktop programs? |
Steve Fryatt (216) 2105 posts |
The Toolbox is just a set of tools for creating and managing windows and menus in a much higher-level way than is provided natively by the Wimp. The Toolbox will work with OSLib, as OSLib isn’t really a library: it’s just a clean and type-safe way to access the SWIs that RISC OS uses. The Toolbox is accessed via SWIs, so you can use OSLib to drive the Toolbox. OSLib and TBoxLib clash in their namespaces, but that’s not a real problem as you only need one or the other. If you’re starting out from scratch with C on RISC OS, I’d strongly advise against doing it without OSLib. |
Steve Fryatt (216) 2105 posts |
Just for completeness, what there is of the documentation can now be found at http://www.stevefryatt.org.uk/docs/wimp – as I said, it’s incomplete and stops very abruptly. |