I need some help determining 2D texture-coordinates.
I've got a big spritefont-texture, and I want to get the coordinates of a single character. I have saved the x/y-offsets of each character in pixels, and I also have the width. What I have tried is diving these by the width and height of the spritefont and using this as the coordinates, but this did not seem to work. Am I doing something else wrong, or is my math off here?
Edit: Nevermind, I figured it out. I was casting wrongly.
Hello. How can I make one additional reference of one class datatype pointing to existing object?
Like, I have two references in stack pointing into one single object in the heap?
[QUOTE=HeatPipe;35827415]Hello. How can I make one additional reference of one class datatype pointing to existing object?
Like, I have two references in stack pointing into one single object in the heap?[/QUOTE]
Wouldn't that just be two pointers?
Just declare two stack pointers with the address of the heap object. I think.
[QUOTE=Jimbomcb;35820481]so... I have a file I need to decompress
[url]http://dl.dropbox.com/u/1032139/token[/url]
I know it's compressed using some method, I was assuming zlib but nothing seemed to work. am I missing something, is there some tell-tale way to work out what way it's compressed or am I out of luck.[/QUOTE]
I'll try to figure it out, but it better not be a virus (I got ass fucked before by a virus from here and almost lost my FP account)
EDIT: it doesn't have any recognizable header or anything distinguishing it from random data... sorry bro can't help
Trying to generate indices for a cube, anyone know any equations?
Help
[quote]1>------ Build started: Project: TerrainGeneration, Configuration: Debug Win32 ------
1> main.cpp
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\terrainwindow.hpp(33): warning C4018: '<=' : signed/unsigned mismatch
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(3): error C2011: 'Entity' : 'class' type redefinition
1> r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(3) : see declaration of 'Entity'
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(11): error C2027: use of undefined type 'Entity'
1> r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(3) : see declaration of 'Entity'
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(13): error C2065: 'texture' : undeclared identifier
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(13): error C2228: left of '.loadFromFile' must have class/struct/union
1> type is ''unknown-type''
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(19): error C2355: 'this' : can only be referenced inside non-static member functions
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(19): error C2227: left of '->setTexture' must point to class/struct/union/generic type
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\entity.hpp(19): error C2065: 'texture' : undeclared identifier
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(8): error C2079: 'ent' uses undefined class 'Entity'
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(8): error C2079: 'ent2' uses undefined class 'Entity'
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(9): error C2228: left of '.textureInit' must have class/struct/union
1> type is 'int'
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(10): error C2228: left of '.setPosition' must have class/struct/union
1> type is 'int'
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(12): error C2228: left of '.textureInit' must have class/struct/union
1> type is 'int'
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(13): error C2228: left of '.setPosition' must have class/struct/union
1> type is 'int'
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(15): error C2664: 'TerrainWindow::AddDrawableToVector' : cannot convert parameter 1 from 'int' to 'Entity'
1> Source or target has incomplete type
1>r:\users\bryton\documents\visual studio 2010\projects\terraingeneration\terraingeneration\main.cpp(16): error C2664: 'TerrainWindow::AddDrawableToVector' : cannot convert parameter 1 from 'int' to 'Entity'
1> Source or target has incomplete type
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
[/quote]
main.cpp
[code]
#include "TerrainWindow.hpp"
#include "Entity.hpp"
int main()
{
TerrainWindow wnd;
wnd.CreateTerrainWindow(800, 600, 32, "Test of SFML Engine");
Entity ent, ent2;
ent.textureInit("dot.png");
ent.setPosition(10.0f, 10.0f);
ent2.textureInit("dot.png");
ent2.setPosition(100.0f, 100.0f);
wnd.AddDrawableToVector(ent);
wnd.AddDrawableToVector(ent2);
wnd.TerrainWindowLoop();
}
//
[/code]
TerrainWIndow.hpp
[code]#include "BasicInclude.h"
#include "Entity.hpp"
class TerrainWindow
{
// terrain window
public:
void CreateTerrainWindow(int width, int height, int bits, std::string title);
// sf::RenderWindow GetTerrainWindow();
void TerrainWindowLoop();
// bool GetState();
// void SetState(bool running);
void CreateSinWave();
void AddDrawableToVector(Entity newDrawable);
void Draw();
protected:
sf::RenderWindow Wnd;
// bool isRunning;
// sf::Sprite sinWave;
std::vector<Entity> sprites;
};
void TerrainWindow::CreateTerrainWindow(int width, int height, int bits, std::string title)
{
Wnd.create(sf::VideoMode(width, height, bits), title);
}
void TerrainWindow::AddDrawableToVector(Entity newDrawable)
{
sprites.push_back(newDrawable);
}
void TerrainWindow::Draw()
{
for(int i = 0; i <= sprites.size(); i++)
{
Wnd.draw(sprites.at(i));
std::cout << i << "\n";
std::cout << sprites.size();
}
}
void TerrainWindow::TerrainWindowLoop()
{
while(Wnd.isOpen())
{
sf::Event events;
while (Wnd.pollEvent(events))
{
if (events.type == sf::Event::Closed)
Wnd.close();
}
Wnd.clear();
TerrainWindow::Draw();
Wnd.display();
}
}
[/code]
Entity.hpp
[code]
#include "BasicInclude.h"
class Entity : public sf::Sprite
{
public:
void textureInit(std::string file);
private:
sf::Texture texture;
};
void Entity::textureInit(std::string file)
{
if(!texture.loadFromFile(file))
{
std::cout << "Error opening " << file << "\n";
}
else
{
this->setTexture(texture);
}
}[/code]
[QUOTE=darkrei9n;35829231]Trying to generate indices for a cube, anyone know any equations?[/QUOTE]
Do it by hand in your head?
[cpp]
DebugVertex_t cubeVerts[] =
{
//POSITION - TOP
{glm::vec3(vecMin.x, vecMax.y, vecMin.y), color}, //LEFT BACK
{glm::vec3(vecMax.x, vecMax.y, vecMin.y), color}, //RIGHT BACK
{glm::vec3(vecMin.x, vecMax.y, vecMax.y), color}, //LEFT FRONT
{glm::vec3(vecMax.x, vecMax.y, vecMax.y), color}, //RIGHT FRONT
//POSITION - BOTTOM
{glm::vec3(vecMin.x, vecMin.y, vecMin.y), color}, //LEFT BACK
{glm::vec3(vecMax.x, vecMin.y, vecMin.y), color}, //RIGHT BACK
{glm::vec3(vecMin.x, vecMin.y, vecMax.y), color}, //LEFT FRONT
{glm::vec3(vecMax.x, vecMin.y, vecMax.y), color}, //RIGHT FRONT
};
//Create some Indexes
unsigned int crossIndexes[] =
{
//TOP
0, 1,
2, 3,
0, 2,
1, 3,
//BOTTOM
4, 5,
6, 7,
4, 6,
5, 7,
//SIDES
0, 4,
1, 5,
2, 6,
3, 7,
};
m_iIndexCount = 24;
[/cpp]
[QUOTE=Lord Ned;35829584]Do it by hand in your head?
[cpp]
DebugVertex_t cubeVerts[] =
{
//POSITION - TOP
{glm::vec3(vecMin.x, vecMax.y, vecMin.y), color}, //LEFT BACK
{glm::vec3(vecMax.x, vecMax.y, vecMin.y), color}, //RIGHT BACK
{glm::vec3(vecMin.x, vecMax.y, vecMax.y), color}, //LEFT FRONT
{glm::vec3(vecMax.x, vecMax.y, vecMax.y), color}, //RIGHT FRONT
//POSITION - BOTTOM
{glm::vec3(vecMin.x, vecMin.y, vecMin.y), color}, //LEFT BACK
{glm::vec3(vecMax.x, vecMin.y, vecMin.y), color}, //RIGHT BACK
{glm::vec3(vecMin.x, vecMin.y, vecMax.y), color}, //LEFT FRONT
{glm::vec3(vecMax.x, vecMin.y, vecMax.y), color}, //RIGHT FRONT
};
//Create some Indexes
unsigned int crossIndexes[] =
{
//TOP
0, 1,
2, 3,
0, 2,
1, 3,
//BOTTOM
4, 5,
6, 7,
4, 6,
5, 7,
//SIDES
0, 4,
1, 5,
2, 6,
3, 7,
};
m_iIndexCount = 24;
[/cpp][/QUOTE]
Need to be able to do it for any size cube. Essentially setting up a function to create a cube that can be any size depending on arguments.
[QUOTE=darkrei9n;35829706]Need to be able to do it for any size cube. Essentially setting up a function to create a cube that can be any size depending on arguments.[/QUOTE]
Indexes don't change. Either way the code above should get you a cube that's the size of the mins/maxs.
[QUOTE=Lord Ned;35829767]Indexes don't change. Either way the code above should get you a cube that's the size of the mins/maxs.[/QUOTE]
As in a 4x4x4 vertex cube or a 2x2x2 vertex cube. So the indices do change in this case.
[QUOTE=krassell;35823832]I need real quick way to write symbol-by-symbol to the console.
putchar() takes shameful amount of time to fill 80*50.
I don't really care how hacky it will be, speed is what matters.
Oh also, that is, in C++.[/QUOTE]
[cpp]
char buff[80*50];
memset(buff, 'X', sizeof(buff));
write(1, buff, sizeof(buff));
[/cpp]
[QUOTE=krassell;35823832]I need real quick way to write symbol-by-symbol to the console.
putchar() takes shameful amount of time to fill 80*50.
I don't really care how hacky it will be, speed is what matters.
Oh also, that is, in C++.[/QUOTE]
Curses.
Hey guys. I solved my compile issues (turns out you need a ";" after the "}" when declaring a class...), and I think I've managed to figure out how I want to make my manager object.
However, I now have a new issue.
The object class I made is, as before, called [b]ManagerObject_Sound[/b].
In my manager class, which is [b]Manager_Sound[/b], I decided to use a vector, since darkrei9n brought them to my attention and they sound awesome. Using the generic form of "std::vector<DATA TYPE> VARNAME;", I do such:
[code]
class Manager_Sound {
public:
std::vector<ManagerObject_Sound> ObjectVector;
Manager_Sound();
};[/code]
However, doing so, I get this error: [code]1>c:\users\jason\documents\visual studio 2008\projects\ragnarok_client\ragnarok_client\manager_sound.cpp(8) : error C2065: 'ManagerObject_Sound' : undeclared identifier[/code]
I've replaced the "ManagerObject_Sound" in that vector declaration with "int," and it works fine, so it's not the vector.
Any ideas? Google didn't bring up much for me.
Seems to me that the compiler cannot find your datatype for ManagerObject_Sound. Did you include it?
[QUOTE=Topgamer7;35830234]Seems to me that the compiler cannot find your datatype for ManagerObject_Sound. Did you include it?[/QUOTE]
Do I need to? :v:
The file's name is "manobj_sound.cpp". I just tried simply doing "include <manobj_sound>", but it says it can't include manobj_sound.
Forgive the newbiness / stupidity, but the tutorials I've seen about classes all seem to be pretty hazy about this stuff, so I really don't know about this, and I don't really have any friends that can help me out much here, so you guys are my only hope when Google turns up nothing that I find very useful.
[QUOTE=Gmod4ever;35830277]Do I need to? :v:
The file's name is "manobj_sound.cpp". I just tried simply doing "include <manobj_sound>", but it says it can't include manobj_sound.
Forgive the newbiness / stupidity, but the tutorials I've seen about classes all seem to be pretty hazy about this stuff, so I really don't know about this, and I don't really have any friends that can help me out much here, so you guys are my only hope when Google turns up nothing that I find very useful.[/QUOTE]
#include only includes the file for that file that calls it along with any files called by the file you just included.
Let me show you the hierarchy for my project, might help you understand #include better.
Okay nevermind, VS11 doesn't want to generate the graph of my include files.
Think about it like a hirearchy. Main could include <iostream> and you could have two headers include main, but as far as those two files are concerned unless you include the other they don't exist. Anything that main included they acknowledge but nothing else.
#include <ashdasd>
is different from
#include "askjdfasd"
See here: [url]http://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename[/url]
You would need to do #include "manobj_sound.cpp", and typically you would want to do the header file instead.
As a side note, [url]http://cplusplus.com[/url] is great for language and function reference.
[QUOTE=Topgamer7;35830344]#include <ashdasd>
is different from
#include "askjdfasd"
See here: [url]http://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename[/url]
You would need to do #include "manobj_sound.cpp", and typically you would want to do the header file instead.
As a side note, [url]http://cplusplus.com[/url] is great for language and function reference.[/QUOTE]
[del]Fair enough. My object doesn't have a header, though. Should I make it one, and if so, what all should be in it?
Also, doing [i]#include "manobj_sound.cpp"[/i] in the file for for my manager alleviated that issue, but now I have a new issue:
[code]1>manobj_sound.obj : error LNK2005: "public: __thiscall ManagerObject_Sound::ManagerObject_Sound(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0ManagerObject_Sound@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in manager_sound.obj
1>manobj_sound.obj : error LNK2005: "public: class sf::SoundBuffer __thiscall ManagerObject_Sound::GetBuffer(void)" (?GetBuffer@ManagerObject_Sound@@QAE?AVSoundBuffer@sf@@XZ) already defined in manager_sound.obj
1>manobj_sound.obj : error LNK2005: "public: bool __thiscall ManagerObject_Sound::IsCorrectBuffer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?IsCorrectBuffer@ManagerObject_Sound@@QAE_NV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) already defined in manager_sound.obj[/code]
And I have no idea what that means. I see it's referring to the functions in my ManagerObject_Sound, though, whose code is as thus:
[code]#include <SFML/Audio.hpp>
using namespace std;
class ManagerObject_Sound {
public:
string filepath;
sf::SoundBuffer buffer;
ManagerObject_Sound(string);
sf::SoundBuffer GetBuffer();
bool IsCorrectBuffer(string);
};
ManagerObject_Sound::ManagerObject_Sound(string fpath)
{
filepath = fpath;
buffer.LoadFromFile(fpath);
};
sf::SoundBuffer ManagerObject_Sound::GetBuffer()
{
return buffer;
};
bool ManagerObject_Sound::IsCorrectBuffer(string fpath)
{
return (filepath==fpath);
};[/code][/del]
Nevermind, I figured it out. I'm glad I downloaded the source code for the open-source Roguelike "Cataclysm" (had to recompile it myself, with a provided hotfix), because I just looked at how they handle .cpp's and .h's. That stackoverflow thread you linked me to helped as well, with the examples posted in it.
Thanks a lot guys.
[editline]Fish[/editline]
[QUOTE=Topgamer7;35830791]in your header you should have
[code]class ManagerObject_Sound {
public:
string filepath;
sf::SoundBuffer buffer;
ManagerObject_Sound(string);
sf::SoundBuffer GetBuffer();
bool IsCorrectBuffer(string);
};[/code]
and in your class file
[code]ManagerObject_Sound::ManagerObject_Sound(string fpath)
{
filepath = fpath;
buffer.LoadFromFile(fpath);
};
sf::SoundBuffer ManagerObject_Sound::GetBuffer()
{
return buffer;
};
bool ManagerObject_Sound::IsCorrectBuffer(string fpath)
{
return (filepath==fpath);
};[/code]
I suggest you read through the language tutorial on [url]http://cplusplus.com[/url]. It will help with these problems, and give you the knowledge to fix some problems you may come up with soon.
Don't forget to include the header file in your class definition. And include your header instead of the class file in your other files.
And also you don't need the using namespace std; if you aren't going to use code from the standard library. Typically its just a good idea to access the namespace with the modifier std::[/QUOTE]
Yeah, I went through the entirety of the tutorial on that site (that's where I started), and it doesn't really explain any of this stuff that well at all. Trust me, I've looked at it enough times.
I already established that, as you can see in my post edit - having actual source code to reference helps me a lot in these things.
And I know about needing to use the std namespace, and how it's generally better to prefix things with std:: - the only reason that's there is legacy code when I was trying to figure out what was going wrong with the vector thing.
Like I said, though, I've got it all figured out. Thanks a lot.
in your header you should have
[code]class ManagerObject_Sound {
public:
string filepath;
sf::SoundBuffer buffer;
ManagerObject_Sound(string);
sf::SoundBuffer GetBuffer();
bool IsCorrectBuffer(string);
};[/code]
and in your class file
[code]ManagerObject_Sound::ManagerObject_Sound(string fpath)
{
filepath = fpath;
buffer.LoadFromFile(fpath);
};
sf::SoundBuffer ManagerObject_Sound::GetBuffer()
{
return buffer;
};
bool ManagerObject_Sound::IsCorrectBuffer(string fpath)
{
return (filepath==fpath);
};[/code]
I suggest you read through the language tutorial on [url]http://cplusplus.com[/url]. It will help with these problems, and give you the knowledge to fix some problems you may come up with soon.
Don't forget to include the header file in your class definition. And include your header instead of the class file in your other files.
And also you don't need the using namespace std; if you aren't going to use code from the standard library. Typically its just a good idea to access the namespace with the modifier std::
Well, I got the manager working beautifully. It only creates a buffer for a sound if said sound hasn't been played yet, and then it stores that buffer so if the sound is played again, it will simply point to the stored buffer instead, which is exactly what I wanted. I couldn't have asked for the manager to work more beautifully.
Now I have an issue of the sound simply not playing.
I have it set up so, every 3 seconds, it will play a sound, and that works just fine - it creates the buffer the first time it tries to play, then just points to the cached buffer every subsequent time, and it does indeed print my debug when it attempts to play, but it just doesn't make a noise.
I know that the buffer is valid, the buffer is loading the file, and the sound is loading the buffer, because if I give a bad filepath, then it will yell at me that the buffer wasn't able to load the file.
I am using SFML for this, using a standard sf::SoundBuffer and sf::Sound, using Sound.Play() after it's loaded the buffer, which is done after the buffer loads from file.
I looked it up, and it seems like no one really has this problem, and if they do, it's because of a simple mistake or missing .dll - neither of which applies to me.
:(.
[b]Just for clarification:[/b] the two sounds I am using are "explode1.wav," from the HL2 "Source Sounds.gcf", and the "creeper1.ogg" from Minecraft.
Is it set to automatically loop and are you using pause() or stop() to stop playing?
[QUOTE=darkrei9n;35831828]Is it set to automatically loop and are you using pause() or stop() to stop playing?[/QUOTE]
As far as I know, it's not set to automatically loop, and I'm not stopping it at all.
The issue is it's not playing at all.
[QUOTE=Gmod4ever;35831852]As far as I know, it's not set to automatically loop, and I'm not stopping it at all.
The issue is it's not playing at all.[/QUOTE]
Are you sure the volume variable is set to 100, By default it should be but you may want to double check.
Post Code.
Relevant code is as follows:
[b]SoundManager_Object (.h, then .cpp):[/b]
[code]#ifndef _MANOBJ_SOUND_H_
#define _MANOBJ_SOUND_H_
#include <SFML/Audio.hpp>
using namespace std;
class ManagerObject_Sound {
public:
string filepath;
sf::SoundBuffer buffer;
ManagerObject_Sound(string);
sf::SoundBuffer GetBuffer();
bool IsCorrectBuffer(string);
};
#endif[/code]
[code]ManagerObject_Sound::ManagerObject_Sound(string fpath)
{
filepath = fpath;
buffer.LoadFromFile(fpath);
};
sf::SoundBuffer ManagerObject_Sound::GetBuffer()
{
return buffer;
};[/code]
[b]SoundManager:[/b]
[code]bool Manager_Sound::PlaySoundInternal(string fpath,bool loop,float pitch, float volume,float x, float y, float z,bool disable_spatialization, float mindist, float atten)
{
bool NewBuffer = false;
CacheBufferIndex(fpath);
if (!HasBuffer(fpath)) // We don't have a buffer for this? We better make one!
{
// First create the object and push it
ManagerObject_Sound bufferObj(fpath);
ObjectVector.push_back(bufferObj);
// Then use it to play a sound
sf::Sound SoundInstance(bufferObj.GetBuffer()); // This instance of the constructor should do SetBuffer, but I included SetBuffer to see if it made a difference. It didn't.
SoundInstance.SetBuffer(bufferObj.GetBuffer());
SoundInstance.SetVolume(volume);
SoundInstance.SetPitch(pitch);
SoundInstance.SetLoop(loop);
SoundInstance.SetPosition(x,y,z);
SoundInstance.SetRelativeToListener(disable_spatialization);
SoundInstance.SetMinDistance(mindist);
SoundInstance.SetAttenuation(atten);
SoundInstance.Play();
NewBuffer = true;
}
else
{ // We already have a buffer for this; just use that buffer
ManagerObject_Sound bufferObj = ObjectVector[CachedBufferIndex];
// Then use it to play a sound
sf::Sound SoundInstance(bufferObj.GetBuffer());
SoundInstance.SetVolume(volume);
SoundInstance.SetPitch(pitch);
SoundInstance.SetLoop(loop);
SoundInstance.SetPosition(x,y,z);
SoundInstance.SetRelativeToListener(disable_spatialization);
SoundInstance.SetMinDistance(mindist);
SoundInstance.SetAttenuation(atten);
SoundInstance.Play();
NewBuffer = false;
}
// At the end of the day, return whether or not we had to make a new buffer.
return NewBuffer;
}
bool Manager_Sound::PlaySound(string fpath)
{
return PlaySoundInternal(fpath,false,1.f,100.f,0.f,0.f,0.f,true,1,1);
}[/code]
[b]MasterManager (.h, then .cpp):[/b]
[code]#ifndef _MASTER_MANAGER_H_
#define _MASTER_MANAGER_H_
#include <SFML/System.hpp>
#include "manager_sound.h"
class MasterManager {
public:
Manager_Sound SoundManager;
MasterManager();
};
#endif[/code]
[code]#include "master_manager.h"
MasterManager::MasterManager()
{
};[/code]
[b]main[/b]
[code]int main()
{
float nextSoundTest = 3.f;
// Initialize ALL the things!
// Initialize the master manager, which will, in turn, initialize all the submanagers.
MasterManager ManagerMaster;
// Open up the window
sf::Window App(sf::VideoMode(800, 600, 32), "Hi there");
sf::Clock Clock;
while (App.IsOpened())
{
// Test
if (Clock.GetElapsedTime() > nextSoundTest)
{
nextSoundTest = Clock.GetElapsedTime() + 3.f;
bool nBuffer = ManagerMaster.SoundManager.PlaySound("resources/stinger_fire1.wav");
cout << "Played sound. New buffer? " << nBuffer << std::endl;
}
}
}[/code]
Note that the first time the sound plays, it does indeed say that it created a new buffer (returns 1), and all subsequent times, it returns 0 (new buffer not made).
try returning the offset on the sound rather than false. If you notice that its not moving call stop when its done.
[QUOTE=darkrei9n;35832104]try returning the offset on the sound rather than false. If you notice that its not moving call stop when its done.[/QUOTE]
I'm not sure what that's supposed to accomplish. It prints zero on return, as it should, since I'm printing in the very same frame I'm trying to play, and since it makes a new sound instance every time, it doesn't give me progress on existing sound objects.
Sorry, maybe it's because I'm tired (I'm actually heading off to bed right after this post), but I just don't really see the goal of that right now. Thanks for trying, though. :).
[QUOTE=Gmod4ever;35832152]I'm not sure what that's supposed to accomplish. It prints zero on return, as it should, since I'm printing in the very same frame I'm trying to play, and since it makes a new sound instance every time, it doesn't give me progress on existing sound objects.
Sorry, maybe it's because I'm tired (I'm actually heading off to bed right after this post), but I just don't really see the goal of that right now. Thanks for trying, though. :).[/QUOTE]
Goal is to see if the sound is resetting to 0 seconds properly. Try calling stop before playing it again to ensure its reset to the start of the sound.
Just saying, in your class implementation files (.cpp) you are terminating the function curly brackets with semicolons.
Not sure it effects a whole lot but that should be reserved for class declaration, not function implementation
I'm trying to use TinyThread for a loading-routine. I've already got the loading-function up, and I've made it so that when it returns true, the program assumes it's done loading, and moves on.
However, there doesn't seem to be any proper tutorials on how to use it. There is only this -> [url]http://tinythread.sourceforge.net/?page=functionality[/url]
It doesn't seem too complicated, but I'm not sure how to use it. Could anyone help?
Sorry, you need to Log In to post a reply to this thread.