• Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About spx2

  • Rank
  1. if I drag and drop an item from outside a SDL window inside it , can I make SDL intercept that ?
  2. sdl build for dev-c++

    Quote:Original post by jbadams At the time of writing the sourceforge page lists [i]340 known bugs yes but what I was actually saying is that from those 340 known bugs, those that matter are the bugs of gdb/mingw and not the ones of dev-c++. I decided to drop dev-c++ and just use gvim+mingw+gdb.
  3. Quote:Original post by Sneftel Moved to the Suggestions forum. From what I've heard of the codebase, my guess is that this won't be implemented anytime soon due to the limited audience and the dangers involved in mucking further with the extremely-mucked-up post text handling code. If you like, however, you can just use a public MimeTeX . great, maybe this can go in some posting guidelines for people to write formulas with it.
  4. automated GUI testing

    Quote:Original post by Red Ghost move and clicks (sending yourself timed events instead of reading the real mouse states and position) and log all test results Quote:Original post by Kimmi Maybe something like a written log could be useful. If a codepath was passed a log mechanism writes this into a protocoll file. At the end you can diff the protocoll against an older protocoll where the result was fine. Quote:Original post by Kimmi So you should be able to generate the log output in the mock-objects. ok, can you recommend me a good cross-platform opensource logging library ? I could write my own but I'd prefer to use something that someone thought-out better because I want to use it but it's not my main focus. my main focus is testing. I've written a quick script in Perl to test my app: package Mole::Test; use strict; use warnings; use feature ":5.10"; # always use this for given/when use Win32::GuiTest qw(:ALL); use Win32::Clipboard; use Imager::Screenshot; use Data::Dumper; use Digest::MD5; use Test::More; use Moose; use GD; use Carp; # the HWND of the wfsdl Window has wfsdl => ( isa => 'Int', is => 'rw', default => undef, ); has image => ( isa => 'Any', is => 'rw', default => undef, ); # focus on the window with the HWND given as parameter sub focus { my ($self) = @_; SetForegroundWindow($self->wfsdl); MouseMoveAbsPix((GetWindowRect($self->wfsdl))[0,1]); } # find the window needed, if not fire up wfsdl.exe and then find its HWND sub BUILD { my ($self) = @_; FindWindowLike(0, "readme|README", "Notepad"); $self->wfsdl( (FindWindowLike(0, "", "SDL_app"))[0] ); unless($self->wfsdl) { system("start wfsdl.exe"); sleep(1); $self->wfsdl( (FindWindowLike(0, "", "SDL_app"))[0] ); } $self->focus; print "HWND of wfsdl application is ".$self->wfsdl."\n"; } sub click { my ($self,$x,$y,$type) = @_; SendMouse ( "{REL$x,$y}" ); given($type) { when(/^LUP$/) { SendLButtonUp(); } when(/^LDOWN$/) { SendLButtonDown(); } when(/^RUP$/) { SendRButtonUp(); } when(/^RDOWN$/) { SendRButtonDown(); } default { } }; } sub drag_drop { my ($self,$x1,$y1, ,$x2,$y2, ,$code ) = @_; $self->click($x1,$y1,"LDOWN"); $self->click($x2,$y2,"LUP"); $self->focus; } sub test_button_move { my ($self) = @_; $self->drag_drop(51,71,200,30, sub{} ); $self->get_picture(); } # read pixel in Uint32 format from last image taken from get_picture sub read_pixel { my ($self,$x,$y) = @_; croak 'no last image' unless $self->image; my $index = $self->image->getPixel($x,$y); my ($r,$g,$b) = $self->image->rgb($index); return $r<<16 + $g<<8 + $b; } # TODO: add bmp2png utilitary to subversion code # # NOTE: # this basically selects the window and does PRTSCR and pastes # in a bmp file the clipboard and then converts to png and saves the png # object in the image attribute sub get_picture { my ($self) = @_; my $clip = Win32::Clipboard->new(); $self->focus; SendKeys("%{PRTSCR}"); my $fname = "$ARGV[ 0 ]-@{[ time() ]}"; if( my $bitmap = $clip->GetBitmap() ) { local $\; my $bmpfile = $fname . '.bmp'; open my $bmp, '>', $bmpfile or die $!; binmode $bmp; print $bmp $bitmap; close $bmp; print "Bitmap written to $bmpfile\n"; system "bmp2png $bmpfile"; print "Converted to $fname.png"; $self->image(GD::Image->newFromPng("$fname.png")); } } sub run_tests { my ($self) = @_; $self->test_button_move; } package main; my $mole = Mole::Test->new; $mole->run_tests; done_testing();
  5. Quote:Original post by taby I'm sure that'd be one heck of a thing to implement, but I agree that it would be really nice to have LaTeX support (says me, the guy who can't really afford to pay any gdnet fees so that this kind of thing can be funded, heh). :( I respect the people who provide gdnet but mimetex is really easy to implement.
  6. hi, please enable LaTeX rendering of formulas on the forum.
  7. Quote:Original post by haegarr change the local co-ordinate frame of the ball and let the texture fixed. how do I do that ?
  8. ok and should I map texture from cube to sphere like this ? if you notice , the texture at the corners is distorted comparing cube to sphere ... if I do how you recommend to make 6 patches out of it(and that's because of some property of the sphere which we learned at differential geometry and I forgot how it's called, it had something to do with projections I think ... maybe this ?) then I have to find which portion of the texture I should use so that it's mapped correctly by trial and error maybe
  9. suppose you have a ball and put texture on it(I wouldn't know how to map texture to a sphere...how do I do that?) and suppose you get the ball rolling in some direction, the texture must of course move also. do I just measure how much space it traveled and do that mod(I mean %) circumference of sphere and find out how much to shift the texture so that it realistically looks like the ball has moved ?
  10. I was thinking about this. To have an RPG in which the main character can kill opponents with his sword. I'd like to confirm/infirm this idea before I start going further so here goes: the sword will be guided by the position of the mouse and we'll compute the speed with which it's travelling, he will also have a pretty big shield. The opponent will have the same. The problem is I want to make this look realistic so if he bangs his sword against his enemy I want to compute a real collision and see if it really hit him or his shield. I have the following situation: the sword hits his body in which case I will probably have some blood effect(although I'm not sure how this is done) the sword hits his shield in which case I'll have some sparks go off and what should happen to the blade after that ? I mean ... it shouldn't go through the shield and a collision needs to be detected. How do I have all the body parts fit together so that I can move the sword ? How do I detect the collision between the sword and the body ? suppose the sword hits his sword, then I have sparks, the same problem as above, how do I find if the sword collides with his sword ? do I approximate the swords to 2 rectangles in space and just find if they collide by solving some linear system of equations ? My questions are , how do I model the sword ? as some sort of polyhedron(let's suppose I use convex hull for a set of points in 3D, is it easier to check for collisions between 2 convex polyhedra, of course it will not be accurate but as I understand games are not simulations and they're made to be fun , I forgot where I read that) ? should I use a model ? .3DS or something ? How will I do the collision detection? Suppose their bodies are 3DS models , how do I check for collisions ? I got the idea from here that they are approximating body parts to spheres and checking collisions between spheres... this would amount in O(m*n) complexity if 2 objects had m and n such spheres. I don't know if this is a very good method... what do you think ? would you approach the problem in a different way ? There is also a gameplay part that I'd like to discuss. It would be nice if the player could block attacks from multiple sides, but then some sort of complexity of controlling the character might turn him off and the game might not be so interesting. For example if I allow the character to block attacks from: front left right above and map these defenses to some keys say K,J,L,I , these would be pretty intuitive. but if I add to this the fact that I want to be able to control the movement of the character to left, I'll also have keys at least some directional keys W,A,S,D(the classical keyset). Now imagine a scenario where the player wants to attack the other player and then quickly run away, he will have to jump his fingers over lots of keys and also use the mouse to control the attack.. I think this may result in less fun playing the game which is of course not what I want.
  11. automated GUI testing

    hmm this sounds pretty realistic and doable. I guess I could hook up pretty fast something using Perl with Win32::GuiTest and Win32::Screenshot and Text::Diffsome which would work the way you describe. I think Win32::GuiTest will allow me to send keyboard and mouse events. I hope it can allow me to do drag & drop. I'm afraid however it can't be generalized to a game. For example if you have some particle system it will have a degree of randomness in it and the screenshots won't match. But basically for a GUI which has nothing unpredictable going on it should work fine. Are you using some testing framework for this , or did you write it ? If you wrote it , what language ? What language do you write the test-scripts in ? You also suggest to make diffs of screens and also diffs of protocol files, isn't that somehow redundant or am I missing some point ? Quote:Original post by Kimmi I am using the the following procedure to test my GUI stuff: I try to separate the logic from the GUI ( for instance by using a pattern like MVC ). Now I can test my logic against my wished bahaviour by using a test-script. And I am simulating the user GUI by simulating user actions. Here we are able to verify the result by a screenshot diff for each widget. If both works fine I am starting integration tests. An integration test replays a defined user story with a well-defined result at the end, where a lot classes of the logic and the GUI are involved. If the wished result is there the test passed. The hard part is to automate the integration tests and the verification because you have to verify GUI and logic interactions and screens. Maybe something like a written log could be useful. If a codepath was passed a log mechanism writes this into a protocoll file. At the end you can diff the protocoll against an older protocoll where the result was fine. But this is just one approach :-). Kimmi
  12. SDL_mixer example?

    jyk , thank you for testing. before writing a minimal working example I'd like to point out what I read in the SDL_mixer documentation: Quote: 4.1.4 Mix_OpenAudio SDL must be initialized with SDL_INIT_AUDIO before this call. frequency would be 44100 for 44.1KHz, which is CD audio rate. Most games use 22050, because 44100 requires too much CPU power on older computers. chunksize is the size of each mixed sample. The smaller this is the more your hooks will be called. If make this too small on a slow system, sound may skip. If made to large, sound effects will lag behind the action more. You want a happy medium for your target computer. You also may make this 4096, or larger, if you are just playing music. MIX_CHANNELS(8) mixing channels will be allocated by default. This leads to the conclusion that there's something wrong with how I'm using Mix_OpenAudio , how do you call it, what parameters are you using ? I'm using the following: int audio_rate = 22050; Uint16 audio_format = AUDIO_S16; int audio_channels = 2; int audio_buffers = 4096; if(Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers)) Ah yes , while writing this it seems I've solved it, I peeked in the code of supermariowars here and saw it used Mix_OpenAudio(44100, AUDIO_S16, 2, 2048); and built it again and now it seems the problem is solved.
  13. List of free libraries

    LIBAGAR looks very good and I've been told it's pretty fast but I wasn't able to get any of the demo apps work properly, can anyone confirm this ?
  14. SDL_mixer example?

    Quote:Original post by jyk Quote:Original post by gaerg Mix_OpenAudio(22050,MIX_DEFAULT_FORMAT,2,4096) Tried with 44100 and 1024 values too. Same problem. I'm using Win XP Professional 2002 SP 3. I've compiled the same thing on our school's computers and the problem is the same. Sounds work fine on other (non open source) games that use SDL_mixer. The problem is just that the sound comes with a one or a half second delay.All I can tell you is that the behavior you describe is not typical. It sounds like something is wrong with your program, or that there's a hardware and/or driver problem with the systems you're testing on. Since you say other games that use SDL + SDL_mixer for sound seem to work fine, it seems like the problem is probably specific to your application (e.g. related to the implementation or to the sound files you're using). Again, I'd recommend putting together a minimal working example (e.g. a single source file and an accompanying sound file) that demonstrates the behavior. Either you'll find the source of the problem in the course of creating the example, or if not, you'll have something you can post here for us to take a look at and maybe try out ourselves to see if we get the same behavior. ok, try this out , please tell me if you feel a delay in the sound after you press direction keys to move the piece, thanks
  15. SDL_mixer example?

    Quote:Original post by gaerg Mix_OpenAudio(22050,MIX_DEFAULT_FORMAT,2,4096) Tried with 44100 and 1024 values too. Same problem. I'm using Win XP Professional 2002 SP 3. I've compiled the same thing on our school's computers and the problem is the same. Sounds work fine on other (non open source) games that use SDL_mixer. The problem is just that the sound comes with a one or a half second delay. I'm getting the same here with using mingw under windows. no other application was running that used the sound card when this happened.