In vb, how do you make the form scroll to the left without using scroll bars.
How could I set it to a timer?
[QUOTE=Soviet_Banter;33517203]Isn't an abstract method
[code]
virtual void methodName()=0;
//not
virtual void methodName()=0{}
[/code][/QUOTE]
Not here, the method in the base class actually does something (I snipped it though).
[QUOTE=NovembrDobby;33524295]Not here, the method in the base class actually does something (I snipped it though).[/QUOTE]
You don't use the = 0 unless you're doing pure virtual methods.
Another gotcha is that you can't call virtual methods from the base class and expect to have the derived class's method called.
[QUOTE=Octave;33517150]Those are Unix timestamps, what are you supposed to be figuring out?[/QUOTE]
I have no idea. I guess it's just to fill in the blanks. It's for "The Hard Game." I figured I would post it here, unless you think there would be a better place.
The first one is Fri, 30 Sep 2011 19:06:36 GMT and the second one is Fri, 30 Sep 2011 19:08:00 GMT
1 minute 24 seconds in between? I don't know.
[QUOTE=Jookia;33524384]You don't use the = 0 unless you're doing pure virtual methods.
Another gotcha is that you can't call virtual methods from the base class and expect to have the derived class's method called.[/QUOTE]
There may be reasons to implement a pure virtual method.
And you [i]can[/i] specify the exact function to call via [cpp]ptr->Baseclass::Function();[/cpp]
[editline]1st December 2011[/editline]
Argh, nevermind. Misread the second statement.
Apart from the constructor (and the functions called from it), where would the derived class' method not be called?
[QUOTE=ZeekyHBomb;33526978]There may be reasons to implement a pure virtual method.
And you [i]can[/i] specify the exact function to call via [cpp]ptr->Baseclass::Function();[/cpp]
[editline]1st December 2011[/editline]
Argh, nevermind. Misread the second statement.
Apart from the constructor (and the functions called from it), where would the derived class' method not be called?[/QUOTE]
In any method in the base class IIRC.
On any method declared virtual it will call the 'proper' function.
[cpp]struct A
{
virtual void v0(){ f0(); /*will always call A::f0*/ }
virtual void v1(){ v0(); /*will call A::v0 if of type A, B::v0 of of type B (presuming no one except B derives from A and overrides v1)*/}
void f0(){ v0(); /*will call A::v0 if of type A, B::v0 of of type B (presuming no one except B derives from A and overrides v1)*/}
void f1(){ A::v0(); /*will always call A::v0*/ }
};
struct B : A
{
virtual void v0(){ f0(); /*will always call B::f0*/ v1(); /*will always call B::v1 (presuming no one derives from B and overrides v1)*/ }
virtual void v1(){ A::v0(); /*will always call A::v0*/ }
void f0(){}
};[/cpp]
But yeah, rules are different if you're in the middle of constructing the object.
Hey guys, I am really getting annoyed with my python assignment and I really hope someone can help me out. Here is the fuction that I created for creating a random walk that should create a 2 circles with a line joining them each time in different directions. But this is what I am currently getting.
[IMG]http://i42.tinypic.com/2u7oyo6.png[/IMG]
The line is suppose to change direction from the previous point which is really throwing me off.
I can upload the rest of the code if needed it uses the graphics module from zelle python textbook.
[CODE]def takeNSteps(steps, win, pause, walk):
x1 = 287.5
y1 = 262.5
x2 = 287.5
y2 = 262.5
point1 = Point(x1,y1)
circle = Circle(point1, 2)
circle.setFill("black")
circle.draw(win)
for i in range(steps):
angle = random() * 2 * pi
x1 = x2 + cos(angle)
y1 = y2 + sin(angle)
print(x1,y1)
point1 = Point(x1,y1)
angle = random() * 2 * pi
x2 = x1 + cos(angle) + 50
y2 = y1 + sin(angle) + 50
walkText = "(x = "+str(round(x2,1)) + ", y= "+str(round(y2,1)) + ")"
walk.setText(walkText)
print(x2,y2)
point2 = Point(x2,y2)
circle2 = Circle(point2, 2)
circle2.setFill("black")
circle2.draw(win)
line = Line(point1, point2)
line.draw(win)
sleep(pause)
[/CODE]
Thanks I can really use any help :D
Can someone help me with getting sound amplitude (sound energy) with FMOD? Basically I am trying to do beat detection. I understand how beat detection works/should work, but I can't seem to get the amplitude from FMOD. I feel like I am missing a huge point. I know how to get and work on the spectrum data, but I can't figure out how to use that as an average and instant value to do comparisons and detect beats.
[code][jookia@jookia-arch SFML]$ g++ SFML.cpp -I../../include -L../../lib/linux -unittest -lgwen_static -lsfml-window -lsfml-graphics -lGWEN-Renderer-SFML
/tmp/cc5DKjoI.o: In function `main':
SFML.cpp:(.text+0x25f): undefined reference to `UnitTest::UnitTest(Gwen::Controls::Base*)'
/tmp/cc5DKjoI.o:(.rodata._ZTIN4Gwen4Skin12TexturedBaseE[typeinfo for Gwen::Skin::TexturedBase]+0x10): undefined reference to `typeinfo for Gwen::Skin::Base'
collect2: ld returned 1 exit status[/code]
Help please? I'm trying to compile GWEN, but I get this single linker error.
-snip-
[QUOTE=Jookia;33524384]Another gotcha is that you can't call virtual methods from the base class and expect to have the derived class's method called.[/QUOTE]
[QUOTE=ZeekyHBomb;33526978]Apart from the constructor (and the functions called from it), where would the derived class' method not be called?[/QUOTE]
[QUOTE=Jookia;33527105]In any method in the base class IIRC.[/QUOTE]
Are you sure? I know calling virtual functions in the base class constructor\destructor is useless because the derived class doesn't exist yet\is already destructed. But at any other time?
For some reason my game crashes as soon as a state changes.
this is thee state manager but cant find anything wrong, also this happens in linux but not windows
[cpp]
void IGameStateManager::Init()
{
}
const std::vector<IGameState*> &IGameStateManager::States()
{
return states;
}
void IGameStateManager::Cleanup()
{
// cleanup the all states
while ( !states.empty() )
{
states.back()->Cleanup();
states.pop_back();
}
}
void IGameStateManager::ChangeState(IGameState* state)
{
// cleanup the current state
if ( !states.empty() )
{
states.back()->Cleanup();
states.pop_back();
}
// store and init the new state
states.push_back(state);
states.back()->Init();
}
void IGameStateManager::PushState(IGameState* state)
{
// pause current state
if ( !states.empty() )
{
states.back()->Pause();
}
// store and init the new state
states.push_back(state);
states.back()->Init();
}
void IGameStateManager::PopState()
{
// cleanup the current state
if ( !states.empty() )
{
states.back()->Cleanup();
states.pop_back();
}
// resume previous state
if ( !states.empty() )
{
states.back()->Resume();
}
}
void IGameStateManager::HandleEvents(sf::Event &Event)
{
// let the state handle events
if(!states.empty())
states.back()->HandleEvents(Event);
}
void IGameStateManager::Update()
{
// let the state update the game
if(!states.empty())
states.back()->Update();
}
void IGameStateManager::Draw()
{
// let the state draw the screen
if(!states.empty())
states.back()->Draw();
}
void IGameStateManager::DrawSFML()
{
// let the state draw the screen
if(!states.empty()){
states.back()->DrawSFML();
}
return;
}
[/cpp]
the main things are the pop and change state methods
[QUOTE=Richy19;33534651]For some reason my game crashes as soon as a state changes.
this is thee state manager but cant find anything wrong, also this happens in linux but not windows
[cpp]
code
[/cpp]
the main things are the pop and change state methods[/QUOTE]
It's possible you're pushing in null pointers, so you'd want to check to make sure the pointer isn't equal to zero in PushState.
I'm not sure why it'd be crashing only on Linux, either. If you're using an ATI card and some particular version of SFML then it will crash regardless of what you do because that build of SFML is broken for Linux+ATI.
[QUOTE=Jookia;33524384]You don't use the = 0 unless you're doing pure virtual methods.[/quote]
Hmm, that = 0 slipped through, it's not there in the actual code I'm using (which all works now).
[QUOTE=mechanarchy;33533657]Are you sure? I know calling virtual functions in the base class constructor\destructor is useless because the derived class doesn't exist yet\is already destructed. But at any other time?[/QUOTE]
Back in June I did a test on that, and somehow I forgot that it's only in the constructor, and that [url=https://gist.github.com/1022374]this code works fine[/url].
Nope, i ave an intel graphics and it uses tugsten drivers(or something)
I added a null check but stll nothing.
I tied valgrind wiht it and ot this
[code]richy@R-Laptop:~/Dropbox/LopLinux/bin/Release$ valgrind ./Legend\ of\ Pedro
==11141== Memcheck, a memory error detector
==11141== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==11141== Using Valgrind-3.6.1-Debian and LibVEX; rerun with -h for copyright info
==11141== Command: ./Legend\ of\ Pedro
==11141==
==11141== Invalid read of size 4
==11141== at 0x4C3E0F2: _mesa_make_extension_string (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==11141== by 0x4C185F7: _mesa_make_current (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==11141== by 0x4B3E850: intelMakeCurrent (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==11141== by 0x4B3296E: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==11141== by 0x4434B8C: ??? (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==11141== by 0x440CB96: glXMakeContextCurrent (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==11141== by 0x440CD22: glXMakeCurrent (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==11141== by 0x423C112: (below main) (libc-start.c:226)
==11141== Address 0x47b5728 is 0 bytes inside a block of size 1 alloc'd
==11141== at 0x402732C: calloc (vg_replace_malloc.c:467)
==11141== by 0x4C3E2BE: _mesa_make_extension_string (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==11141== by 0x4C185F7: _mesa_make_current (in /usr/lib/i386-linux-gnu/dri/libdricore.so)
==11141== by 0x4B3E850: intelMakeCurrent (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==11141== by 0x4B3296E: ??? (in /usr/lib/i386-linux-gnu/dri/i965_dri.so)
==11141== by 0x4434B8C: ??? (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==11141== by 0x440CB96: glXMakeContextCurrent (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==11141== by 0x440CD22: glXMakeCurrent (in /usr/lib/i386-linux-gnu/mesa/libGL.so.1.2)
==11141== by 0x423C112: (below main) (libc-start.c:226)
==11141==
==11141== Syscall param writev(vector[...]) points to uninitialised byte(s)
==11141== at 0x42ECD84: writev (writev.c:51)
==11141== by 0x40004: ???
==11141== Address 0x6e776ac is 36 bytes inside a block of size 16,384 alloc'd
==11141== at 0x402732C: calloc (vg_replace_malloc.c:467)
==11141== by 0x455F551: XOpenDisplay (in /usr/lib/i386-linux-gnu/libX11.so.6.3.0)
==11141== by 0x40DE2E3: sf::priv::WindowImplX11::WindowImplX11(sf::VideoMode, std::string const&, unsigned long) (in /usr/local/lib/libsfml-window.so.2.0)
==11141== by 0x40D9D03: sf::priv::WindowImpl::New(sf::VideoMode, std::string const&, unsigned int) (in /usr/local/lib/libsfml-window.so.2.0)
==11141== by 0x423C112: (below main) (libc-start.c:226)
==11141==
Using resolution: 800x600
==11141== Mismatched free() / delete / delete []
==11141== at 0x4027C02: free (vg_replace_malloc.c:366)
==11141== by 0x4557B18: ??? (in /usr/lib/i386-linux-gnu/libX11.so.6.3.0)
==11141== by 0x40DD97C: sf::priv::WindowImplX11::SetIcon(unsigned int, unsigned int, unsigned char const*) (in /usr/local/lib/libsfml-window.so.2.0)
==11141== by 0x40D91FD: sf::Window::SetIcon(unsigned int, unsigned int, unsigned char const*) (in /usr/local/lib/libsfml-window.so.2.0)
==11141== by 0x423C112: (below main) (libc-start.c:226)
==11141== Address 0x707ece0 is 0 bytes inside a block of size 4,096 alloc'd
==11141== at 0x4027F65: operator new[](unsigned int) (vg_replace_malloc.c:299)
==11141== by 0x40DD7CB: sf::priv::WindowImplX11::SetIcon(unsigned int, unsigned int, unsigned char const*) (in /usr/local/lib/libsfml-window.so.2.0)
==11141== by 0x40D91FD: sf::Window::SetIcon(unsigned int, unsigned int, unsigned char const*) (in /usr/local/lib/libsfml-window.so.2.0)
==11141== by 0x423C112: (below main) (libc-start.c:226)
==11141==
Using OpenGL 2.1
Using GLEW 1.6.0
Using an Tungsten Graphics, Inc graphics card.
Loading file: ./Data/PalmTree.png
Loading file: ./Data/MenuBackground.png
Loading file: ./Data/pedro.png
Compiling shader : ./Data/vert.vert
Compiling shader : ./Data/frag.frag
Linking program
Compiling shader : ./Data/vert.vert
Compiling shader : ./Data/frag.frag
Linking program
Compiling shader : ./Data/vert.vert
Compiling shader : ./Data/frag.frag
Linking program
==11141== Conditional jump or move depends on uninitialised value(s)
==11141== at 0x406656A: sf::Renderer::SetShader(sf::Shader const*) (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x4067959: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x8065141: ??? (in /home/richy/Dropbox/LopLinux/bin/Release/Legend of Pedro)
==11141== by 0x5: ???
==11141==
==11141== Conditional jump or move depends on uninitialised value(s)
==11141== at 0x4066398: sf::Renderer::SetBlendMode(sf::Blend::Mode) (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x404F433: sf::Drawable::Draw(sf::RenderTarget&, sf::Renderer&) const (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x406796D: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x8065141: ??? (in /home/richy/Dropbox/LopLinux/bin/Release/Legend of Pedro)
==11141== by 0x5: ???
==11141==
==11141== Conditional jump or move depends on uninitialised value(s)
==11141== at 0x40664B8: sf::Renderer::SetTexture(sf::Texture const*) (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x406B981: sf::Sprite::Render(sf::RenderTarget&, sf::Renderer&) const (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x404F447: sf::Drawable::Draw(sf::RenderTarget&, sf::Renderer&) const (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x406796D: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x8065141: ??? (in /home/richy/Dropbox/LopLinux/bin/Release/Legend of Pedro)
==11141== by 0x5: ???
==11141==
==11141== Conditional jump or move depends on uninitialised value(s)
==11141== at 0x406656A: sf::Renderer::SetShader(sf::Shader const*) (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x4067959: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x806583F: ??? (in /home/richy/Dropbox/LopLinux/bin/Release/Legend of Pedro)
==11141== by 0x5: ???
==11141==
==11141== Conditional jump or move depends on uninitialised value(s)
==11141== at 0x4066398: sf::Renderer::SetBlendMode(sf::Blend::Mode) (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x404F433: sf::Drawable::Draw(sf::RenderTarget&, sf::Renderer&) const (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x406796D: sf::RenderTarget::Draw(sf::Drawable const&) (in /usr/local/lib/libsfml-graphics.so.2.0)
==11141== by 0x806583F: ??? (in /home/richy/Dropbox/LopLinux/bin/Release/Legend of Pedro)
==11141== by 0x5: ???
==11141==
==11141==
==11141== HEAP SUMMARY:
==11141== in use at exit: 194,524,603 bytes in 15,198 blocks
==11141== total heap usage: 159,462 allocs, 144,264 frees, 260,959,655 bytes allocated
==11141==
==11141== LEAK SUMMARY:
==11141== definitely lost: 2,108 bytes in 17 blocks
==11141== indirectly lost: 0 bytes in 0 blocks
==11141== possibly lost: 67,413,746 bytes in 7,674 blocks
==11141== still reachable: 127,108,749 bytes in 7,507 blocks
==11141== suppressed: 0 bytes in 0 blocks
==11141== Rerun with --leak-check=full to see details of leaked memory
==11141==
==11141== For counts of detected and suppressed errors, rerun with: -v
==11141== Use --track-origins=yes to see where uninitialised values come from
==11141== ERROR SUMMARY: 16 errors from 8 contexts (suppressed: 95 from 11)
[/code]
[editline]2nd December 2011[/editline]
Its something to do with drawing the main menu
this is how I draw it
[cpp]texture.SetActive();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Dark blue background
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
texture.Draw(backGroundSprite);
texture.Draw(*Play);
texture.Draw(*Options);
texture.Draw(*Quit);
texture.Display();
engine->App->SetActive();
engine->App->Draw(textureSprite);[/cpp]
Is it possible(on x64 windows) to make an OS using C and run it on a flash drive/emulator? I can never get the compiling part. :v: I have Cygwin and nasm, if it helps.
Yes, it is.
Very possible. There's instructions on OsDev, I believe.
[QUOTE=Richy19;33535681]Nope, i ave an intel graphics and it uses tugsten drivers(or something)
I added a null check but stll nothing.
I tied valgrind wiht it and ot this
[code]richy@R-Laptop:~/Dropbox/LopLinux/bin/Release$ valgrind ./Legend\ of\ Pedro
stuff
[/code]
[editline]2nd December 2011[/editline]
Its something to do with drawing the main menu
this is how I draw it
[cpp]code[/cpp][/QUOTE]
Try gdb instead of valgrind.
[cpp]
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class jnihelloworld_Main */
#ifndef _Included_jnihelloworld_Main
#define _Included_jnihelloworld_Main
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT void JNICALL Java_jnihelloworld_Main_nativePrint(JNIEnv *, jobject);
JNIEXPORT int JNICALL Java_jnihelloworld_Main_nativeGet(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif
[/cpp]
Can someone see what's wrong with this C header? I supposedly have to use in in school for some Java to C calls. For some reason Netbeans doesn't like it and think some of the lines are comments.
Not even the teacher knew whats wrong.
Trying to code something in love2D, made this if loop:
[CODE]if v.y & lt; 0 then
table.insert(remShot,i)
end[/CODE]
I get an error saying "then expected near &". What am I doing wrong?
Remove the semicolon.
[editline]2nd December 2011[/editline]
It should probably be a ==, shouldn't it
[editline]2nd December 2011[/editline]
What the fuck are you even trying to accomplish
[QUOTE=esalaka;33536206]Yes, it is.
Very possible. There's instructions on OsDev, I believe.[/QUOTE]
I have a .bin, how would I run it in bochs? :v:
[QUOTE=esalaka;33536298]Remove the semicolon.
[editline]2nd December 2011[/editline]
It should probably be a ==, shouldn't it
[editline]2nd December 2011[/editline]
What the fuck are you even trying to accomplish[/QUOTE]
Trying to learn love so I went on google and found [URL="http://www.headchant.com/2010/12/31/love2d-%E2%80%93-tutorial-part-2-pew-pew/"]this[/URL] tutorial. I don't know if it's outdated or not, but it was made last year so it can't be too old.
And removing the semicolon produces the same error
[csharp]
public void StartListening()
{
int port = 8888;
Thread[] t = new Thread[4];
for (int i = 0; i < 4; i++)
{
t[i] = new Thread(new ThreadStart(ReceiveStart(port)));
port++;
}
}
[/csharp]
Gives me a "Method name expected." error on..
[csharp]
t[i] = new Thread(new ThreadStart(ReceiveStart(port)));
[/csharp]
On what line?
I beat you to it.
What's the code for ReceiveStart?
Sorry, you need to Log In to post a reply to this thread.