CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 127 users online: 4 members, 88 guests and 35 bots.
Members: Ashbad, shundra9, Tari.
Bots: VoilaBot (2), Spinn3r (2), MSN/Bing (1), Magpie Crawler (3), VoilaBot (8), Googlebot (18), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
Author Message
flyingfisch


Super-Expert


Joined: 02 Feb 2012
Posts: 896
Location: Akron, OH

Posted: 28 Jun 2012 11:08:29 am    Post subject: [Prizm] Graphics Library?

Hi,

I know that you guys are probably going to tell me to check "Useful Prizm Routines" but I was wondering if we could take those routines (circele, rectangel, line, and plot) and put them in a file that can be use with #include?

This way it wouldn't clutter up the C file.

Any comments?
_________________



Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55762
Location: Earth, Sol, Milky Way

Posted: 28 Jun 2012 11:12:08 am    Post subject:

Yes, there's nothing wrong with that. To do it the proper C way, you should put all the graphics functions you want in a .c file, such as stdgfx.c. Then, prototype all of the functions in stdgfx.c in a file called stdgfx.h. In your main file, #include "stdgfx.h", and in your Makefile, add stdgfx.c as one of the sources. This way, GCC will generate <mainfile>.o and stdgfx.o, then link them together into <mainfile>.bin.
_________________


Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2418
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 28 Jun 2012 11:12:12 am    Post subject:

I had started compiling together such a library at one point; I'd share it, but it's really just a .c/.h set that copied and renamed most of the graphics commands in the useful routines thread. Plus, never compiled. It was a 30-minute project I got bored of and stopped working on. Perhaps it's time to actually follow through on it!
_________________
-Ashbad
Back to top
flyingfisch


Super-Expert


Joined: 02 Feb 2012
Posts: 896
Location: Akron, OH

Posted: 28 Jun 2012 12:13:34 pm    Post subject:

Ashbad wrote:
I had started compiling together such a library at one point; I'd share it, but it's really just a .c/.h set that copied and renamed most of the graphics commands in the useful routines thread. Plus, never compiled. It was a 30-minute project I got bored of and stopped working on. Perhaps it's time to actually follow through on it!


Yes, please Smile
_________________



Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55762
Location: Earth, Sol, Milky Way

Posted: 28 Jun 2012 01:33:40 pm    Post subject:

Ashbad wrote:
Perhaps it's time to actually follow through on it!
If you do so, be sure to have it in a public (D)CVS repository somewhere so that multiple people can contribute to it. Perhaps it could go in the same repository as Tari's Python work for the Prizm?
_________________


Back to top
Tari


Systems Integrator


Joined: 03 Jul 2006
Posts: 2113
Location: Always-winter, Michigan

Posted: 28 Jun 2012 01:40:20 pm    Post subject:

KermMartian wrote:
If you do so, be sure to have it in a public (D)CVS repository somewhere so that multiple people can contribute to it. Perhaps it could go in the same repository as Tari's Python work for the Prizm?

My work lives in the libfxcg repo. I'd be willing to accept some handy libraries into libfxcg, though it's very easy to build a static library.
Makefile sample:

Code:
CC=sh3eb-elf-gcc
AS=sh3eb-elf-as
AR=sh3eb-elf-ar
CFLAGS=-c -ffunction-sections -fdata-sections -m4a-nofpu -mb -Os -nostdlib \
-Wall -L../lib -I../include -Wsystem-headers
LDFLAGS=-Wl,-static -lfxcg
ARFLAGS=rsv
OBJECTS=printf.o stdio.o stdlib.o ctype.o string.o unistd.o
LIBRARY=../lib/libc.a

all: $(LIBRARY)

$(LIBRARY): $(OBJECTS) ../lib/libfxcg.a
cp ../lib/libfxcg.a ../lib/libc.a
$(AR) $(ARFLAGS) $@ $(OBJECTS)

clean:
rm -f $(OBJECTS) $(LIBRARY)
Just build some object files and use ar to package them, then all you need is some headers for the public functions.
_________________


Ask questions the smart way · タリ
Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2418
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 28 Jun 2012 02:25:42 pm    Post subject:

CVS: I'd absolutely go this route Wink Partly because other people can work on it, and partly because I know I'll have to get other people to help me finish it when I (foreseeably) lose interest.

libfxcg: was actually thinking of making it a seperate "libfxcg-gfx" static lib all along, since over time I feel it'll be rather large and in turn make libfxcg large as well. Which would suck for add-ins linking against libfxcg that were like Periodic and only really used the graphical routines already in libfxcg!
_________________
-Ashbad
Back to top
Tari


Systems Integrator


Joined: 03 Jul 2006
Posts: 2113
Location: Always-winter, Michigan

Posted: 28 Jun 2012 03:39:17 pm    Post subject:

Ashbad wrote:
libfxcg: was actually thinking of making it a seperate "libfxcg-gfx" static lib all along, since over time I feel it'll be rather large and in turn make libfxcg large as well. Which would suck for add-ins linking against libfxcg that were like Periodic and only really used the graphical routines already in libfxcg!
There's no additional overhead for functions that aren't used, since it's a static library (assuming the final linking phase uses -gc-sections, which we do by default).
It would be a slightly different situation if we had a dynamic linker, but that's just wishful thinking at this point.
_________________


Ask questions the smart way · タリ
Back to top
ruler501


Advanced Newbie


Joined: 11 Jun 2012
Posts: 63

Posted: 28 Jun 2012 05:53:05 pm    Post subject:

Later in the summer I'll probably try and port SDL_gfx and that does most drawing tasks.
_________________
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y
------END GEEK CODE BLOCK------
Back to top
Ashbad


... I think redheaded girls are kind of cool


Joined: 01 Dec 2010
Posts: 2418
Location: Stomp Stomp Stomp, The Idiot Convention

Posted: 28 Jun 2012 06:02:35 pm    Post subject:

ruler501 wrote:
Later in the summer I'll probably try and port SDL_gfx and that does most drawing tasks.


Sounds good, I'm a big fan of SDL so even if it has a bit more overhead to use in terms of efficiency over the more primitive routines we have now, I'd personally be using jointly with the primitive functions I'm pulling together.

That being said, thanks for the info Tari, I actually didn't know that static libs only linked used functions into the binaries they're linked against. In which case, I can pull the routines together and organize them (as cleanly as possible) into libfxcg Smile
_________________
-Ashbad
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55762
Location: Earth, Sol, Milky Way

Posted: 29 Jun 2012 09:33:37 am    Post subject:

Indeed, for programs that need a bit more graphics pizazz, I think that pSDL will be a great tool. I think for simpler programs, though, a graphics library based on the line/fill/rectangle/gradient/sprite routines would be great.
_________________


Back to top
ruler501


Advanced Newbie


Joined: 11 Jun 2012
Posts: 63

Posted: 29 Jun 2012 08:09:18 pm    Post subject:

I definitely will not be able to work on that till august though so for now I have to work on fixing events which seem to be non-functional for now
_________________
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCM/CS/M/S d- s++: a---- C++ UL++ P+ L++ E---- W++ N o? K- w-- o? !M V?
PS+ PE+ Y+ PGP++ t 5? X R tv-- b+++ DI+ D+ G++ e- h! !r y
------END GEEK CODE BLOCK------
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55762
Location: Earth, Sol, Milky Way

Posted: 02 Jul 2012 11:11:14 am    Post subject:

ruler501 wrote:
I definitely will not be able to work on that till august though so for now I have to work on fixing events which seem to be non-functional for now
Fair enough; best of luck on it.
_________________


Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.033828 seconds.