Jump to content
Xtreme .Net Talk

Macaco

Avatar/Signature
  • Posts

    40
  • Joined

  • Last visited

Macaco's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Anyone knows how to play several sounds at the same time in a windows form application???? Now I use sndPlaySound from winmm.dll but I can only play one sound with this. I've taken a look at Fmod but it doesn't work with managed classes and I need them to be managed. I also looked openAL but I can't compile with openAl, maybe there is a kind of incompatibility with Visual C++ .NET 2003 In my Application I'm using an OpenGL window, can I use DirectX sound???? DO I have to install just the libs and dlls as I did with opengl?? Do you know any simple tutorial out there? Thanks.
  2. Hello, I've made a form application with visual c++ .net , and when I compile it I have an exe. Then I pass this exe to a friend of mine that has not the .net framework installed ("normal" people usually don't have it, of course) and when he tries to run the exe he gets this error: "The application could not be inicialized properly (0xc000135). Click OK to finish the application." This happens beacause he doesn't have the .NET Framework installed. But how come can it be??? .NET applications cannot run without .net framework ? is it true? I suppose there is a way to put the .net framework libraries or something smaller into my exe, right?????? Thank you for your help
  3. Oh my god, at last! Well, I solved it, it's not a nice way but It works fine!!!!!!!!, I just wanted to call the Loop function once all is loaded, so... because of I have a panel inside the form I call my loop function when the panel first paint handler calls its function: with first_time boolean variable I will control that I will only be done once. Void panel_x_Paint(System::Object * sender, System::Windows::Forms::PaintEventArgs * e) { if (first_time) { first_time = false; LoopFunction(); } } simple and effective. A sincerely thank you to all of you guys! I'll post some images for you to see my project at the beggining of february. Thanks!!! P.D. By the way, pentium guy, I do use c++ .net managed classes, and maybe it brought me more problems than I thought but for me it's the most clean and structured way to program. And the problem with MessageBox sometimes happens to me, you just have to "#undef MessageBox" at the top of the file and it will work.
  4. Well, I solved it, it's not a nice way but It works fine!!!!!!!!, I just wanted to call the Loop function once all is loaded, so... because of I have a panel inside the form I call my loop function when the panel first paint handler calls its function: with first_time boolean variable I will control that I will only be done once. Void panel_x_Paint(System::Object * sender, System::Windows::Forms::PaintEventArgs * e) { if (first_time) { first_time = false; LoopFunction(); } } simple and effective.
  5. I thied to use Visiblechanged event (with the form and woth a component inside the form) calling a function with a simple MessageBox:Show, and it shows it before the form is shown... and Visiblechanged event is the last thing I define... :(
  6. Hello, I need to find an eventHandler to call my function when the form and all its components are just loaded and showed. I looked at MSDN but I don't find anyone, it must be one! Help needed, thanks!
  7. Ok, I just have to find an eventHandler called when the form and it's components are loaded and just showed... Because for example If I made the loop when I click inside the panel (where the opengl scene is) the loop is called and works perfect. So I just have to call it when all is loaded and showed.... I'll keep on investigating...
  8. Yeah, this option was a possible solution, in fact I saw it somewhere and I tried it but it didn't work either. onLoad(){ //this->set_Visible(false); this->ShowDialog(); while(this->Created) { Show->Render(); Application::DoEvents(); } } but then there is an error message that says I must put form property visible to false, and when I do it the error message disapears, but the form is not showed, it does nothing. :( Oh my god! I've tried so many methods :'(
  9. - Ok Napivo, I'll find out about threads... (But I think there should be an easier way) - Hi Pentium Guy, the problem is that I must call it somewhere and depending on where I call it, it reacts different. If I use onLoad form function and I call i there (As I suppose you did), or I call it after all inicializations I can't see opengl window. I have no problems about executing other subs while loop is running. I mean.... I run the application, it inicialites the components and opengl window then once all is done I must call my loop funcion, but if I call it just after that (as onload) It doesn't function correctly, maybe the form inicialites other things after that. So I should use another function which calls my loop after all all all. - Hi George, I have already my object placed in a Panel and using timer function I can render the oepngl view clock after clock in the panel, but I don't want to use timer, i want to use another function call beacuse timer is slow and uneficient. Thank you all !
  10. Yes, I know this loop, but the problem is WHERE do I put it????? Because I've tried many places and It doesn't function correctly. I mean.... do I have to put it inside onLoad function? (NO!!) do I have to put it inside Application::Idle function? (NO!!!) do I have to put it inside timer function? (NO!!!) So where ?????? Thanks.
  11. I have set up my opengl scene in a panel which is inside a form. BUT I NEED A LOOP FUNCTION !!!!! There's no such thing as a message loop. I thought there might be some Idle callback (delegate, whatever) on my Form, so I can plug drawScene() to it, but there wasn't. I found one on the Application object (Application::add_Idle, but it doesn't function correctly), but even after I added an EventHandler to it, it didn't work (the GL view would update only if I moved the mouse really fast in the client area). Besides, Application::Idle is too "global" for my taste. Rigth now, I'm doing it with timers: each 1 ms, I trigger a redraw. But this isn't efficient, and it locks me down to a fixed framerate. And what if the system is too slow? All those unprocessed WM_TIMER messages that would queue up... If anyone has a better idea, I'd appreciate it. thanks!!!! help !
  12. >>Well, I would really not recommend you draw on a label (for now at least, try to get it to draw on the form first). In fact I draw it in a panel. I cannot draw it directly to the form due to application requirements. >>Do you have a game loop? That should refresh the form and the drawing automatically. Now my loop is the timer function, because it calls each millisecond (but I can't draw correctly the fps). But I've tried to create an idle function (without using timer) called by the PaintEventHandler of the panel, but it doesn't function well. I looked at your example but it's completely different from mine. I don't have problems drawing the 3d secene. I just want to create a loop not controlled by the timer function, but I don't know. Here is my central application code. As you can see, in timer1_Tick I have the loop. namespace simpleapp { public __gc class testWindow : public System::Windows::Forms::Form { public: testWindow(void) { InitializeComponent(); Show->Init(this->viewport,"finestra"); } protected: void Dispose(Boolean disposing) { if(rTarget) delete rTarget; if (disposing && components) { components->Dispose(); } __super::Dispose(disposing); } private: System::Windows::Forms::Timer * timer1; private: System::Windows::Forms::Panel * viewport; Scene * Show; // Time float t; float g_FrameInterval; //public: static __event EventHandler* Idle; private: CWinFormTarget *rTarget; private: System::ComponentModel::IContainer * components; void InitializeComponent(void) { //Time g_FrameInterval = 0.0f; this->components = new System::ComponentModel::Container(); this->viewport = new System::Windows::Forms::Panel(); this->timer1 = new System::Windows::Forms::Timer(this->components); this->SuspendLayout(); // viewport this->viewport->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; this->viewport->Location = System::Drawing::Point(10, 10); this->viewport->Name = S"viewport"; this->viewport->Size = System::Drawing::Size(800, 600); this->viewport->TabIndex = 0; // timer1 this->timer1->Enabled = true; this->timer1->Interval = 1; //en milisegons this->timer1->Tick += new System::EventHandler(this, timer1_Tick); // testWindow this->AutoScaleBaseSize = System::Drawing::Size(5, 13); this->ClientSize = System::Drawing::Size(820, 620); this->Controls->Add(this->viewport); this->Name = S"testWindow"; this->Text = S"testWindow"; // Add our OnIdle event to the Applications Idle //Application::add_Idle(new EventHandler(this,OnIdle)); this->ResumeLayout(false); Show = new Scene(); } private: System::Void timer1_Tick(System::Object * sender, System::EventArgs * e) { static float framesPerSecond = 0.0f; // This will store our fps static float lastTime = 0.0f; // This will hold the time from the last frame static char strFrameRate[50] = {0}; // We will store the string here for the window title static float frameTime = 0.0f; // This stores the last frame's time float currentTime = timeGetTime() * 0.001f; // Here we store the elapsed time between the current and last frame, // then keep the current frame in our static variable for the next frame. g_FrameInterval = currentTime - frameTime; frameTime = currentTime; Show->Render(g_FrameInterval); // Increase the frame counter ++framesPerSecond; // Now we want to subtract the current time by the last time that was stored // to see if the time elapsed has been over a second, which means we found our FPS. if( currentTime - lastTime > 1.0f ) { // Here we set the lastTime to the currentTime lastTime = currentTime; sprintf(strFrameRate, "Current Frames Per Second: %f", framesPerSecond); this->Text = strFrameRate; // Reset the frames per second framesPerSecond = 0; } } };
  13. Hello PentiumGuy, I'm specially interested in solving this idle form problem which affects the fps value. I would be very pleased if anyone helped me. The problem is that I don't find anyone who knows it or have put opengl into a panel which is in a form. thanks! P.D. If do you want me to re-write the problem (maybe i didn't explain it very well) I will do it.
  14. Ok, thanks. I solved it fastly by drawing less data samples to get more speed in the draw.
  15. Panels doesn't have these properties :(
×
×
  • Create New...