CPU/power info
This commit is contained in:
parent
8092855354
commit
bcdbdd4fb0
@ -1,13 +1,6 @@
|
||||
import ctypes
|
||||
_SDL = ctypes.cdll.LoadLibrary('/usr/local/lib/libSDL-1.3.so.0.0.0')
|
||||
|
||||
def get_power_info():
|
||||
seconds = ctypes.c_int()
|
||||
percent = ctypes.c_int()
|
||||
_SDL.SDL_GetPowerInfo(ctypes.byref(seconds),
|
||||
ctypes.byref(percent))
|
||||
return seconds.value, percent.value
|
||||
|
||||
# Constants
|
||||
class INIT(object):
|
||||
TIMER = 0x00000001
|
||||
@ -129,6 +122,55 @@ def get_revision():
|
||||
return _SDL.SDL_GetRevision()
|
||||
|
||||
|
||||
#### System Information
|
||||
|
||||
_SDL.SDL_GetPlatform.restype = ctypes.c_char_p
|
||||
def get_platform():
|
||||
return _SDL.SDL_GetPlatform()
|
||||
|
||||
def get_cpu_cache_line_size():
|
||||
return _SDL.SDL_GetCPUCacheLineSize()
|
||||
|
||||
def get_cpu_count():
|
||||
return _SDL.SDL_GetCPUCount()
|
||||
|
||||
def has_3DNow():
|
||||
return _SDL.SDL_Has3DNow() == 1
|
||||
|
||||
def has_AltiVec():
|
||||
return _SDL.SDL_HasAltiVec() == 1
|
||||
|
||||
def has_MMX():
|
||||
return _SDL.SDL_HasMMX() == 1
|
||||
|
||||
def has_RDTSC():
|
||||
return _SDL.SDL_HasRDTSC() == 1
|
||||
|
||||
def has_SSE():
|
||||
return _SDL.SDL_HasSSE() == 1
|
||||
|
||||
def has_SSE2():
|
||||
return _SDL.SDL_HasSSE2() == 1
|
||||
|
||||
def has_SSE3():
|
||||
return _SDL.SDL_HasSSE3() == 1
|
||||
|
||||
def has_SSE41():
|
||||
return _SDL.SDL_HasSSE3() == 1
|
||||
|
||||
def has_SSE42():
|
||||
return _SDL.SDL_HasSSE42() == 1
|
||||
|
||||
def get_power_info():
|
||||
seconds = ctypes.c_int()
|
||||
percent = ctypes.c_int()
|
||||
state = _SDL.SDL_GetPowerInfo(ctypes.byref(seconds),
|
||||
ctypes.byref(percent))
|
||||
state = {0: 'UNKNOWN', 1: 'ON_BATTERY', 2: 'NO_BATTERY', 3: 'CHARGING',
|
||||
4: 'CHARGED'}[state]
|
||||
return state, seconds.value, percent.value
|
||||
|
||||
|
||||
#### video
|
||||
|
||||
class DisplayMode(ctypes.Structure):
|
||||
|
@ -29,3 +29,10 @@ CategoryRender
|
||||
SDL_RenderReadPixels -- returns void*
|
||||
|
||||
SDL_pixels
|
||||
|
||||
Made Irrelevant by Python
|
||||
Byte Order
|
||||
File I/O Abstraction
|
||||
Shared Object Loading
|
||||
Threads/Atomic Operations
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user