![]() |
|
SantaHack 2011 |
Mark Oates
Member #1,146
March 2001
![]() |
Hmm... should I hit the abort button, or the code-in-a-panic button? -- |
Arthur Kalliokoski
Second in Command
February 2005
![]() |
Quitters never win... Hit the code-in-a-panic button. They all watch too much MSNBC... they get ideas. |
Desmond Taylor
Member #11,943
May 2010
![]() |
You can do it guys |
Dario ff
Member #10,065
August 2008
![]() |
Code Mark, code! EDIT: I'm almost ready, but I don't know if the game is building correctly. g++: `pkg-config: No such file or directory g++: allegro-5.0: No such file or directory g++: allegro_acodec-5.0: No such file or directory g++: allegro_audio-5.0: No such file or directory g++: allegro_color-5.0: No such file or directory g++: allegro_font-5.0: No such file or directory g++: allegro_image-5.0: No such file or directory g++: allegro_main-5.0: No such file or directory g++: allegro_memfile-5.0: No such file or directory g++: allegro_physfs-5.0: No such file or directory g++: allegro_primitives-5.0: No such file or directory g++: allegro_ttf-5.0`: No such file or directory Now I dunno about pkg-config, but this is another mingw install I did after doing a clean format some weeks ago. I would test if it works on my old Ubuntu VM, but it doesn't seem to boot up either. Is my compiler just screwed up? TranslatorHack 2010, a human translation chain in a.cc. |
Thomas Fjellstrom
Member #476
June 2000
![]() |
I don't think pkg-config is meant to be used on windows? Also `backticks` don't work on windows. -- |
Dario ff
Member #10,065
August 2008
![]() |
I know, right? TranslatorHack 2010, a human translation chain in a.cc. |
kdevil
Member #1,075
March 2001
![]() |
Sounds like you don't have the WINDOWS or MINGDIR environment variables set. Somewhere in the system part of the Windows control panel there's a place where you can set environment variables like that. ----- |
Matthew Leverton
Supreme Loser
January 1999
![]() |
You should be able to do it on the command line: make WINDOWS=1 or whatever the makefile wants. |
Desmond Taylor
Member #11,943
May 2010
![]() |
Well, I hope mine compiles okay. It does when using Code::Blocks but haven't tested the makefile as I have no idea how :/ It compiles with 5.0.5 though |
Dario ff
Member #10,065
August 2008
![]() |
Matthew Leverton said: You should be able to do it on the command line:make WINDOWS=1 or whatever the makefile wants. Yeah that worked. And indeed, it seems I had forgotten the MINGDIR enviroment variable after I did this clean Windows install. Now all that remains is finding someone who can try it on Linux that isn't part of the compo. Anyone? TranslatorHack 2010, a human translation chain in a.cc. |
MiquelFire
Member #3,110
January 2003
![]() |
Dario ff said: Now all that remains is finding someone who can try it on Linux that isn't part of the compo. Anyone? Makes me wish I had a Linux system. --- |
Matthew Leverton
Supreme Loser
January 1999
![]() |
If you send me a PM with a link I'll try it out. |
Dario ff
Member #10,065
August 2008
![]() |
Sent. I'm gonna go battle with vmware meanwhile. TranslatorHack 2010, a human translation chain in a.cc. |
Matthew Leverton
Supreme Loser
January 1999
![]() |
It worked, but only when I linked against the debug version of Allegro. Otherwise it complained about not being able to load the ogg tracks. My release library does have ogg support, but it could just be due to something I broke while hacking on Allegro. Edit: There is a box (missing character in the font?) at the end of some of the text strings. e.g., After the name of the level. Sucess is misspelled. |
Dario ff
Member #10,065
August 2008
![]() |
The makefile is the one from SH2011 with the game name modified. I compiled the release version with the binaries from the Files page on Windows just fine. I'm downloading a newer version of VMWare at the moment to test it out. Thanks for that, I'm gonna just guess the OGG issue is just a problem in your setup. EDIT: Matthew Leverton said: There is a box (missing character in the font?) at the end of some of the text strings. e.g., After the name of the level.Sucess is misspelled.
That's my ignorance at work. BRB. EDIT2: I think the box thing is related to my own ignorance of how text file reading is handled on Linux. TranslatorHack 2010, a human translation chain in a.cc. |
l j
Member #10,584
January 2009
![]() |
Dario ff said: EDIT2: I think the box thing is related to my own ignorance of how text file reading is handled on Linux. Windows uses CR/LF to indicate a new line. (If you aren't aware, CR = carriage return, LF = line feed)
|
Thomas Fjellstrom
Member #476
June 2000
![]() |
Old mac was CR (aka \r) only. Unix is LF (aka \n). -- |
Dario ff
Member #10,065
August 2008
![]() |
Ok, so say I'm using fgets for reading from the text file, what would be the cross-platform way to read each line and make sure there are no newline characters? TranslatorHack 2010, a human translation chain in a.cc. |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Here's how I do cross platform line reading (only works in BINARY file mode! (don't know why - I think it's something to do with the way file seeking works)) : FileWork.hpp 1
2#ifndef FileWork_H
3#define FileWork_H
4
5
6#include <string>
7#include <cstdio>
8#include <iostream>
9
10
11
12// Platform neutral getline - reads up unti EOF, \r (OSX), \r\n (WIN), or \n (NIX)
13// May only work in BINARY MODE.
14std::istream& GetLinePN(std::istream& is , std::string& s);
15// Same as above, but ONLY works in BINARY MODE!
16FILE* GetLinePN(FILE* f , std::string& s);
17
18void SkipWhiteSpace(FILE* f);
19bool ReadTextInteger(FILE* f , int* store);
20
21// ONLY works in BINARY MODE!
22int fpeek(FILE* f);
23
24
25
26
27#endif // FileWork_H
FileWork.cpp 1
2
3#include <allegro5/allegro.h>
4
5#include "Eagle5/FileWork.hpp"
6
7using std::string;
8
9
10
11std::istream& GetLinePN(std::istream& is , std::string& s) {
12 s = "";
13 char c;
14 if (!is.good()) {return is;}
15 while (!((is.get(c)).eof())) {
16 if (c == '\r') {// WINDOWS OR OSX
17 int c2 = is.peek();
18 if (c2 == '\n') {
19 is.get(c);// use up \n
20 }
21 return is;
22 }
23 if (c == '\n') {// NIX
24 return is;
25 }
26 s += c;
27 }
28 return is;
29}
30
31
32
33FILE* GetLinePN(FILE* f , std::string& s) {
34 s = "";
35 if (!f || feof(f) || ferror(f)) {return f;}
36 int c;
37 while ((c = fgetc(f)) != EOF) {
38 if (c == '\r') {// WINDOWS OR OSX
39 int c2 = fpeek(f);
40 if (c2 == '\n') {
41 c = fgetc(f);// use up \n
42 }
43 return f;
44 }
45 if (c == '\n') {// NIX
46 return f;
47 }
48 s += c;
49 }
50 return f;
51}
52
53
54
55void SkipWhiteSpace(FILE* f) {
56 int c = 0;
57 while (1) {
58 c = fgetc(f);
59 if (!((c == ' ') ||
60 (c == '\t') ||
61 (c == '\n') ||
62 (c == '\f') ||
63 (c == '\r'))) {
64 // not whitespace
65 if (c != EOF) {
66 ungetc(c , f);
67 }
68 break;
69 }
70 }
71}
72
73
74bool ReadTextInteger(FILE* f , int* store) {
75 ASSERT(store);
76
77 string s;
78 int i = 0;
79 bool isnumber = false;
80
81 while (1) {
82 int c = fgetc(f);
83 if (isdigit(c)) {
84 isnumber = true;
85 s += (char)c;
86 } else {
87 if (c != EOF) {
88 ungetc(c , f);
89 }
90 break;
91 }
92 }
93
94 if (isnumber) {
95 i = atoi(s.c_str());
96 *store = i;
97 return true;
98 }
99
100 return false;
101}
102
103
104int fpeek(FILE* f) {
105 if (!f || feof(f) || ferror(f)) {return EOF;}
106 long pos = ftell(f);
107 int c = fgetc(f);
108 fseek(f , pos , SEEK_SET);
109 ALLEGRO_ASSERT(pos == ftell(f));
110 return c;
111}
The only thing allegro is used for is an ALLEGRO_ASSERT - remove that, and you don't need A5. There's a version for istream, and for FILE*. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Dario ff
Member #10,065
August 2008
![]() |
Oh neat, thanks, although I did find a snippet already. And only working in binary mode is a problem. Lesson learned, XML is probably the best solution to everything. TranslatorHack 2010, a human translation chain in a.cc. |
l j
Member #10,584
January 2009
![]() |
I just use the allegro config stuff, works pretty well for me.
|
GullRaDriel
Member #3,861
September 2003
![]() |
Various problem including internet access have made my entry null. Sorry. "Code is like shit - it only smells if it is not yours" |
Edgar Reynaldo
Major Reynaldo
May 2007
![]() |
Gullradriel said: Various problem including internet access have made my entry null. Sorry.
Frantically trying to finish... My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
l j
Member #10,584
January 2009
![]() |
I'm trying to find motivation to finish this, but somehow I feel stressed and can't get shit done at all...
|
|
|