Jump to content
  • Advertisement
Sign in to follow this  
pnroach

ISO rendering code snippet

This topic is 4814 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello there Does anyone happen to have some code dealing with ISO tile rendering with smooth scrolling and stuff like that. Be so kind as to share. ++I would also like to know how you guys determine the number of tiles you draw on the screen. Is ScreenWidth/TILE_WIDTH ScreenHeight/TILE_HEIGHT good enough for isometrics? The thing is that if you use these formulas you don't get screen totally filled with tiles but rather have you backgound showing on the sides. Hopefully what I say makes sense. Thanx

Share this post


Link to post
Share on other sites
Advertisement
I have an Diablo style RPG example, that I've downloaded from net. Unfortunately the web page I've downloaded from is closed. The code is free. Is there any way to upload this piece of example to GameDev.net? Code is totaly funcional. It is client/server based, there is pathfind routine, layer routine, animation routine inside of it, etc...

Share this post


Link to post
Share on other sites
Did not get a chance to look at it but, here is a link to download it.



From streamer: "Here it is. A piece of RPG. Orignaly made by wonyee...from www.soloeden.com (now don't exist).

Best Regards,
Izzy"


download here

enjoy!

-hammackj =)

Share this post


Link to post
Share on other sites
#include <stdio.h>
#include <stdlib.h>

#include <sdl.h>
#include <hxrender.h>
#include <hxSDL.h>
#include <hxutility.h>

void Render(void);

int tileMap[16][16] = {
{1,1,0,0,0,0,1,1,0,0,1,0,0,0,1,1},
{1,1,0,0,1,1,1,1,1,1,1,1,1,0,1,1},
{0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,0},
{0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0},
{0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0},
{0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,1},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
{0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0},
{0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1},
{0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1},
{0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,1},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}};

hxSurface *isoTile;
hxSurface *it2;


int main(int nArgs, char **args)
{
bool isRunning;
SDL_Event event;


SDL_Init(SDL_INIT_VIDEO);

hxsSetupWindow(640, 480, 0, 0, "hxTest");

hxSetScreenView(hxuBuildRect(0,0,640,480));
hxSetCameraView(hxuBuildRect(-1024,-500,1700,1700));


isoTile = hxsLoadBMP("isotile.bmp");
hxReplacePix(isoTile, hxuBuildColor(0,255,0,255), hxuBuildColor(0,0,0,0));

it2 = hxsLoadBMP("it2.bmp");
hxReplacePix(it2, hxuBuildColor(0,255,0,255), hxuBuildColor(0,0,0,0));



isRunning = true;

while(isRunning)
{
SDL_PollEvent(&event);
if(event.type==SDL_QUIT)
isRunning = false;

Render();
}

hxFreeSurface(isoTile);
hxFreeSurface(it2);
hxsShutdown();
SDL_Quit();

return 0;
}

void Render(void)
{
hxClearScreen();
int xStart = 0;
int yStart = 0;
int xInc = 0;
int yInc = 0;


for (int i = 0; i < 16 ; i += 1)
{
xStart = -i * 64;
yStart = i * 32;

for (int j = 0; j < 16; j += 1)
{

if(tileMap[j][15-i] ==0 )
hxuBlitSimple(isoTile, (j * 64)+ xStart, (j * 32)+ yStart);

if(tileMap[j][15-i] ==1 )
hxuBlitSimple(it2, (j * 64)+ xStart, (j * 32)+ yStart - (512-64));
}
}

hxsUpdateWindow();
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!