Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Map Grid draw staggering

Author
Message
CGray
14
Years of Service
User Offline
Joined: 28th May 2010
Location:
Posted: 29th May 2010 06:05 Edited at: 30th May 2010 09:56
Hi all, not sure if this is a noob mistake or an actual error.

I'm cobbling together a small tower defense to learn db for school - up to drawing the map in. At this point it's meant to use a couple of for loops to go through he x and y axes, then draw a 50x50 square, colour obtained by looking up the tower array using the map grid value.

In practice, it displays an oddly positioned staircase.


I'm confident the code is correct, though I've been known to be human at times, however if you replace the content of DrawMap() with a simple "box 8, 132, 182, 58", it will not draw(This is a manual entry of the cords it should be drawing at). Can anyone see a reason for this?

Also, does anyone have a link to the outlining feature in dbPro? I have it enabled but it seems to do nothing, and i can't seem to find documentation.

Thanks all.

Code listings, project attached as .rar:

ooze.dba (mainfile - variable declares, etc)



main.dba


interface.dba (handles the interactions of the program with use input)


drawing.dba (all the drawing functions. Problem in here)


setup.dba (inital setup work - map filling, frame positions, etc)

Attachments

Login to view attachments
luskos
17
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 29th May 2010 12:46
I would bet on 1 of the drawing functions not doing it job correct, looking at the image i see that the grid is drawed good but there is something like stairs which is drawed on it.

Try to remend DrawGrid() and DrawMap() functions to see what is the effect.I`m pretty sure that the problem is one of the two!I can`t compile now because i`m not in home.But the way you are using 2 finite loop is the only i`ve produced something like this in the past.

The problem is that for every x value of the first loop it runs the second from start value to end value, eg. from y = 1 to y= 10.Try to give start and end values of the y to be like y= 1 to 1, so for every x it runs once!

Where there is a will, there is a way.
I often edit my posts, that`s who i am
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 29th May 2010 16:06
In your DrawMap() function, instead of :



use



Just simply switch the drawLeft and drawTop variables. It should work.

LB
CGray
14
Years of Service
User Offline
Joined: 28th May 2010
Location:
Posted: 30th May 2010 10:06
luskos, I think that's what it does. For each value on the y axis, it goes through the x axis once - 0, 1 -> 0, 10, then inc y, 1, 1 -> 1, 10. Unless I've made a mistake somewhere you can see?

LBFN, thanks - I could of sworn I checked that; think I've found my semicolon in db. I don't suppose you can see a reason it would be drawing a black box, can you? In setup.dba:SetUpTowers() I've defined the towerlist(1).colour as DWORD 255, 0, 0, and then call ink referencing this. It doesn't appear to be dropping down to towerList(0), and it doesn't look like it's connected to any other ink calls.

Login to post a reply

Server time is: 2024-11-24 15:54:19
Your offset time is: 2024-11-24 15:54:19