A little while back I found TileD. A really nice tile map editor, but it generates maps in XML containers which encode the actual data in Base64 and a few others among which is CSV... That's nice. For a better briefing, feel free to read dazappas tutorial on CSV loading since I will only give a quick demo for how you would load tilesets as per the TileD instructions in the TMX file, load the CSV data and draw it with the help of Prometheus_Vid.
Performance wise I have yet to perform a few tweaks (at revision 59 at time of writing) but when running the ZenGl counterpart program I observe 59.5 frames/sec (culv processor and as commented in dazappa's tutorial, I believe it is cpu limited) in wine 1.3.17 which in my experience is marginally ~1-5% faster then my windows 7 install; whilst Prometheus churns out 60.5 frames/sec without performance optimization at all so its more or less neck and neck. Its is worth mentioning though, that r59 will not draw data beyond the +x and +y boundaries of the screen as defined by CreateWindow(x,y,bpp)... I do not know about dazappas Zengl code, however.
On to the code, I whipped up a really fast demo program:
Code:
program TiledCsvDemoProgram; uses sdl, Prometheus_Vid; var Mp: Map; CycleStartTime: Int64; FpsFont: Font; CycleString: String; begin PrometheusVid_Start(); CreateWindow(800, 600, 32); UpdateWindow(); UpdateCanvas(); FpsFont.Load('FpsFont.ttf', 14); Mp.LoadFromTMX('', 'map_csv.tmx'); repeat CycleStartTime := Sdl_GetTicks; ClearCanvas(); Mp.Draw(0,0); Str((Sdl_GetTicks - CycleStartTime), CycleString); FpsFont.Draw(10, 10, 'Cycle time: ' + CycleString + ' ms', QuickColour(255, 255, 255, 255)); UpdateCanvas(); CycleStartTime := Sdl_GetTicks(); until 9-8=4; //WARNING: you have to killtask and cannot use the x button as I did not include the core unit to handle events... end.
Drawing the Map: MapVariable.Draw(X, Y: Int64) is once again the full write up which draws the Map at X,Y on the screen so all nice there too. For the next revision I'll implement the variable allowing offsets of each layer and hide/show them too which will make it flexible to some degree.
Again, as with everything I publish about my code, if you have any suggestions, even if you do not use my code, please post them. Feature requests and etc are always welcome and are encouraged as it helps develop projects further.
All in all, the rest (if not all) of everything I do is, if I may say so myself, rather self-explanatory, but if there is anything unclear comment and ask please.
Over-and out.
vBulletin Message