Skocz do zawartości

kt1117

Użytkownicy
  • Postów

    1 103
  • Dołączył

  • Ostatnia wizyta

Treść opublikowana przez kt1117

  1. kt1117

    Dziennikarstwo?

    Ja jestem w 2 Gim. i już wiem co chce robić: INFA! Praktycznie tylko to mnie interesuje i poświęcam jej większość wolnego czasu, nie gram w gry dłużej jak 30 min. bo wolę programować i po gimnazjum idę do technikum informatycznego (chyba jednak w Bydgoszczy, rodzice nie chcą mnie puścić do Gdyni, ani tym bardziej do Warszawy), a następnie Polibuda w Warszawie na kierunku informatycznym, wtedy do jakiejś pracy gdzie nazbieram kapitału, zwalniam się i tworzę własną firmę (oczywiście informatyczna, tworzenie gier i programów, może jakiś OS, ale tych jest multum.)
  2. Im szybciej tym mniej bardziej pasować będzie.
  3. kt1117

    Must Be The Music

    Nie pamiętam nazwiska, ale była tam jedna co tak dziwnie się ubrała i piszczała, ale była oryginalna i mi się to podobało. Podobał mi się też ten co grał na akordeonie i tak szybko śpiewał.
  4. GML (Create Auta) siedze_w=false
  5. Później zamiast pisać np.: GML if siedze_w=noone siedze_w=true if siedze_w=true siedze_w=noone Piszesz: GML siedze_w=!siedze_w
  6. W Create, siedze_w,ustaw na false nie na noone, później będzie wygodniej pisać.
  7. Pozwolę sobie wstawić pokolorowane: Gracz: GML (Step) //szukamy najbliższe auto aa = instance_nearest( x , y , carParent ) //wyłączenie rysowania sprita podczaj jazdy autem if ( siedze_w = noone ) visible = true else visible = false //viewy if ( siedze_w = noone ) view_object[ 0 ] = Gracz else view_object[ 0 ] = siedze_w GML (End Step) if ( keyboard_check_pressed( vk_enter )) { //wysiadanie if ( siedze_w <> noone ) { x = siedze_w.x + lengthdir_x( 30 , siedze_w.direction + 90 ) // 30 jest odległością w której hero pojawi się po wyjściu z auta y = siedze_w.y + lengthdir_y( 30 , siedze_w.direction + 90 ) siedze_w = noone with( carParent ) wsiadanie = false exit } //wsiadanie if( distance_to_object( aa ) <= 2 ) { if ( siedze_w = noone ) { siedze_w = aa with( aa ) wsiadanie = true } } } GML (kolizja Car Parent) if ( siedze_w = noone and visible = true ) { x = xprevious y = yprevious } GML (Alarm0) if distance_to_object(carParent) <=5 {global.chodzi=1} instance_deactivate_object(Gracz) GML (Create) siedze_w = noone aa = 0 Auto: GML (Create) if global.chodzi=1 { if alarm[0]=-1 {alarm[0]=2} } GML (Step) //szukamy najbliższe auto aa = instance_nearest( x , y , carParent ) { //jazda i specyfikacja auta smile.gif if ( keyboard_check( vk_up )) speed = 15 else if ( keyboard_check( vk_down )) speed = -5 if ( speed <> 0 ) { if ( keyboard_check( vk_right )) direction -= 4 else if ( keyboard_check( vk_left )) direction += 4 } if ( keyboard_check( vk_space )) speed = 0 friction = 0.1 image_angle = direction } //gdy gracz siedzi w aucie te zyskuje największy depth depth = id - 100*wsiadanie
  8. Jest też pod Room'ami. Naczy pod tym drzewem zasobów.
  9. Global Game Settings>>Error>>Ostatnia pozycja.
  10. Nie mam pojęcia. Nie widzę całego kodu, kombinuj.
  11. Program zakończył działanie przed wykonaniem całego kodu.
  12. Zaznacz Treat unitialized variable to 0, bądź w Create obiektu wpisz:wsiadanie=false.
  13. GML (Create) niszcz=true GML (Step) niszcz=true if x>view_xview[0] and x<(view_xview[0]+view_wview[0]) and y>view_yview[0] and y<(view_yview[0]+view_hview[0]) niszcz=false if niszcz instance_destroy() E:Muuuuuuuuuuuuuuuuuuuuuuuuuczek567 był szybszy. E2:Możesz zrobić jeszcze tak: GML (Create) niszcz=true GML (Step) niszcz=true if collision_rectangle(view_xview[0],view_yview[0],view_wview[0],view_hview[0]) niszcz=false if niszcz instance_destroy()
  14. kt1117

    Haki

    Kurde, nie działa w żaden sposób, zostawię to na razie i wrócę do tego za jakiś czas, a na razie wezmę się za Irllichta. E:Albo się jeszcze nie poddaje, bo dowiedziałem się, że teraz muszę sprawdzić, czy hak jest założony. Jednak powinno być 0. E2:Dałem radę, mam takie coś i działa: #include <windows.h> #include <fstream> int a=1; int b=true; int c=true; HHOOK g_MyHook = NULL; HBRUSH pedzel=CreateSolidBrush(RGB(00,60,00)); HWND hwnd; DWORD errorCode; /* Declare Windows procedure */ LRESULT CALLBACK AltF4Proc (int code, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "Muzykant"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow) { /* This is the handle for our window */ MSG messages; /* Here meCreateSolidBrush(RGB(00,00255))ssages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default colour as the background of the window */ wincl.hbrBackground = pedzel; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Muzykant", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ 30, /* Windows decides the position */ 30, /* where the window ends up on the screen */ 1400, /* The programs width */ 800, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); /* Make the window visible on the screen */ ShowWindow (hwnd, nCmdShow); MessageBox (hwnd,"Komunikat na pulpicie",NULL,NULL); g_MyHook = SetWindowsHookEx (WH_KEYBOARD, &AltF4Proc, NULL, GetCurrentThreadId()); DWORD errorCode = GetLastError(); std::ofstream log( "log.txt" ); if( log.good() ) { log << "Kod błędu: " << errorCode << '\n'; } /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; } LRESULT CALLBACK AltF4Proc (int code, WPARAM wParam, LPARAM lParam) { if (code < 0) return CallNextHookEx (0, code, wParam, lParam); if (wParam==VK_F1) { MessageBox (hwnd, "Nie zamkniesz mnie tak łatwo!", NULL, MB_ICONEXCLAMATION); return 0; } if (wParam==VK_F2) { MessageBox (hwnd, "Nie zamkniesz mnie tak łatwo!", NULL, MB_ICONEXCLAMATION); return 0; } return CallNextHookEx (0, code, wParam, lParam); } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_DESTROY: UnhookWindowsHookEx (g_MyHook); PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; case WM_KEYDOWN: if (wParam==VK_F1) { Beep(128*16*a,222); } if (wParam==VK_F2) { Beep(144*16*a,222); } if (wParam==VK_F3) { Beep(160*16*a,222); } if (wParam==VK_F4) { Beep(176*16*a,222); } if (wParam==VK_F5) { Beep(192*16*a,222); } if (wParam==VK_F6) { Beep(208*16*a,222); } if (wParam==VK_F7) { Beep(224*16*a,222); } if (wParam==VK_F8) { Beep(240*16*a,222); } if (wParam==VK_UP) { if (b and a<16) { a*=2; b=false; } }if (wParam==VK_DOWN) { if (c and a>1) { a/=2; c=false; } } if (wParam==VK_ESCAPE) { UnhookWindowsHookEx (g_MyHook); PostQuitMessage (0); } break; case WM_KEYUP: if (wParam==VK_UP) { b=true; } if (wParam==VK_DOWN) { c=true; } break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); } return errorCode; } Więc teraz idę do globalnych i mam następny problem, bo mam kod dll: #include "main.h" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { g_hInst = hModule; switch( ul_reason_for_call ) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } To było .cpp, teraz .h: #ifndef _MAIN_H_ #define _MAIN_H_ #if BUILDING_DLL # define DLLIMPORT __declspec (dllexport) #else /* Not BUILDING_DLL */ # define DLLIMPORT __declspec (dllimport) #endif /* Not BUILDING_DLL */ #include <windows.h> #include <vector> using namespace std; vector < EVENTMSG > g_Events; int g_CurrentEvent; bool g_PlaybackStopped; HHOOK g_RecordHook = NULL; HHOOK g_PlaybackHook = NULL; DWORD g_StartTime = 0; HINSTANCE g_hInst = NULL; DLL_API LRESULT CALLBACK RecordProc( int code, WPARAM wParam, LPARAM lParam ) { if( code < 0 ) return CallNextHookEx( 0, code, wParam, lParam ); if( code == HC_ACTION ) { EVENTMSG * msg =( EVENTMSG * ) lParam; msg->time -= g_StartTime; g_Events.push_back( * msg ); return 0; } return CallNextHookEx( 0, code, wParam, lParam ); } DLL_API LRESULT CALLBACK PlaybackProc( int code, WPARAM wParam, LPARAM lParam ) { if( code < 0 ) return CallNextHookEx( 0, code, wParam, lParam ); if( code == HC_GETNEXT ) { EVENTMSG * msg =( EVENTMSG * ) lParam; msg->hwnd = g_Events[ g_CurrentEvent ].hwnd; msg->message = g_Events[ g_CurrentEvent ].message; msg->paramH = g_Events[ g_CurrentEvent ].paramH; msg->paramL = g_Events[ g_CurrentEvent ].paramL; msg->time = g_StartTime + g_Events[ g_CurrentEvent ].time; DWORD delta = msg->time - GetTickCount(); if( delta > 0 ) return delta; else return 0; } else if( code == HC_SKIP ) { if( !g_PlaybackStopped ) g_CurrentEvent++; if( g_CurrentEvent >= g_Events.size() ) { g_CurrentEvent = 0; g_StartTime = GetTickCount(); g_PlaybackStopped = false; return 0; } } return 0; } DLL_API void StartRecording( void ) { g_StartTime = GetTickCount(); g_RecordHook = SetWindowsHookEx( WH_JOURNALRECORD, RecordProc, g_hInst, 0 ); } DLL_API void StartPlayback( void ) { g_CurrentEvent = 0; g_StartTime = GetTickCount(); g_PlaybackStopped = false; UnhookWindowsHookEx( g_RecordHook ); g_PlaybackHook = SetWindowsHookEx( WH_JOURNALPLAYBACK, PlaybackProc, g_hInst, 0 ); } extern "C" { DLL_API void StartPlayback( void ); DLL_API void StartRecording( void ); } #endif /* _DLL_H_ */ I niestety nie działa, nie rozpoznaje makra DLL_API, wyskakują takie błędy: w\hakglobalny\main.h|23|error: 'DLL_API' does not name a type| w\hakglobalny\main.h|38|error: 'DLL_API' does not name a type| w\hakglobalny\main.h|75|error: expected constructor, destructor, or type conversion before 'void'| w\hakglobalny\main.h|81|error: expected constructor, destructor, or type conversion before 'void'| w\hakglobalny\main.h|92|error: expected constructor, destructor, or type conversion before 'void'| w\hakglobalny\main.h|93|error: expected constructor, destructor, or type conversion before 'void'|
  15. kt1117

    Haki

    Przecież pisałem, że nie działa mi: w\haki\main.cpp|59|error: 'getCurrentThreadId' was not declared in this scope|
  16. kt1117

    Haki

    To ja wiem, ale skąd wziąć to ID.
  17. kt1117

    Haki

    Ta funkcja działa od Visty w górę. Sprawdzałem ją jako pierwszą. Przed chwilą sprawdziłem: g_MyHook = SetWindowsHookEx (WH_KEYBOARD, &AltF4Proc, (HINSTANCE) hwnd, NULL); Kompiluję się, ale hak nie działa.
  18. kt1117

    Haki

    Bo czytałem, że jeśli hak nie ma być lokalny, czyli nie potrzeba DLL'a, to trzeci parametr musi być NULL.
  19. kt1117

    Haki

    Próbowałem już: -0 -(DWORD) 0 -NULL -(DWORD) hwnd Ale i tak okno można wyłączyć.
  20. kt1117

    Haki

    Mam kod: #include <windows.h> HHOOK g_MyHook = NULL; HWND hwnd; /* Declare Windows procedure */ LRESULT CALLBACK AltF4Proc (int code, WPARAM wParam, LPARAM lParam); LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM); /* Make the class name into a global variable */ char szClassName[ ] = "CodeBlocksWindowsApp"; int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE hPrevInstance, LPSTR lpszArgument, int nCmdShow) { /* This is the handle for our window */ MSG messages; /* Here messages to the application are saved */ WNDCLASSEX wincl; /* Data structure for the windowclass */ /* The Window structure */ wincl.hInstance = hThisInstance; wincl.lpszClassName = szClassName; wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */ wincl.style = CS_DBLCLKS; /* Catch double-clicks */ wincl.cbSize = sizeof (WNDCLASSEX); /* Use default icon and mouse-pointer */ wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION); wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION); wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.lpszMenuName = NULL; /* No menu */ wincl.cbClsExtra = 0; /* No extra bytes after the window class */ wincl.cbWndExtra = 0; /* structure or the window instance */ /* Use Windows's default colour as the background of the window */ wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND; /* Register the window class, and if it fails quit the program */ if (!RegisterClassEx (&wincl)) return 0; /* The class is registered, let's create the program*/ hwnd = CreateWindowEx ( 0, /* Extended possibilites for variation */ szClassName, /* Classname */ "Code::Blocks Template Windows App", /* Title Text */ WS_OVERLAPPEDWINDOW, /* default window */ CW_USEDEFAULT, /* Windows decides the position */ CW_USEDEFAULT, /* where the window ends up on the screen */ 544, /* The programs width */ 375, /* and height in pixels */ HWND_DESKTOP, /* The window is a child-window to desktop */ NULL, /* No menu */ hThisInstance, /* Program Instance handler */ NULL /* No Window Creation data */ ); g_MyHook = SetWindowsHookEx (WH_KEYBOARD, &AltF4Proc, NULL, ???); /* Make the window visible on the screen */ ShowWindow (hwnd, nCmdShow); /* Run the message loop. It will run until GetMessage() returns 0 */ while (GetMessage (&messages, NULL, 0, 0)) { /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); /* Send message to WindowProcedure */ DispatchMessage(&messages); } /* The program return-value is 0 - The value that PostQuitMessage() gave */ return messages.wParam; } /* This function is called by the Windows function DispatchMessage() */ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) /* handle the messages */ { case WM_DESTROY: UnhookWindowsHookEx (g_MyHook); PostQuitMessage (0); /* send a WM_QUIT to the message queue */ break; case WM_KEYDOWN: if (wParam==VK_F1) { Beep(128,222); } if (wParam==VK_F2) { Beep(144,222); } if (wParam==VK_F3) { Beep(160,222); } if (wParam==VK_F4) { Beep(186,222); } if (wParam==VK_F5) { Beep(212,222); } if (wParam==VK_F6) { Beep(238,222); } if (wParam==VK_F7) { Beep(264,222); } if (wParam==VK_F8) { Beep(290,222); } break; default: /* for messages that we don't deal with */ return DefWindowProc (hwnd, message, wParam, lParam); } return 0; } LRESULT CALLBACK AltF4Proc (int code, WPARAM wParam, LPARAM lParam) { if (code < 0) return CallNextHookEx (0, code, wParam, lParam); if (wParam == VK_F4 && (lParam & 536870912)) { MessageBox (hwnd, "Nie zamkniesz mnie tak łatwo!", NULL, MB_ICONEXCLAMATION); return 1; } return CallNextHookEx (0, code, wParam, lParam); } Taki tam, i nie wiem co podstawić w miejsce ???, żeby kompilowało się i działało pod XP.
  21. Nie ma mouse.x, jest tylko mouse_x, tak samo z y.
  22. Nie tnij się, masz 4.

  23. kt1117

    Stężenia procentowe

    Zaraz sprawdzę. E:2 Źle, wziąłeś pod uwagę tylko wodę, powinieneś dzielić przez 200, a nie przez 160. E2:Reszta chyba dobrze.
  24. kt1117

    Stężenia procentowe

    6.Dane: Szukane: Wzór: mr=125g C%=? C%=ms/mr*100% ms=25g Rozwiązanie: C%=25/125*100=20%
  25. kt1117

    Komedie

    Tak, uwielbiałem go, lecz niestety umarł.
×
×
  • Dodaj nową pozycję...