void DotMat_init(){ dotMatrix_clear(&Map); dotMatrix_clear(&dotMat); paintMap(); dotMatrix_dataToArray(&Map); dotMatrix_dataToArray(&dotMat); dotMatrix_print(&dotMat); dotMatrix_print(&Map); }
int main(int argc, char *argv[]) { QApplication a(argc, argv); MapMaker w; Updater *u = new Updater(); w.getTerrainPainter()->setUpdater(u); u->connect(u,SIGNAL(update()),w.getTerrainPainter(),SLOT(paintMap())); w.show(); u->start(); return a.exec(); }
//-------------------------------------------------------------- void ofApp::setup(){ //set a limited frame rate, enable alpha blending, and set no anti-aliasing for more pixel arty kind of vibe. ofSetFrameRate(30); ofEnableAlphaBlending(); ofDisableAntiAliasing(); //create the sprite renderer with 2 layers, and 16x16 tiles. spriteRenderer = new ofxSpriteSheetRenderer(2, 10000, 0, 16); //load in the 64x64 pixels texture. spriteRenderer->loadTexture("link.png", 64, GL_NEAREST); wallBreaktimer = 0; wallBreaktimerDuration = 30; //30 frames //create "player" as an instance of our basicSprite struct, then set his position, speed, and default animation. player = new basicSprite(); initializeRandomWorld (); paintMap(); vector<ofPoint> placementOptions; for (int y = 0; y < GRIDH; y++) { for (int x = 0; x < GRIDW; x++) { basicSprite* sprite = getTile (x,y); if (!sprite->isWall) { placementOptions.push_back(sprite->pos); } } } player->pos.set(placementOptions[ofRandom(0, placementOptions.size())]); player->speed = 0.1; player->animation = walkAnimation; //override the walkAnimation's default index to have Link starting facing down. player->animation.index = 6; }
int main (int argc, char *argv[]) { // CGI Convenience class CGI cgiconv; // state variables // assume the user didn't pass any map name bool drawMap = false; // name of the map to display if any QString mapName; // process any CGI data cgiconv.processCGIData(); /* Check if we were passed a map to read */ if (argc == 2) { drawMap = true; mapName = argv[1]; } else if (cgiconv.getParamCount() != 0) { mapName = cgiconv.getParamValue("map"); drawMap = (cgiconv.getParamValue("draw") == "y"); } // if in drawmap mode, then that's all that's done if (drawMap) { QRegExp slashExp("/"); mapName.replace(slashExp, "_"); mapName.prepend(MAPDIR "/"); loadFileMap ((const char*)mapName); paintMap(); } else { // open the output data stream QTextStream out(stdout, IO_WriteOnly); out.setEncoding(QTextStream::Latin1); out.flags(QTextStream::showbase | QTextStream::dec); const char* header = "Content-type: text/html; charset=iso-8859-1\n\n" "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n" "<HTML>\n" " <HEAD>\n" " <TITLE>ShowEQ Map Display</TITLE>\n" " <style type=\"text/css\">\n" " <!--\n" " table { border: black 2px solid }\n" " td { border: black 1px solid }\n" " th { border: black 1px solid }\n" " -->\n" " </style>\n" " </HEAD>\n" " <BODY>\n"; /* Print HTML header */ out << header; const char* footer = " </BODY>\n" "</HTML>\n"; // otherwise display an HTML form to allow the user to choose a map QDir mapDir(MAPDIR, "*.map", (QDir::Name | QDir::IgnoreCase), (QDir::Files | QDir::Readable)); if (!mapDir.exists()) { out << "<H1>The map directory '" MAPDIR "' doesn't exist!</H1>\n"; out << footer; return 0; } QString userAgent = cgiconv.getHTTPUserAgent(); out << "<FORM method=\"POST\" action=\"" << cgiconv.getScriptName() << "\">\n"; // beware Netscape 4.x style sheet brain death if ((userAgent.contains("Mozilla/4.") == 1) && (userAgent.contains("MSIE") == 0)) out << "<TABLE border=2 cellspacing=0 cellpadding=2>\n"; else out << "<TABLE cellspacing=0 cellpadding=2>\n"; out << "<TR>"; out << " <TH>Map Name</TH>"; out << " <TD><INPUT type=\"reset\" value=\"Reset\"/></TD>\n"; out << "</TR>"; out << "<TR>"; out << "<TD><SELECT name=\"map\" size=\"1\">\n"; // create a file info list const QFileInfoList *list = mapDir.entryInfoList(); // create an iterator over the list QFileInfoListIterator it( *list ); // pointer to the file info for the current file QFileInfo *fi; while ( (fi=it.current()) ) { out << "<OPTION value=\"" << fi->fileName() << "\""; if (mapName == fi->fileName()) out << " selected"; out << ">" << fi->baseName() << "</OPTION>\n"; // goto next element from list ++it; } out << "</SELECT></TD>\n"; // Submission button out << "<TD><INPUT type=\"submit\" value=\"Display\"/></TD>\n"; out << "</TR>" "</TABLE>" "</FORM>"; if (!mapName.isEmpty()) { out << "<H1>Map: " << mapName << "</H1>\n"; out << "<DIV><IMG src=\"" << cgiconv.getScriptName() << "?map=" << mapName << ";draw=y\" alt=\"Map: " << mapName << "\"/></DIV>\n"; } out << footer; } return 0; }
void GraphicUI::update() { paintMap(); }