Forum > Games
Porting a strategy game from Turbo Pascal
Ñuño_Martínez:
--- Quote from: User137 on May 03, 2018, 06:50:34 pm ---You can make an array of color codes and use it with OpenGL. Something like:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---type RGBByte = packed record r,g,b: byte end;...var colors: array[0..255] of RGBByte;...glColor3bv(@colors[16]); // Would use index color 16 for all next drawings
--- End quote ---
If you're using OpenGL you should use proper OpenGL data types for the sake of portability (i.e. GLbyte or GLubyte instead of BYTE). Also glColor3bv receives an array of bytes, so:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---TYPE TRGB_Interval = (rgbR, rgbG, rgnB); RGBByte = ARRAY [TRGB_Interval] OF GLubyte;...VAR Colors: ARRAY [0..255] OF RGBByte;...glColor3bv (@Colors[16]); { Would use index color 16 for all next drawings. }Just as suggestion.
ZsurzsaLaszlo:
Hey, I'm back! The colors work like a charm. I wrote a script that transforms the legacy artwork of mine to svg or whatever format I would need. I attach a small teaser image :D
Handoko:
Awesome!
Is that a gold mine?
ZsurzsaLaszlo:
Yep, exactly. There is some inconsistency, as you see on the picture. In the original there were no brown color, that was also a greyish color. Still have to figure out why my R script turn them to brown :P
Lulu:
good ! I like this kind of game :)
Navigation
[0] Message Index
[*] Previous page