| View previous topic :: View next topic |
| Author |
Message |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Jan 15, 2009 7:44 pm Post subject: Loading .dat confusing |
|
|
| Code: |
void Dat::LoadMap( void ){
int count = 0;
while(!i.eof()){
i>>Tiles[i][i];
count += 1;
}
free(&count);
}
|
Well... it loads correctly but the Tiles is like
Tiles[30][30] = { 0, 0, 1, 1, 2, 2 }; etc. and the .dat's format is like this
0
1
0
2
0
3 ...etc I want it to be able to turn Tiles into...
Tiles[30][30] = { 0, 1, 0, 2, 0, 3 };
|
|
| Back to top |
|
 |
Skyone Grandmaster Cheater
Reputation: 0
Joined: 10 Sep 2006 Posts: 508
|
Posted: Thu Jan 15, 2009 7:53 pm Post subject: |
|
|
???
Last edited by Skyone on Wed Dec 23, 2009 9:08 am; edited 7 times in total |
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Jan 15, 2009 7:55 pm Post subject: |
|
|
| Skyone wrote: | | What the fuck type of code is that? | Code that workz.
|
|
| Back to top |
|
 |
Skyone Grandmaster Cheater
Reputation: 0
Joined: 10 Sep 2006 Posts: 508
|
Posted: Thu Jan 15, 2009 7:58 pm Post subject: |
|
|
???
Last edited by Skyone on Wed Dec 23, 2009 9:08 am; edited 7 times in total |
|
| Back to top |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Thu Jan 15, 2009 9:26 pm Post subject: |
|
|
i just saw an thread on gamedev the other night about methods of loading tiles within a 2d game engine... i didn't read it, but it probably had some useful advice.
anyway, rethink your loading. are you using an already existing engine or what? i've never tried writing an engine, but i'd probably try something like... (take it with a grain of salt)
(obviously bullshit code)
| Code: |
#define MAP_SIZE 32
int main(){
struct{
int x;
int y;
}tiles[MAP_SIZE];
for(int i = 0; i < MAP_SIZE << 1; i++){
if (fileBufferPositionThing % 2) //even, x y formating.
tiles[i].x = something;
else //odd
tiles[i].y = something;
}
return 0;
} |
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Jan 15, 2009 9:40 pm Post subject: |
|
|
| slovach wrote: | i just saw an thread on gamedev the other night about methods of loading tiles within a 2d game engine... i didn't read it, but it probably had some useful advice.
anyway, rethink your loading. are you using an already existing engine or what? i've never tried writing an engine, but i'd probably try something like... (take it with a grain of salt)
(obviously bullshit code)
| Code: |
#define MAP_SIZE 32
int main(){
struct{
int x;
int y;
}tiles[MAP_SIZE];
for(int i = 0; i < MAP_SIZE << 1; i++){
if (fileBufferPositionThing % 2) //even, x y formating.
tiles[i].x = something;
else //odd
tiles[i].y = something;
}
return 0;
} |
|
DarkGDK
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Thu Jan 15, 2009 9:54 pm Post subject: |
|
|
Doesn't DarkGDK come with tutorials for game developers?
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Thu Jan 15, 2009 9:57 pm Post subject: |
|
|
| It does, but not data loading.
|
|
| Back to top |
|
 |
crayzbeef Expert Cheater
Reputation: 0
Joined: 21 Jan 2007 Posts: 101
|
Posted: Fri Jan 16, 2009 2:07 pm Post subject: |
|
|
Why the fuck are you saying void in the parameters? Wherever you learned C++ from is very old and shitty, might want to find a new source.
Also, i HOPE you aren't using darkgdk to do 2d.
|
|
| Back to top |
|
 |
rapion124 Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Mar 2007 Posts: 1095
|
Posted: Fri Jan 16, 2009 2:18 pm Post subject: |
|
|
| crayzbeef wrote: | Why the fuck are you saying void in the parameters? Wherever you learned C++ from is very old and shitty, might want to find a new source.
Also, i HOPE you aren't using darkgdk to do 2d. |
You can't use void for the "main" function, but void is perfectly fine for other functions in your program.
|
|
| Back to top |
|
 |
crayzbeef Expert Cheater
Reputation: 0
Joined: 21 Jan 2007 Posts: 101
|
Posted: Fri Jan 16, 2009 2:24 pm Post subject: |
|
|
| rapion124 wrote: | | crayzbeef wrote: | Why the fuck are you saying void in the parameters? Wherever you learned C++ from is very old and shitty, might want to find a new source.
Also, i HOPE you aren't using darkgdk to do 2d. |
You can't use void for the "main" function, but void is perfectly fine for other functions in your program. |
Perfectly fine? According to what? a C++ standard 20 years ago?
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Fri Jan 16, 2009 2:36 pm Post subject: |
|
|
| crayzbeef wrote: | Why the fuck are you saying void in the parameters? Wherever you learned C++ from is very old and shitty, might want to find a new source.
Also, i HOPE you aren't using darkgdk to do 2d. |
Oh man big guy on the internetz.
|
|
| Back to top |
|
 |
92Garfield I'm a spammer
Reputation: 57
Joined: 20 Dec 2007 Posts: 5871 Location: Banana Republic Germany
|
Posted: Fri Jan 16, 2009 2:39 pm Post subject: |
|
|
maybe you should at least say the language you use.
Here you go a working code to read from a file (you can call it .dat)
| Code: | Public oFSO As New FileSystemObject
Do Until oldPath = Text2.Text Or oldPath = ""
oldPath = Text2.List(y)
y = y + 1
Loop
If oldPath <> Text2.Text Then
oldPath = Text2.Text
Text2.AddItem (Text2.Text)
If oFSO.FileExists(App.path & "\Config\Paths.92Garfield") = False Then
Open App.path & "\Config\Paths.92Garfield" For Output As #1
Close #1
End If
Set LoadFile = oFSO.OpenTextFile(App.path & "\Config\Paths.92Garfield", ForAppending)
LoadFile.Write Text2.Text & cr$
LoadFile.Close
End If
|
_________________
Last edited by 92Garfield on Fri Jan 16, 2009 2:43 pm; edited 1 time in total |
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Fri Jan 16, 2009 2:40 pm Post subject: |
|
|
| 92Garfield wrote: | | maybe you should at least say the language you use. |
It's really not that hard to see what language I'm using.
|
|
| Back to top |
|
 |
92Garfield I'm a spammer
Reputation: 57
Joined: 20 Dec 2007 Posts: 5871 Location: Banana Republic Germany
|
Posted: Fri Jan 16, 2009 2:44 pm Post subject: |
|
|
| _void_ wrote: | | 92Garfield wrote: | | maybe you should at least say the language you use. |
It's really not that hard to see what language I'm using. |
Could be:
C#
C
C++
JS
Java
Flash
PHP (Well kinda obviously not since its SS)
...
Dunno so many
_________________
|
|
| Back to top |
|
 |
|