Page 1 of 2

DrawCardLib

PostPosted: 01 Jul 2011, 15:29
by Snacko
I've started recoding the card drawing library and the results are pretty good. So far I've got the cardback and text rendering working.
This also seems to have fixed the random crashes in deckbuilder which were quite common.

This is done in c with cairo and pango libraries. If anyone would like to help (code) feel free to message me and we can set up some source code repository.

Gameplay.jpg

Re: DrawCardLib

PostPosted: 01 Jul 2011, 18:51
by gmzombie
this is awesome. by the way when i got to looking at the n paladin code after we chatted i thought that the program was routing the jmps to the same line they were at before but you were right they are not. olly dosent support NASM either just MASM, HLA, IDEAL. unless you know of a plugin to support nasm

Re: DrawCardLib

PostPosted: 03 Jul 2011, 19:15
by Snacko
Haven't had much time to work on this but so far the card titles and small card frames are rendered.
Gameplay2.jpg

Re: DrawCardLib

PostPosted: 08 Jul 2011, 18:04
by gmzombie
your doing a great job as always. i just can hope that if there is time to recode deckdll when this one is done. ive been working with an older mok deckdll and it gives us more room for buttons. if you would like to see it ill send it to you.

Re: DrawCardLib

PostPosted: 08 Jul 2011, 20:54
by Snacko
gmzombie wrote:your doing a great job as always. i just can hope that if there is time to recode deckdll when this one is done. ive been working with an older mok deckdll and it gives us more room for buttons. if you would like to see it ill send it to you.
I just checked deckdll and it's the whole deckbuilder in the shared library. Main executable pretty much only calls one function which creates deck builder and handles everything.

Re: DrawCardLib

PostPosted: 09 Jul 2011, 00:10
by gmzombie
i dont have a reference pic right now but if you check out this deckdll you will see what i mean by more room.if the deckdll gets recoded at least there would be a source code for it given we actually have to add more buttons or whatnot. im curious since you checked it out is this where the sets are coded to? like the 800h for unlimited..basically for the organization of cards, or is that actually in the magic.exe?

Re: DrawCardLib

PostPosted: 24 Aug 2011, 13:30
by foolosopher
Hi, it's been a while since you post this, so I don' t know at what status you 're in, but I 'm back and willing to do some coding. I am not familiar with pango and cairo but I 've started looking at it and waiting for your instructions. I am also interested in (re)coding the deckdll, but I was hoping that maybe we could do it an .h or some other library than dll so it would be easier to port it to linux, but haven't looked into this further yet.
I believe this will also give us some more ground to overcome the 2k limit, but we 'll see when we get there.
Oh, could you also give some info on development environment pls.

Keep up the good work

Re: DrawCardLib

PostPosted: 24 Aug 2011, 15:10
by Snacko
It's still very bare bone, so you can still switch the image/text rendering library if you want to.
http://www.mediafire.com/?bhp6dioa91zj2a9
All you need is to have gcc with glib + pango + cairo + win32 support. You can get all of the binary / source packages at http://www.gtk.org/download/index.php

If you want the DrawCardLib to interact with shalandar correctly then you need to rewrite CardArtLib (which is image cache and is called directly by shandalar but not manalink).
DeckDll at least at it's core has to be a windows shared library (dll), however you can make the deck editor stand alone with a protocol to interact with the dll.

Re: DrawCardLib

PostPosted: 24 Sep 2011, 23:46
by foolosopher
Hi, been busy but finally managed to take a quick look at the files. I see that you include manalink.h to the main.c but there is no main func to test anything. Do I have to install yasm also, I saw that you include it, in the makefile. While trying to compile the images_t struct could not load the images, I think it's the path or some problem with me having greek fonts also.
Anyway what's the status and what would you have me do, do you have something specific in mind, a flow/high level diagramm or something?
I attach my make results in case I am missing something major for the environment still.

Re: DrawCardLib

PostPosted: 25 Sep 2011, 22:38
by foolosopher
OK tried to re-setup the devenv with cygwin so...
Dev environment
win7x32, cygwin
installed mingw,yasm 0.8, pango and cairo
also used
$ pkg-config --cflags pangocairo
-mms-bitfields -IC:/opt/gtk/include/pango-1.0 -IC:/opt/gtk/include/cairo -IC:/op
t/gtk/include/glib-2.0 -IC:/opt/gtk/lib/glib-2.0/include -IC:/opt/gtk/include -I
C:/opt/gtk/include/freetype2 -IC:/opt/gtk/include/libpng14

and getting this:

$ make
gcc -O2 -march=i586 -mpreferred-stack-boundary=2 -Wall -Wextra -Wpointer-arith
-Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wshadow -W -Wstric
t-prototypes -Wnested-externs -Winline -Wno-unused-parameter -Werror -I.. -I. -I
C:\MinGW\include\glib-2.0 -IC:\MinGW\include\cairo -c -o src/cairo_renderer.o src/cairo_renderer.c
In file included from src/cairo_renderer.c:1:0:
src/cairo_renderer.h:4:30: fatal error: pango/pangocairo.h: No such file or directory
compilation terminated.
make: *** [src/cairo_renderer.o] Error 1

so it seems that it can't see pangocairo.
Any help appreciated

Re: DrawCardLib

PostPosted: 27 Sep 2011, 20:06
by Snacko
Edit makefile as the path are hardcoded, because it's a pain under windows to extract other program's output.
Change the includes -IC:\... to a single
`pkg-config --cflags pangocairo`
as this will fill all the needed paths for include files. You will need to do the same for linking
`pkg-config --libs pangocairo`
You don't need yasm for this.
There is no main function in main.c, because this is a shared library (dll)

Re: DrawCardLib

PostPosted: 03 Oct 2011, 23:04
by foolosopher
OK makefile updated, pango installed but seems It can't see a file. I checked declarations of libraries and files (I am keeping your file structure from the package on mediafire)and I think they 're OK (only tried "../drawcardlib.h" in cairo_renderer.h but still no luck.
Here's make results:

thx

Re: DrawCardLib

PostPosted: 05 Oct 2011, 15:12
by Snacko
Just read the errors:
src/cairo_renderer.c:124:2: note: use option -std=c99 or -std=gnu99 to compile your code

add -std=c99 and it should compile

Re: DrawCardLib

PostPosted: 09 Oct 2011, 00:17
by foolosopher
sorry :oops: to bug you again but ...

vagos@MPRIKI /cygdrive/d/MagicC-DrawCardLib-dist
$ make
gcc -shared -o DrawCardLib.dll src/cairo_renderer.o src/helper_functions.o src/m
ain.o DrawCardLib.def --entry _DllEntry -lgdi32 -lpangocairo-1.0 -lpango-1.0 -l
cairo.dll -lgobject-2.0.dll -lglib-2.0.dll -lgdk-win32-2.0.dll
/usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld: cannot find
-lgdk-win32-2.0.dll
collect2: ld returned 1 exit status
make: *** [manalink] Error 1
-------------------
Now from what I found this may be caused due to:
1.bad installation-I have reinstalled cygwin several times already.
2. I have installed gtk+,pango-cairo, gdk, glib, but couldn't find gdk-win32-2.0.dll anywhere in my cygwin directory
3. could be due to missing main
4. Missinterpatation of library link (mostly in linux)
5. Read that it might be a good idea to use MinGW-MSYS instead

Another question, should I pm you for such questions, or post them here instead?

p.s. uploaded my makefile for a quick look

Re: DrawCardLib

PostPosted: 09 Oct 2011, 19:33
by Snacko
first try
pkg-config --cflags glib-2.0
if this works change
GLIB_PATH = `pkg-config --cflags glib-2.0`
Then need
LDFLAGS = `pkg-config --libs pangocairo` `pkg-config --libs glib-2.0`

and
CAIRO_PATH = `pkg-config --cflags pangocairo`
will be enough
it should be enough

If you get it working under cygwin it will work under