Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About sqpat

  • Rank
  1. holy poop, you're right. I must have tried showDialog() last time or something, because it took be a day to find out about the no argument version of Show(). Thanks much. Edit: Show, not show.
  2. showdialog requires an IWin32Window or some such argument which i need to build a class wrapper to implement that interface in order to make it work, and im unable to implement its get method.
  3. i've got a form being created and shown as follows://TestProj::dialogInit^ dlg = gcnew TestProj::dialogInit(); //dlg->Show();but when i do this, the form shows up and code continues as normal. i want the code to only continue when the form is closed. i tried a loop but when i do that, the form never responds/refreshes. I assume there needs to be a callback function somehow but i dont know how to make that work for a windows form. where do i declare/supply the callback as an argument, and what kind of callback is it exactly? That kind of stuff. Thanks in advance.
  4. im using c++ because i wrote 5000 lines of code for an engine in directx using c++ and i want to make a cheap gui that can I can use to pass some arguments into the engine. EDIT: okay, this works: TestProj::dialogInit^ dlg = gcnew TestProj::dialogInit(); thanks [Edited by - sqpat on August 23, 2008 3:48:01 PM]
  5. i think it became managed c++ when i used the designer actually as for code.... uh... sure. but the point was i didn't know what to do past the automatically generated code. Here's basically what the designer did for me dialogInit.cpp (untouched from what the designer did for me) #include "dialogInit.h" dialogInit.h (mostly untouched.) #pragma once using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; namespace TestProj { /// <summary> /// Summary for dialogInit /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. /// </summary> public ref class dialogInit : public System::Windows::Forms::Form { public: dialogInit(void) { InitializeComponent(); // //constructor code here // } protected: /// <summary> /// Clean up any resources being used. /// </summary> ~dialogInit() { if (components) { delete components; } } private: System::Windows::Forms::ComboBox^ Musicdropbox; private: System::Windows::Forms::CheckedListBox^ Propertiescheckbox; protected: protected: private: System::Windows::Forms::ComboBox^ Mapdropbox; private: System::Windows::Forms::Label^ label1; private: System::Windows::Forms::Label^ label3; private: System::Windows::Forms::Label^ label4; private: System::Windows::Forms::Button^ okay; private: System::Windows::Forms::Label^ label5; private: System::Windows::Forms::Label^ label7; private: System::Windows::Forms::ComboBox^ Charsdropbox; private: System::Windows::Forms::CheckBox^ Tilefilter; private: System::Windows::Forms::CheckBox^ Spritefilter; private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> void InitializeComponent(void) { this->Musicdropbox = (gcnew System::Windows::Forms::ComboBox()); this->Propertiescheckbox = (gcnew System::Windows::Forms::CheckedListBox()); this->Mapdropbox = (gcnew System::Windows::Forms::ComboBox()); this->label1 = (gcnew System::Windows::Forms::Label()); this->label3 = (gcnew System::Windows::Forms::Label()); this->label4 = (gcnew System::Windows::Forms::Label()); this->okay = (gcnew System::Windows::Forms::Button()); this->label5 = (gcnew System::Windows::Forms::Label()); this->label7 = (gcnew System::Windows::Forms::Label()); this->Charsdropbox = (gcnew System::Windows::Forms::ComboBox()); this->Tilefilter = (gcnew System::Windows::Forms::CheckBox()); this->Spritefilter = (gcnew System::Windows::Forms::CheckBox()); this->SuspendLayout(); // // Musicdropbox // this->Musicdropbox->FormattingEnabled = true; this->Musicdropbox->Location = System::Drawing::Point(139, 35); this->Musicdropbox->MaxDropDownItems = 4; this->Musicdropbox->Name = L"Musicdropbox"; this->Musicdropbox->Size = System::Drawing::Size(121, 24); this->Musicdropbox->TabIndex = 2; this->Musicdropbox->SelectionChangeCommitted += gcnew System::EventHandler(this, &dialogInit::Musicdropbox_SelectionChangeCommitted); // // Propertiescheckbox // this->Propertiescheckbox->Font = (gcnew System::Drawing::Font(L"Arial", 7)); this->Propertiescheckbox->FormattingEnabled = true; this->Propertiescheckbox->Items->AddRange(gcnew cli::array< System::Object^ >(8) {L"Display Wireframes", L"Display Borders", L"Shadowing ", L"FPS cap (H)", L"Alpha Blending (H)", L"Mip Mapping (H)", L"Fog (H)", L"Filtering Support (H)"}); this->Propertiescheckbox->Location = System::Drawing::Point(12, 92); this->Propertiescheckbox->Name = L"Propertiescheckbox"; this->Propertiescheckbox->Size = System::Drawing::Size(155, 68); this->Propertiescheckbox->TabIndex = 4; this->Propertiescheckbox->ItemCheck += gcnew System::Windows::Forms::ItemCheckEventHandler(this, &dialogInit::Propertiescheckbox_ItemCheck); // // Mapdropbox // this->Mapdropbox->FormattingEnabled = true; this->Mapdropbox->Items->AddRange(gcnew cli::array< System::Object^ >(12) {L"Forest", L"Forest 2", L"Forest 3", L"Beach", L"Beach 2", L"Grass", L"Grass 2", L"Grass 3", L"Grass 4", L"Grass 5", L"Indoors", L"Indoors 2"}); this->Mapdropbox->Location = System::Drawing::Point(12, 35); this->Mapdropbox->MaxDropDownItems = 4; this->Mapdropbox->Name = L"Mapdropbox"; this->Mapdropbox->Size = System::Drawing::Size(121, 24); this->Mapdropbox->TabIndex = 1; this->Mapdropbox->SelectionChangeCommitted += gcnew System::EventHandler(this, &dialogInit::Mapdropbox_SelectionChangeCommitted); // // label1 // this->label1->AutoSize = true; this->label1->Location = System::Drawing::Point(9, 72); this->label1->Name = L"label1"; this->label1->Size = System::Drawing::Size(104, 17); this->label1->TabIndex = 6; this->label1->Text = L"Map Properties"; // // label3 // this->label3->AutoSize = true; this->label3->Location = System::Drawing::Point(9, 15); this->label3->Name = L"label3"; this->label3->Size = System::Drawing::Size(35, 17); this->label3->TabIndex = 8; this->label3->Text = L"Map"; // // label4 // this->label4->AutoSize = true; this->label4->Location = System::Drawing::Point(136, 15); this->label4->Name = L"label4"; this->label4->Size = System::Drawing::Size(44, 17); this->label4->TabIndex = 9; this->label4->Text = L"Music"; // // okay // this->okay->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 7.8F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, static_cast<System::Byte>(0))); this->okay->Location = System::Drawing::Point(335, 198); this->okay->Name = L"okay"; this->okay->Size = System::Drawing::Size(75, 27); this->okay->TabIndex = 7; this->okay->Text = L"OK"; this->okay->UseVisualStyleBackColor = true; this->okay->Click += gcnew System::EventHandler(this, &dialogInit::okay_Click_1); // // label5 // this->label5->FlatStyle = System::Windows::Forms::FlatStyle::Flat; this->label5->Location = System::Drawing::Point(207, 92); this->label5->Name = L"label5"; this->label5->Size = System::Drawing::Size(208, 92); this->label5->TabIndex = 11; this->label5->Text = L"(H) Indicates a Hardware Dependent setting. If the program does not work, it is p" L"ossible your hardware doesn\'t support some of these settings."; this->label5->TextAlign = System::Drawing::ContentAlignment::TopCenter; // // label7 // this->label7->AutoSize = true; this->label7->Location = System::Drawing::Point(263, 15); this->label7->Name = L"label7"; this->label7->Size = System::Drawing::Size(147, 17); this->label7->TabIndex = 19; this->label7->Text = L"Number of Characters"; // // Charsdropbox // this->Charsdropbox->FormattingEnabled = true; this->Charsdropbox->Items->AddRange(gcnew cli::array< System::Object^ >(4) {L"1", L"2", L"3", L"4"}); this->Charsdropbox->Location = System::Drawing::Point(266, 35); this->Charsdropbox->MaxDropDownItems = 4; this->Charsdropbox->Name = L"Charsdropbox"; this->Charsdropbox->Size = System::Drawing::Size(121, 24); this->Charsdropbox->TabIndex = 3; this->Charsdropbox->SelectionChangeCommitted += gcnew System::EventHandler(this, &dialogInit::Charsdropbox_SelectionChangeCommitted); // // Tilefilter // this->Tilefilter->AutoSize = true; this->Tilefilter->Location = System::Drawing::Point(12, 177); this->Tilefilter->Name = L"Tilefilter"; this->Tilefilter->Size = System::Drawing::Size(177, 21); this->Tilefilter->TabIndex = 5; this->Tilefilter->Text = L"Bilinear filtered tiles (H)"; this->Tilefilter->UseVisualStyleBackColor = true; this->Tilefilter->CheckedChanged += gcnew System::EventHandler(this, &dialogInit::Tilefilter_CheckedChanged); // // Spritefilter // this->Spritefilter->AutoSize = true; this->Spritefilter->Location = System::Drawing::Point(12, 204); this->Spritefilter->Name = L"Spritefilter"; this->Spritefilter->Size = System::Drawing::Size(194, 21); this->Spritefilter->TabIndex = 6; this->Spritefilter->Text = L"Bilinear filtered sprites (H)"; this->Spritefilter->UseVisualStyleBackColor = true; this->Spritefilter->CheckedChanged += gcnew System::EventHandler(this, &dialogInit::Spritefilter_CheckedChanged); // // dialogInit // this->AutoScaleDimensions = System::Drawing::SizeF(8, 16); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(428, 249); this->Controls->Add(this->Spritefilter); this->Controls->Add(this->Tilefilter); this->Controls->Add(this->label7); this->Controls->Add(this->Charsdropbox); this->Controls->Add(this->label5); this->Controls->Add(this->okay); this->Controls->Add(this->label4); this->Controls->Add(this->label3); this->Controls->Add(this->label1); this->Controls->Add(this->Mapdropbox); this->Controls->Add(this->Propertiescheckbox); this->Controls->Add(this->Musicdropbox); this->Name = L"dialogInit"; this->Text = L"Engine Setup"; this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void radioButton1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { } private: System::Void Tilefilter_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { } private: System::Void Spritefilter_CheckedChanged(System::Object^ sender, System::EventArgs^ e) { } private: System::Void Mapdropbox_SelectionChangeCommitted(System::Object^ sender, System::EventArgs^ e) { } private: System::Void Musicdropbox_SelectionChangeCommitted(System::Object^ sender, System::EventArgs^ e) { } private: System::Void Charsdropbox_SelectionChangeCommitted(System::Object^ sender, System::EventArgs^ e) { } private: System::Void okay_Click(System::Object^ sender, System::EventArgs^ e) { } private: System::Void Propertiescheckbox_ItemCheck(System::Object^ sender, System::Windows::Forms::ItemCheckEventArgs^ e) { } private: System::Void okay_Click_1(System::Object^ sender, System::EventArgs^ e) { Close(); } }; } in the main cpp file im working on #include"dialogInit.h" // dialog stuff ... dialogInit myDialog = new dialogInit(); // doesn't work, assuming this is even what im supposed to do. as i said, it can't find "dialogInit", but it compiles fine with the header.
  6. i used the form designer to make a windows form. It's defined in its own set of files, dialogInit.cpp, dialogInit.h, and dialogInit.resx. I include the header in my main code and it compiles fine. Now i'm trying to show the dialog but i have absolutely no idea how. I guess im supposed to use ShowDialog or whatever, but I try to refer to the class and make a new() instance of it but it doesn't recognize the name of the class which is clearly defined as public in the header file. Can it be a namespace problem? I don't understand namespaces at all but i see them splattered all over the designer's form header file. (but i tried with and without these in the main file and it still didnt work.) I used the little add item wizard so i would think this wouldn't be a problem, anyways. Help would be appreciated.
  7. EDIT: Nevermind, ive gotten quite off topic by now [Edited by - sqpat on August 23, 2008 3:42:29 AM]
  8. its streaming and I believe im using the oggvorbis SDK. I think every iteration thru the game loop I update the buffer position, but that's it. EDIT: So I suppose I can trigger something in the source for the ogg player to tell it to pause. I'll look into that.
  9. i wanted to make a really basic window with radio buttons, checkboxes, and the like, so that i can have a more user-friendly gui to help pass in some arguments to an engine im working on in directX. Preferably something i can throw together in a few hours. MFC seems to be the way to go. I'm working with VC++ and was wondering what would be the best/easiest way to go about this. Do I just start from scratch or are there easy to use tempates/project wizards? And do i have to include extra libraries or .dlls with my project?
  10. Quote:Original post by Evil Steve Yeah, this is an annoying point with Windows. You'll get a WM_ENTERSIZEMOVE notification when you start moving / resizing your window, and you'll also get WM_MOVING when the window is being moved. I seem to recall that you only get that message when the window position changes, so if you start dragging the window then hold the mouse button but don't move the window, you won't get WM_MOVING messages. You could try creating a timer (With SetTimer) when you get the WM_ENTERSIZEMOVE message, and then destroy (with KillTimer()) in the WM_EXITSIZEMOVE handler. Then in your WM_TIMER handler you can do any updates. Alternatively, there's threading. I don't know of any other methods of getting around this, but I'd like to hear them if there are any (I use the timer method in my engine). I see what you mean. I tried to pause on WM_ENTERSIZEMOVE and unpause on WM_EXITSIZEMOVE but the behavior was the same. Maybe this ogg player is running in a separate thread.
  11. Thanks, those examples helped me out a lot with processing the windows messages. I didnt realize it was supposed to be done in that callback method. One last thing on windows messages: when i am in the process of moving my window, my ogg playing routine continues, but it starts to skip as the buffer position isnt updated. Furthermore the controller input doesn't do anything so it seems the game is paused. So i guess my code halts while i'm moving the window. Is there any message i can catch such that i can pause the whole app similar to what was done with WM_ACTIVATE to prevent the music playing and skipping in this way? I guess it's not a big deal but it would be nice. As for direct input, I'd been using it quite well with my joystick, and that never gave me problems, so I assume that much is all right. I'll look into handling the keyboard without dinput, then.
  12. Some of these questions probably cross into general programming/c++ territory but... oh well. I've been looking at the board FAQ: http://members.gamedev.net/jhoxley/directx/DirectXForumFAQ.htm#D3D_24 So I've got my directX prog/application running, but I've got a number of bugs. not only was this my first venture into directX programming, but also into windows programming. The tutorials I followed didn't mention how to do a lot of these things. - I seem to lose the keyboard device when I switch focus to another window, and it doesnt come back when I return it. here's what im doing at the start: DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (void**)&inputObject, NULL); inputObject->CreateDevice(GUID_SysKeyboard, &inputKeyboard, NULL); inputKeyboard->SetDataFormat(&c_dfDIKeyboard); inputKeyboard->SetCooperativeLevel(han_Window, DISCL_FOREGROUND|DISCL_NONEXCLUSIVE); inputKeyboard->Acquire(); - when i switch focus, the program doesn't 'pause'. I understand i could probably halt the game loop during this time but i dont know how to catch "non focus" or whatever. - when i hit the close button, the process doesn't stop. i assume this is wm_close? - is it possible to lose the direct 3d device? what's this correspond to, a video card being unplugged or something? Really, i think my problem is im not handling the messages, but i don't know how. all im doing is this: [source while(int_AppRunning){ if(PeekMessage(&msg_Message,han_Window,0,0,PM_REMOVE)){ // check for windows messages DispatchMessage(&msg_Message); } and i never do anything with the messages. If someone could give me a couple of tips or link me to a good tutorial on this that would be great; i've looked at a few and just been hopelessly confused.
  13. EDIT: Okay everyone! I think i finally got it. Here is what i did: i set the color key to the ARGB (0, 0, 0, 0) and edited my PNG's color key accordingly p_dx_Device->SetRenderState(D3DRS_ALPHABLENDENABLE, true); p_dx_Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); p_dx_Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); Whoops, there was a small mistake there earlier... the pre-multiplied blending was correct, but since I wanted my sprites to be opaque, I forgot to turn on alpha blending in the first place! Secondly, because I'm rendering the character sprites at two different intervals (once before and once after certain transparent objects are rendered, because of a certain effect i wanted) i was able to render it in a first pass with a heavy alpha stencil and in a second pass without the heavy alpha stencil. This got me this effect: http://sqpat.com/project/mysample39-premult.PNG (obviously the second char's spritesheet has yet to be edited. But it shows a nice bright backdrop to make it easy to see that the first character is properly drawn.) thanks for the help everyone. i finally understand how these blend operations work, rather than just copying what people say to do, now. lastly, sorry if i got anyone angry with that mini-rant earlier. that wasnt my intention, it just felt like no one was listening to what i was trying to say. [Edited by - sqpat on August 20, 2008 4:25:30 AM]
  14. Yup - using d3dxcreatetexturefromfileexa (whew that's a long one) Hodgman, your solution seems to be the exact same one as Matt's, which won't work. It still has the z buffer artifact problem, and I don't want to order sprites and primitives to both be rendered back to front cause that'd get rid of all my batching and slow down the pipeline, quite likely. You're also incorrect on your statement because pre-multiplied alpha blending, when shooting for opaque only sprites, seems quite feasible to get away with without z-buffer artifacts, unless I'm misinterpreting drillan's explanation.
  15. ok i racked my brain on this all day and here's what i came up with a. i realize i can have gimp or photoshop or something do pre-multiplied alpha for me ahead of time. but im not sure how to write the dx code to make it work to render these premultiplied alpha images b. i tried to do the premultiplied alpha stuff in the code itself. this is what i ended up with: (note: alpha blending is enabled) p_dx_Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE); p_dx_Device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); [EDIT] okay i had a bunch of texturestagestates here that dont do anything. [/EDIT] i tried both the old green XRGB color key and the transparent black ARGB color key with a bit of editing of the .png sprite sheet and either way i get these black lines: http://sqpat.com/premultalpha.bmp by the way i've also seen some stuff about the compressed textures... DXT4 mentioned alpha blending. but i wasn't sure if they were lossless or not (kind of important when talking about sprite accuracy). Should i be looking at something like that or is it lossy? [Edited by - sqpat on August 20, 2008 3:08:05 AM]
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!